- S3の'Static Website Hosting'を有効にする
- 'Edit Redirection Rules'を編集する
- 'bucket policy'を編集する
- CLoudFrontのOriginにS3の'Static Website Hosting'のEndpointを指定する
Last active
February 29, 2020 22:46
-
-
Save pataiji/6a4206af288da466619d to your computer and use it in GitHub Desktop.
S3 + CloudFront で特定のパスへのアクセスをリダイレクトさせる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2008-10-17", | |
"Id": "PolicyForCloudFrontPrivateContent", | |
"Statement": [ | |
{ | |
"Sid": "1", | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::bucket-name/*", | |
"Condition": { | |
"StringEquals": { | |
"aws:UserAgent": "Amazon CloudFront" | |
} | |
} | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<RoutingRules> | |
<RoutingRule> | |
<Condition> | |
<KeyPrefixEquals>source_path/</KeyPrefixEquals> | |
</Condition> | |
<Redirect> | |
<Protocol>https</Protocol> | |
<HostName>redirect domain</HostName> | |
<ReplaceKeyWith>redirect path</ReplaceKeyWith> | |
<HttpRedirectCode>301</HttpRedirectCode> | |
</Redirect> | |
</RoutingRule> | |
</RoutingRules> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment