Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use amazon s3 and cloudfront to host image #96

Open
mylamour opened this issue Apr 14, 2023 · 0 comments
Open

How to use amazon s3 and cloudfront to host image #96

mylamour opened this issue Apr 14, 2023 · 0 comments
Labels
学习 learning 总结 summary 笔记 note

Comments

@mylamour
Copy link
Owner

mylamour commented Apr 14, 2023

  1. create a s3 bucket
  • enable server side encryption
  • setting accees only with cloudfront ( you can do it when cloudfront was created)
{
    "Version": "2008-10-17",
    "Id": "PolicyForCloudFrontPrivateContent",
    "Statement": [
        {
            "Sid": "AllowCloudFrontServicePrincipal",
            "Effect": "Allow",
            "Principal": {
                "Service": "cloudfront.amazonaws.com"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::your bucketname/*",
            "Condition": {
                "StringEquals": {
                    "AWS:SourceArn": "replace with your arn"
                }
            }
        }
    ]
}
  • create folder named images and assets (this step was optional)
  1. create certicate in aws certificate manager
    Screenshot 2023-04-14 at 14 47 35

  2. create cloudfront instance wth s3 backend and domain binding with origin access control

  • please set https only
  1. finally, you saw it worked.
    Screenshot 2023-04-14 at 14 45 57
    Screenshot 2023-04-14 at 14 42 40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
学习 learning 总结 summary 笔记 note
Projects
None yet
Development

No branches or pull requests

1 participant