You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-15Lines changed: 16 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ Use this solution to create a secure static website for your registered domain n
5
5
- Is hosted on [Amazon S3](https://aws.amazon.com/s3/)
6
6
- Is distributed by [Amazon CloudFront](https://aws.amazon.com/cloudfront/)
7
7
- Uses an SSL/TLS certificate from [AWS Certificate Manager (ACM)](https://aws.amazon.com/certificate-manager/)
8
-
- Uses [Lambda@Edge](https://aws.amazon.com/lambda/edge/) to add security headers to every server response
8
+
- Uses [CloudFront Response Header Policies](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/adding-response-headers.html) to add security headers to every server response
9
9
- Is deployed with [AWS CloudFormation](https://aws.amazon.com/cloudformation/)
10
10
11
11
For more information about each of these components, see the **Solution details** section on this page.
@@ -14,30 +14,31 @@ For more information about each of these components, see the **Solution details*
14
14
15
15
The following diagram shows an overview of how the solution works:
1. The viewer requests the website at www.example.com.
20
20
2. If the requested object is cached, CloudFront returns the object from its cache to the viewer.
21
21
3. If the object is not in CloudFront’s cache, CloudFront requests the object from the origin (an S3 bucket).
22
-
4. S3 returns the object to CloudFront, which triggers the Lambda@Edge origin response event.
23
-
5. The object, including the security headers added by the Lambda@Edge function, is added to CloudFront’s cache.
24
-
6. (Not shown) The objects is returned to the viewer. Subsequent responses for the object are served from the CloudFront cache.
22
+
4. S3 returns the object to CloudFront
23
+
5. CloudFront caches the object.
24
+
6. The object is returned to the viewer. Subsequent responses for the object are served from the CloudFront cache.
25
+
25
26
26
27
## Solution details
27
28
28
29
### S3 configuration
29
30
This solution creates an S3 bucket that hosts your static website’s assets. The website is only accessible via CloudFront, not directly from S3.
30
31
31
32
### CloudFront configuration
32
-
This solution creates a CloudFront distribution to serve your website to viewers. The distribution is configured with a CloudFront [origin access identity](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html) to make sure that the website is only accessible via CloudFront, not directly from S3. The distribution is also configured with a [Lambda@Edge function](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-at-the-edge.html) that adds security headers to every response.
33
+
This solution creates a CloudFront distribution to serve your website to viewers. The distribution is configured with a CloudFront [origin access identity](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html) to make sure that the website is only accessible via CloudFront, not directly from S3. The distribution is also configured with a [CloudFront Response Header Policy](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/adding-response-headers.html) that adds security headers to every response.
33
34
34
35
### ACM configuration
35
36
This solution creates an SSL/TLS certificate in ACM, and attaches it to the CloudFront distribution. This enables the distribution to serve your domain’s website using HTTPS.
36
37
37
-
### Lambda@Edge configuration
38
-
This solution creates a Lambda@Edge function that’s triggered on an [origin response event](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-cloudfront-trigger-events.html). The function adds security headers to every response served by CloudFront.
38
+
### CloudFront Response Header Policy
39
+
The CloudFront Response Header Policy adds security headers to every response served by CloudFront.
39
40
40
-
The security headers can help mitigate some attacks, as explained in this blog post: [Adding HTTP Security Headers Using Lambda@Edge and Amazon CloudFront](https://aws.amazon.com/blogs/networking-and-content-delivery/adding-http-security-headers-using-lambdaedge-and-amazon-cloudfront/). Security headers are a group of headers in the web server response that tell web browsers to take extra security precautions. This solution adds the following headers to each response:
41
+
The security headers can help mitigate some attacks, as explained in the [Amazon CloudFront - Understanding response header policies documentation](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/understanding-response-headers-policies.html#understanding-response-headers-policies-security). Security headers are a group of headers in the web server response that tell web browsers to take extra security precautions. This solution adds the following headers to each response:
@@ -70,7 +71,7 @@ To deploy the solution, you use [AWS CloudFormation](https://aws.amazon.com/clou
70
71
following fields:
71
72
72
73
-**SubDomain:** The subdomain for your registered domain name. Viewers use the subdomain to access your website, for example: www.example.com. We recommend using the default value of **www** as the subdomain.
73
-
-**DomainName:** Your registered domain name, such as example.com. This domain must be pointed to a Route 53 hosted zone.
74
+
-**DomainName:** Your registered domain name, such as example.com. This domain must be pointed to a Route 53 hosted zone.
74
75
-**CreateApex:** Optionally create an Alias to the domain apex (example.com) in your CloudFront configuration. Default is [no]
75
76
76
77
After entering values, choose the **Next** button.
0 commit comments