Skip to content

Commit ca20fce

Browse files
Add new examples for CloudFront (#9556)
1 parent fae41b0 commit ca20fce

25 files changed

+906
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
**To associate a web ACL with a CloudFront distribution tenant**
2+
3+
The following ``associate-distribution-tenant-web-acl`` example associates a web ACL with a CloudFront distribution with ETag ``E13V1IB3VIYABC``. ::
4+
5+
aws cloudfront associate-distribution-tenant-web-acl \
6+
--id dt_2wjDZi3hD1ivOXf6rpZJO1AB \
7+
--if-match E13V1IB3VIYABC \
8+
--web-acl-arn arn:aws:wafv2:us-east-1:123456789012:global/webacl/web-global-example/626900da-5f64-418b-ba9b-743f37123ABC
9+
10+
Output::
11+
12+
{
13+
"ETag": "E1VC38T7YXBABC",
14+
"Id": "dt_2wjDZi3hD1ivOXf6rpZJO1AB",
15+
"WebACLArn": "arn:aws:wafv2:us-east-1:123456789012:global/webacl/web-global-example/626900da-5f64-418b-ba9b-743f37123ABC"
16+
}
17+
18+
For more information, see `Use AWS WAF protections <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-awswaf.html>`__ in the *Amazon CloudFront Developer Guide*.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
**To associate a web ACL with a CloudFront distribution**
2+
3+
The following ``associate-distribution-web-acl`` example associates a web ACL with a CloudFront distribution. ::
4+
5+
aws cloudfront associate-distribution-web-acl \
6+
--id E1XNX8R2GOAABC \
7+
--if-match E2YWS1C2J3OABC \
8+
--web-acl-arn arn:aws:wafv2:us-east-1:123456789012:global/webacl/web-global-example/626900da-5f64-418b-ba9b-743f3746cABC
9+
10+
Output::
11+
12+
{
13+
"ETag": "E3QE7ED60U0ABC",
14+
"Id": "E1XNX8R2GOAABC",
15+
"WebACLArn": "arn:aws:wafv2:us-east-1:123456789012:global/webacl/web-global-example/626900da-5f64-418b-ba9b-743f3746cABC"
16+
}
17+
18+
For more information, see `Use AWS WAF protections <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-awswaf.html>`__ in the *Amazon CloudFront Developer Guide*.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
**To create a connection group in CloudFront**
2+
3+
The following ``create-connection-group`` example creates an enabled connection group, specifies an Anycast static IP list, and disables IPv6. ::
4+
5+
aws cloudfront create-connection-group \
6+
--name cg-with-anycast-ip-list \
7+
--no-ipv6-enabled \
8+
--enabled \
9+
--anycast-ip-list-id aip_CCkW6gKrDiBD4n78123ABC \
10+
--tags "Items=[{Key=abc,Value=123}]"
11+
12+
Output::
13+
14+
{
15+
"ETag": "E23ZP02F085ABC",
16+
"ConnectionGroup": {
17+
"Id": "cg_2yb6uj74B4PCbfhT31WFdiSABC",
18+
"Name": "cg-with-anycast-ip-list",
19+
"Arn": "arn:aws:cloudfront::123456789012:connection-group/cg_2yb6uj74B4PCbfhT31WFdiSABC",
20+
"CreatedTime": "2025-06-16T16:25:50.061000+00:00",
21+
"LastModifiedTime": "2025-06-16T16:25:50.061000+00:00",
22+
"Tags": {
23+
"Items": [
24+
{
25+
"Key": "abc",
26+
"Value": "123"
27+
}
28+
]
29+
},
30+
"Ipv6Enabled": false,
31+
"RoutingEndpoint": "dj6xusxq65abc.cloudfront.net",
32+
"AnycastIpListId": "aip_CCkW6gKrDiBD4n78123ABC",
33+
"Status": "InProgress",
34+
"Enabled": true,
35+
"IsDefault": false
36+
}
37+
}
38+
39+
For more information, see `Create custom connection group (optional) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/custom-connection-group.html>`__ in the *Amazon CloudFront Developer Guide*.
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
**To create a CloudFront distribution tenant**
2+
3+
The following ``create-distribution-tenant`` example creates a CloudFront distribution tenant that specifies customizations to disable WAF, add geo-restrictions, and use another certificate. ::
4+
5+
aws cloudfront create-distribution-tenant \
6+
--cli-input-json file://tenant.json
7+
8+
Contents of ``tenant.json``::
9+
10+
{
11+
"DistributionId": "E1XNX8R2GOAABC",
12+
"Domains": [
13+
{
14+
"Domain": "example.com"
15+
}
16+
],
17+
"Parameters": [
18+
{
19+
"Name": "testParam",
20+
"Value": "defaultValue"
21+
}
22+
],
23+
"ConnectionGroupId": "cg_2whCJoXMYCjHcxaLGrkllvyABC",
24+
"Enabled": false,
25+
"Tags": {
26+
"Items": [
27+
{
28+
"Key": "tag",
29+
"Value": "tagValue"
30+
}
31+
]
32+
},
33+
"Name": "new-tenant-customizations",
34+
"Customizations": {
35+
"GeoRestrictions": {
36+
"Locations": ["DE"],
37+
"RestrictionType": "whitelist"
38+
},
39+
"WebAcl": {
40+
"Action": "disable"
41+
},
42+
"Certificate": {
43+
"Arn": "arn:aws:acm:us-east-1:123456789012:certificate/ec53f564-ea5a-4e4a-a0a2-e3c989449abc"
44+
}
45+
}
46+
}
47+
48+
Output::
49+
50+
{
51+
"ETag": "E23ZP02F085ABC",
52+
"DistributionTenant": {
53+
"Id": "dt_2yN5tYwVbPKr7m2IB69M1yp1AB",
54+
"DistributionId": "E1XNX8R2GOAABC",
55+
"Name": "new-tenant-customizations",
56+
"Arn": "arn:aws:cloudfront::123456789012:distribution-tenant/dt_2yN5tYwVbPKr7m2IB69M1yp1AB",
57+
"Domains": [
58+
{
59+
"Domain": "example.com",
60+
"Status": "active"
61+
}
62+
],
63+
"Tags": {
64+
"Items": [
65+
{
66+
"Key": "tag",
67+
"Value": "tagValue"
68+
}
69+
]
70+
},
71+
"Customizations": {
72+
"WebAcl": {
73+
"Action": "disable"
74+
},
75+
"Certificate": {
76+
"Arn": "arn:aws:acm:us-east-1:123456789012:certificate/ec53f564-ea5a-4e4a-a0a2-e3c989449abc"
77+
},
78+
"GeoRestrictions": {
79+
"RestrictionType": "whitelist",
80+
"Locations": [
81+
"DE"
82+
]
83+
}
84+
},
85+
"Parameters": [
86+
{
87+
"Name": "testParam",
88+
"Value": "defaultValue"
89+
}
90+
],
91+
"ConnectionGroupId": "cg_2whCJoXMYCjHcxaLGrkllvyABC",
92+
"CreatedTime": "2025-06-11T17:20:06.432000+00:00",
93+
"LastModifiedTime": "2025-06-11T17:20:06.432000+00:00",
94+
"Enabled": false,
95+
"Status": "InProgress"
96+
}
97+
}
98+
99+
For more information, see `Create a distribution <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-creating-console.html>`__ in the *Amazon CloudFront Developer Guide*.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
**To create a CloudFront invalidation for a distribution tenant**
2+
3+
The following ``create-invalidation-for-distribution-tenant`` example creates an invalidation for all files in a CloudFront distribution tenant. ::
4+
5+
aws cloudfront create-invalidation-for-distribution-tenant \
6+
--id dt_2wjDZi3hD1ivOXf6rpZJO1AB \
7+
--invalidation-batch '{"Paths": {"Quantity": 1, "Items": ["/*"]}, "CallerReference": "invalidation-$(date +%s)"}'
8+
9+
Output::
10+
11+
{
12+
"Location": "https://cloudfront.amazonaws.com/2020-05-31/distribution-tenant/dt_2wjDZi3hD1ivOXf6rpZJO1AB/invalidation/I2JGL2F1ZAA426PGG0YLLKABC",
13+
"Invalidation": {
14+
"Id": "I2JGL2F1ZAA426PGG0YLLKABC",
15+
"Status": "InProgress",
16+
"CreateTime": "2025-05-07T16:59:25.947000+00:00",
17+
"InvalidationBatch": {
18+
"Paths": {
19+
"Quantity": 1,
20+
"Items": [
21+
"/*"
22+
]
23+
},
24+
"CallerReference": "invalidation-$(date +%s)"
25+
}
26+
}
27+
}
28+
29+
For more information, see `Invalidate files to remove content <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html>`__ in the *Amazon CloudFront Developer Guide*.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
**To delete a connection group**
2+
3+
The following ``delete-connection-group`` example deletes a connection group. The connection group must be disabled and can't be associated with any CloudFront resources. ::
4+
5+
aws cloudfront delete-connection-group \
6+
--id cg_2wjLpjbHkLUdhWAjHllcOeABC \
7+
--if-match ETVPDKIKX0DABC
8+
9+
When successful, this command has no output.
10+
11+
For more information about managing connection groups, see `Create custom connection group (optional) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/custom-connection-group.html>`__ in the *Amazon CloudFront Developer Guide*.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
**To delete a distribution tenant**
2+
3+
The following ``delete-distribution-tenant`` example deletes a distribution tenant with ETag ``ETVPDKIKX0DABC``. The distribution tenant must be disabled and can't be associated with any CloudFront resources. ::
4+
5+
aws cloudfront delete-distribution-tenant \
6+
--id dt_2wjMUbg3NHZEQ7OfoalP5zi1AB \
7+
--if-match ETVPDKIKX0DABC
8+
9+
When successful, this command has no output.
10+
11+
For more information, see `Delete a distribution <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/HowToDeleteDistribution.html>`__ in the *Amazon CloudFront Developer Guide*.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
**To disassociate a web ACL from a distribution tenant**
2+
3+
The following ``disassociate-distribution-tenant-web-acl`` example disassociates a web ACL from a distribution tenant with ETag ``E1PA6795UKMABC``. ::
4+
5+
aws cloudfront disassociate-distribution-tenant-web-acl \
6+
--id dt_2wjDZi3hD1ivOXf6rpZJOSNE1AB \
7+
--if-match E1PA6795UKMABC
8+
9+
Output::
10+
11+
{
12+
"ETag": "E13V1IB3VIYABC",
13+
"Id": "dt_2wjDZi3hD1ivOXf6rpZJOSNE1AB"
14+
}
15+
16+
For more information, see `Disable AWS WAF security protections <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/disable-waf.html>`__ in the *Amazon CloudFront Developer Guide*.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
**To disassociate a web ACL from a CloudFront distribution**
2+
3+
The following ``disassociate-distribution-web-acl`` example removes the association between a web ACL and a CloudFront distribution with ETag ``E13V1IB3VIYABC``. ::
4+
5+
aws cloudfront disassociate-distribution-web-acl \
6+
--id E1XNX8R2GOAABC \
7+
--if-match EEZQ9Z24VM1ABC
8+
9+
Output::
10+
11+
{
12+
"ETag": "E2YWS1C2J3OABC",
13+
"Id": "E1XNX8R2GOAABC"
14+
}
15+
16+
For more information, see `Disable AWS WAF security protections <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/disable-waf.html>`__ in the *Amazon CloudFront Developer Guide*.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
**To get a connection group by routing endpoint**
2+
3+
The following ``get-connection-group-by-routing-endpoint`` example retrieves information about a connection group using its routing endpoint. ::
4+
5+
aws cloudfront get-connection-group-by-routing-endpoint \
6+
--routing-endpoint dvdg9gprgabc.cloudfront.net
7+
8+
Output::
9+
10+
{
11+
"ETag": "E23ZP02F085ABC",
12+
"ConnectionGroup": {
13+
"Id": "cg_2wjDWTBKTlRB87cAaUQFaakABC",
14+
"Name": "connection-group-2",
15+
"Arn": "arn:aws:cloudfront::123456789012:connection-group/cg_2wjDWTBKTlRB87cAaUQFaakABC",
16+
"CreatedTime": "2025-05-06T15:42:00.790000+00:00",
17+
"LastModifiedTime": "2025-05-06T15:42:00.790000+00:00",
18+
"Ipv6Enabled": true,
19+
"RoutingEndpoint": "dvdg9gprgabc.cloudfront.net",
20+
"Status": "Deployed",
21+
"Enabled": true,
22+
"IsDefault": false
23+
}
24+
}
25+
26+
For more information, see `Create custom connection group (optional) <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/custom-connection-group.html>`__ in the *Amazon CloudFront Developer Guide*.

0 commit comments

Comments
 (0)