Setup S3, SSL certificate and CloudFront distribution ----------------------------------------------------- https://youtu.be/5uS_rQjQ4Hw ## 1. Create a bucket A. Select: Static Website hosting (https://docs.aws.amazon.com/AmazonS3/latest/dev/EnableWebsiteHosting.html) B. Note the URL at the top of that setting (your-domain.net.s3-website.eu-west-2.amazonaws.com) C. Set Permissions using JSON (https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteAccessPermissionsReqd.html) ```json { "Version":"2012-10-17", "Statement":[{ "Sid":"PublicReadGetObject", "Effect":"Allow", "Principal": "*", "Action":["s3:GetObject"], "Resource":["arn:aws:s3:::example-bucket/*" ] } ] } ``` Note: `example-bucket` should be replaced with your bucket name. ## 2. Request certificate A. Note: Region must be `N Virginia` to be able to import later B. Add both domains in the request `*.your-domain.net` and `your-domain.net` ## 3. CloudFront distributiopn setup Important: The Origin must match the S3 bucket Web site URL (1.B. above) A. Edit the CloudFront Distribution - Set Alternate Domains as `www.your-domain.net, your-domain.net` - Select: Custom SSL Certificate and pick corresponding from the drop down below B. Edit Origins settings - Set Origin Domain Name to the static Website URL hosting setting in S3 (see 1.B. above) ## 4. Route 53 setup A. Create a Record with the following: - Name: `www.your-domain.net`, - Type: `A - IPv4 address`, - Alias: `Yes`, - Target: `.cloudfront.net`, - Routing policy: `Simple` B. Create a Record with the following: - name: `your-domain.net`, - Type: `CNAME`, - Alias: `No`, TTL: `300`[default], - Value: `.cloudfront.net`, - Routing policy: `Simple` NOTE: Step 4.B. did not work due to existing SOA record with `your-domain.net`. For that an Alias type record was created simillar to 4.A.