0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

S3 + CloudFrontでびっくりするぐらい詰まった話

0
Last updated at Posted at 2024-06-05

やりたいこと

  1. 静的サイトの公開
  2. S3URLからのアクセス拒否⇒ClaudFrontを通過しないアクセスは拒否する
  3. privateフォルダの作成と認証をつける

何が起こったか

手順としては、主に次の流れで行いました

  1. S3の新規作成
    1. 静的ホスティングに必要な設定を行う
    2. S3URLでアクセスが可能か確認
  2. CloudFrontとS3の連携
    1. 静的ホスティングURLを利用して連携を行う
    2. ポリシーの設定
    3. S3からのアクセスが403になることを確認
    4. ClaudFrontからのアクセスが通ることを確認⇦ 403でアクセスが拒否される

原因

ClaudFrontでアクセス制御を行う場合は、そもそも静的ホスティングを行わないようだ。

最終的に、こちらの記事を参考にした。

注意点

ACLは無効

Block Public Accessはすべて有効

まとめ

S3で公開する場合は静的ホスティング設定が必須と勘違いしていたため、時間がかかってしまった。
この備忘録がどなたかの助けになれば幸いです。

追記

あるあるではあるが、方法が分かった瞬間詳細な説明の記事が見つかったため備忘録として残しておく

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?