Share
Embed
Transcript
22 slides
-
Copyright © 2024 Studist Corporation. all rights reserved. ⾃⼰紹介 2
nagi (twitter: @_windupbird_) ⼊社: 2021年5⽉ 所属: CREグループ やっていること: Teachme Biz の開発‧運⽤ -
Copyright © 2024 Studist Corporation. all rights reserved. Teachme Biz
と Amazon CloudFront Distribution 3 静的コンテンツはAmazon CloudFront Distribution を利⽤して配信している。 各役割に応じて Distribution が存在する。 例: 画像、動画、アセット etc… -
Copyright © 2024 Studist Corporation. all rights reserved. Amazon CloudFront
のドメインを直接利⽤していた これまで 4 Amazon CloudFront Distribution を作成すると、 cloudfront.net のドメインが払い出される。 例: 画像 → xxx.cloudfront.net 動画 → yyy.cloudfront.net アセット → zzz.cloudfront.net これをサービスで直接利⽤していた。 -
Copyright © 2024 Studist Corporation. all rights reserved. Distributionを削除してしまうと同じドメインは取得できない 問題1
5 https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-creating-console.html 引⽤: CloudFront domain names are unique. Your distribution's domain name was never used for a previous distribution and will never be reused for another distribution in the future. -
Copyright © 2024 Studist Corporation. all rights reserved. Distributionを削除してしまうと同じドメインは取得できない 問題1
6 https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-creating-console.html 引⽤: CloudFront domain names are unique. Your distribution's domain name was never used for a previous distribution and will never be reused for another distribution in the future. -
Copyright © 2024 Studist Corporation. all rights reserved. Distributionを削除してしまうと同じドメインは取得できない 問題1
7 もし誤ってDistributionを削除してしまうと... 新Distributionの構築 + アプリケーション側で設定の書き換え →その間サービスが利⽤できない -
Copyright © 2024 Studist Corporation. all rights reserved. Distributionが増減すると伝⾔ゲームが必要になる 問題2
8 Teachme Biz のユーザー企業のうち、社内利⽤可能なSaaSを制限しているところもある。 → 具体的には、情報システム部⾨が利⽤可能なドメインをホワイトリストに登録‧許可することで、 初めて社外のSaaSが利⽤可能になるような場合。 -
Copyright © 2024 Studist Corporation. all rights reserved. Distributionが増減すると伝⾔ゲームが必要になる 問題2
9 Teachme Biz の機能追加(または削除)に伴って、Distributionが増加する(減少する) 例: foo.cloudfront.net スタディスト → 新ドメイン(foo.cloludfront.net)を連絡する 担当者 → 社内の情報システム部⾨に新ドメインの登録を依頼 情報システム部⾨ → 新ドメインをホワイトリストに登録 -
Copyright © 2024 Studist Corporation. all rights reserved. サービスが使えない時間が想定以上に⻑くなってしまう 問題3
10 【問題1と問題2の複合】 万が⼀、誤って既存のDistributionを削除してしまう。 →新Distributionを構築してたとしても、Teachme Bizのユーザーは伝⾔ゲームが 終わるまで(新ドメインがホワイトリストに登録されるまで)サービスが使えない。 -
Copyright © 2024 Studist Corporation. all rights reserved. 問題まとめ 11
1. Distributionを削除してしまうと同じドメインは取得できない 2. Distributionが増減すると伝⾔ゲームが必要になる 3. サービスが使えない時間が想定以上に⻑くなってしまう -
Copyright © 2024 Studist Corporation. all rights reserved. 代替ドメインを利⽤する どうするか?
12 代替ドメインという機能がある。 Distribution に独⾃ドメインを利⽤して アクセスが可能。 例: 画像 → images.teachme.jp 動画 → videos.teachme.jp アセット → assets.teachme.jp https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html -
Copyright © 2024 Studist Corporation. all rights reserved. ユーザーには代替ドメインを許可してもらう どうするか?
13 代替ドメインを個別に許可する。 or *.teachme.jp とワイルドカードで許可してもらうようにする(※)。 → 将来、Teachme Biz の機能追加(または削除)によるドメインの増減があっても 伝⾔ゲームをしなくてもよくなる。 ※もし *.cloudfront.net を許可すると、世界中の Amazon CloudFront へのアクセスを許可してしまう -
Copyright © 2024 Studist Corporation. all rights reserved. どうよくなるか? 14
万が⼀、Distributionを削除しても復旧が容易 https://images.teachme.jp/path/to/image.png xxx.cloudfront.net images.teachme.jp を利⽤して画像配信している -
Copyright © 2024 Studist Corporation. all rights reserved. どうよくなるか? 15
万が⼀、Distributionを削除しても復旧が容易 https://images.teachme.jp/path/to/image.png xxx.cloudfront.net 仮にDistributionを削除してしまった場合 -
Copyright © 2024 Studist Corporation. all rights reserved. どうよくなるか? 16
万が⼀、Distributionを削除しても復旧が容易 https://images.teachme.jp/path/to/image.png xxx.cloudfront.net yyy.cloudfront.net 新規にDistributionを作成する -
Copyright © 2024 Studist Corporation. all rights reserved. どうよくなるか? 17
万が⼀、Distributionを削除しても復旧が容易 https://images.teachme.jp/path/to/image.png xxx.cloudfront.net yyy.cloudfront.net 最後にドメインの向き先を変更することで復旧 -
Copyright © 2024 Studist Corporation. all rights reserved. どうよくなるか? 18
万が⼀、Distributionを削除しても復旧が容易 https://images.teachme.jp/path/to/image.png xxx.cloudfront.net yyy.cloudfront.net ユーザーは xxx.cloudfront.net や yyy.cloudfront.net を意識しなくても良くなる -
Copyright © 2024 Studist Corporation. all rights reserved. 結論 19
Amazon CloudFrontの代替ドメインは使っていきましょう -
Copyright © 2024 Studist Corporation. all rights reserved. ちなみに... 20
すべてのDistributionで代替ドメインへの移⾏が完了したか? すぐに移⾏できるものはした。 すぐに移⾏できないものは絶賛移⾏中。 -
Copyright © 2024 Studist Corporation. all rights reserved. ちなみに... 21
すべてのDistributionで代替ドメインへの移⾏が完了したか? すぐに移⾏できるものはした。 すぐに移⾏できないものは絶賛移⾏中。 → 代替ドメインを設定するだけでは駄⽬なもの。(例えば、データ修正が必要なものもある) 例: imagesテーブル id url created_at updated_at 1 https://xxx.cloudfront.net/path/to/image1.png 2024-06-03 06:21:53 2024-06-03 06:21:54 2 https://xxx.cloudfront.net/path/to/image2.png 2024-06-11 00:45:02 2024-06-11 00:45:02 3 https://xxx.cloudfront.net/path/to/image3.png 2024-06-12 02:56:21 2024-06-12 02:56:21