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: src/content/docs/aws/services/cloudfront.md
+23-24Lines changed: 23 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,5 @@
1
1
---
2
2
title: "CloudFront"
3
-
linkTitle: "CloudFront"
4
3
description: Get started with CloudFront on LocalStack
5
4
tags: ["Base"]
6
5
persistence: supported
@@ -13,7 +12,7 @@ CloudFront distributes its web content, videos, applications, and APIs with low
13
12
CloudFront APIs allow you to configure distributions, customize cache behavior, secure content with access controls, and monitor the CDN's performance through real-time metrics.
14
13
15
14
LocalStack allows you to use the CloudFront APIs in your local environment to create local CloudFront distributions to transparently access your applications and file artifacts.
16
-
The supported APIs are available on our [API coverage page]({{< ref "coverage_cloudfront" >}}), which provides information on the extent of CloudFront's integration with LocalStack.
15
+
The supported APIs are available on our [API coverage page](), which provides information on the extent of CloudFront's integration with LocalStack.
17
16
18
17
## Getting started
19
18
@@ -25,46 +24,48 @@ We will demonstrate how you can create an S3 bucket, put a text file named `hell
25
24
26
25
To get started, create an S3 bucket using the `mb` command:
27
26
28
-
{{< command >}}
29
-
$ awslocal s3 mb s3://abc123
30
-
{{< / command >}}
27
+
```bash
28
+
awslocal s3 mb s3://abc123
29
+
```
31
30
32
31
You can now go ahead, create a new text file named `hello.txt` and upload it to the bucket:
After uploading the file to S3, you can create a CloudFront distribution using the [`CreateDistribution`](https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_CreateDistribution.html) API call.
40
39
Run the following command to create a distribution with the default settings:
If you wish to use CloudFront on system host, ensure your local DNS setup is correctly configured.
50
-
Refer to the section on [System DNS configuration]({{< ref "dns-server#system-dns-configuration" >}}) for details.
51
-
{{< /callout >}}
49
+
Refer to the section on [System DNS configuration](/aws/tooling/dns-server#system-dns-configuration) for details.
50
+
:::
52
51
53
52
In the example provided above, be aware that the final command (`curl https://$domain/hello.txt`) might encounter a temporary failure accompanied by a warning message `Could not resolve host`.
53
+
54
54
This can occur because different operating systems adopt diverse DNS caching strategies, causing a delay in the availability of the CloudFront distribution's DNS name (e.g., `abc123.cloudfront.net`) within the system.
55
55
Typically, after a few retries, the command should succeed.
56
+
56
57
It's worth noting that similar behavior can be observed in the actual AWS environment, where CloudFront DNS names may take up to 10-15 minutes to propagate across the network.
57
58
58
59
## Lambda@Edge
59
60
60
-
{{< callout "note">}}
61
+
:::note
61
62
We’re introducing an early, incomplete, and experimental feature that emulates AWS CloudFront Lambda@Edge, starting with version 4.3.0.
62
63
63
64
It enables running Lambda functions at simulated edge locations.
64
65
This allows you to locally test and develop request/response modifications, security enhancements and more.
65
66
66
67
This feature is still under development, and functionality is limited.
67
-
{{< /callout >}}
68
+
:::
68
69
69
70
You can enable this feature by setting `CLOUDFRONT_LAMBDA_EDGE=1` in your LocalStack configuration.
70
71
@@ -77,7 +78,7 @@ You can enable this feature by setting `CLOUDFRONT_LAMBDA_EDGE=1` in your LocalS
77
78
78
79
### Current limitations
79
80
80
-
- The [`UpdateDistribution`](https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_UpdateDistribution.html), [`DeleteDistribution`](https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_DeleteDistribution.html), and [`Persistence Restore`]({{< ref "persistence" >}}) features are not yet supported for Lambda@Edge.
81
+
- The [`UpdateDistribution`](https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_UpdateDistribution.html), [`DeleteDistribution`](https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_DeleteDistribution.html), and [Persistence Restore](/aws/capabilities/state-management/persistence) features are not yet supported for Lambda@Edge.
81
82
- The `origin-request` and `origin-response` event types currently trigger for each request because caching is not implemented in CloudFront.
82
83
83
84
## Using custom URLs
@@ -92,18 +93,16 @@ The format of this structure is similar to the one used in [AWS CloudFront optio
92
93
In the given example, two domains are specified as `Aliases` for a distribution.
93
94
Please note that a complete configuration would entail additional values relevant to the distribution, which have been omitted here for brevity.
The LocalStack Web Application provides a Resource Browser for CloudFront, which allows you to view and manage your CloudFront distributions.
102
103
You can access the Resource Browser by opening the LocalStack Web Application in your browser, navigating to the **Resource Browser** section, and then clicking on **CloudFront** under the **Analytics** section.
0 commit comments