Skip to content

Commit 585ed68

Browse files
committed
revamp cloudfront
1 parent 39fdb51 commit 585ed68

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

src/content/docs/aws/services/cloudfront.md

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
title: "CloudFront"
3-
linkTitle: "CloudFront"
43
description: Get started with CloudFront on LocalStack
54
tags: ["Base"]
65
persistence: supported
@@ -13,7 +12,7 @@ CloudFront distributes its web content, videos, applications, and APIs with low
1312
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.
1413

1514
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.
1716

1817
## Getting started
1918

@@ -25,46 +24,48 @@ We will demonstrate how you can create an S3 bucket, put a text file named `hell
2524

2625
To get started, create an S3 bucket using the `mb` command:
2726

28-
{{< command >}}
29-
$ awslocal s3 mb s3://abc123
30-
{{< / command >}}
27+
```bash
28+
awslocal s3 mb s3://abc123
29+
```
3130

3231
You can now go ahead, create a new text file named `hello.txt` and upload it to the bucket:
3332

34-
{{< command >}}
35-
$ echo 'Hello World' > /tmp/hello.txt
36-
$ awslocal s3 cp /tmp/hello.txt s3://abc123/hello.txt --acl public-read
37-
{{< / command >}}
33+
```bash
34+
echo 'Hello World' > /tmp/hello.txt
35+
awslocal s3 cp /tmp/hello.txt s3://abc123/hello.txt --acl public-read
36+
```
3837

3938
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.
4039
Run the following command to create a distribution with the default settings:
4140

42-
{{< command >}}
43-
$ domain=$(awslocal cloudfront create-distribution \
41+
```bash
42+
domain=$(awslocal cloudfront create-distribution \
4443
--origin-domain-name abc123.s3.amazonaws.com | jq -r '.Distribution.DomainName')
45-
$ curl -k https://$domain/hello.txt
46-
{{< / command >}}
44+
curl -k https://$domain/hello.txt
45+
```
4746

48-
{{< callout "tip" >}}
47+
:::note
4948
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+
:::
5251

5352
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+
5454
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.
5555
Typically, after a few retries, the command should succeed.
56+
5657
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.
5758

5859
## Lambda@Edge
5960

60-
{{< callout "note">}}
61+
:::note
6162
We’re introducing an early, incomplete, and experimental feature that emulates AWS CloudFront Lambda@Edge, starting with version 4.3.0.
6263

6364
It enables running Lambda functions at simulated edge locations.
6465
This allows you to locally test and develop request/response modifications, security enhancements and more.
6566

6667
This feature is still under development, and functionality is limited.
67-
{{< /callout >}}
68+
:::
6869

6970
You can enable this feature by setting `CLOUDFRONT_LAMBDA_EDGE=1` in your LocalStack configuration.
7071

@@ -77,7 +78,7 @@ You can enable this feature by setting `CLOUDFRONT_LAMBDA_EDGE=1` in your LocalS
7778

7879
### Current limitations
7980

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.
8182
- The `origin-request` and `origin-response` event types currently trigger for each request because caching is not implemented in CloudFront.
8283

8384
## Using custom URLs
@@ -92,18 +93,16 @@ The format of this structure is similar to the one used in [AWS CloudFront optio
9293
In the given example, two domains are specified as `Aliases` for a distribution.
9394
Please note that a complete configuration would entail additional values relevant to the distribution, which have been omitted here for brevity.
9495

95-
{{< command >}}
96+
```bash
9697
--distribution-config {...'Aliases':'{'Quantity':2, 'Items': ['custom.domain.one', 'customDomain.two']}'...}
97-
{{< / command >}}
98+
```
9899

99100
## Resource Browser
100101

101102
The LocalStack Web Application provides a Resource Browser for CloudFront, which allows you to view and manage your CloudFront distributions.
102103
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.
103104

104-
<img src="cloudfront-resource-browser.png" alt="CloudFront Resource Browser" title="CloudFront Resource Browser" width="900" />
105-
<br>
106-
<br>
105+
![CloudFront Resource Browser](/images/aws/cloudfront-resource-browser.png)
107106

108107
The Resource Browser allows you to perform the following actions:
109108

0 commit comments

Comments
 (0)