Skip to content

Commit

Permalink
CLI examples cloudfront, cognito-idp, ec2, ecr-public, ecs, inspector…
Browse files Browse the repository at this point in the history
…2, ivs-realtime, s3api, workmail:
  • Loading branch information
elysahall committed Oct 29, 2024
1 parent ca2b93c commit f43d366
Show file tree
Hide file tree
Showing 58 changed files with 2,163 additions and 763 deletions.
236 changes: 118 additions & 118 deletions awscli/examples/cloudfront/create-distribution.rst
Original file line number Diff line number Diff line change
@@ -1,123 +1,12 @@
**To create a CloudFront distribution**
**Example 1: To create a CloudFront distribution**

The following example creates a distribution for an S3 bucket named
``awsexamplebucket``, and also specifies ``index.html`` as the default root
object, using command line arguments::
The following example creates a distribution for an S3 bucket named ``amzn-s3-demo-bucket``, and also specifies ``index.html`` as the default root object, using command line arguments. ::

aws cloudfront create-distribution \
--origin-domain-name awsexamplebucket.s3.amazonaws.com \
--origin-domain-name amzn-s3-demo-bucket.s3.amazonaws.com \
--default-root-object index.html

Instead of using command line arguments, you can provide the distribution
configuration in a JSON file, as shown in the following example::

aws cloudfront create-distribution \
--distribution-config file://dist-config.json

The file ``dist-config.json`` is a JSON document in the current folder that
contains the following::

{
"CallerReference": "cli-example",
"Aliases": {
"Quantity": 0
},
"DefaultRootObject": "index.html",
"Origins": {
"Quantity": 1,
"Items": [
{
"Id": "awsexamplebucket.s3.amazonaws.com-cli-example",
"DomainName": "awsexamplebucket.s3.amazonaws.com",
"OriginPath": "",
"CustomHeaders": {
"Quantity": 0
},
"S3OriginConfig": {
"OriginAccessIdentity": ""
}
}
]
},
"OriginGroups": {
"Quantity": 0
},
"DefaultCacheBehavior": {
"TargetOriginId": "awsexamplebucket.s3.amazonaws.com-cli-example",
"ForwardedValues": {
"QueryString": false,
"Cookies": {
"Forward": "none"
},
"Headers": {
"Quantity": 0
},
"QueryStringCacheKeys": {
"Quantity": 0
}
},
"TrustedSigners": {
"Enabled": false,
"Quantity": 0
},
"ViewerProtocolPolicy": "allow-all",
"MinTTL": 0,
"AllowedMethods": {
"Quantity": 2,
"Items": [
"HEAD",
"GET"
],
"CachedMethods": {
"Quantity": 2,
"Items": [
"HEAD",
"GET"
]
}
},
"SmoothStreaming": false,
"DefaultTTL": 86400,
"MaxTTL": 31536000,
"Compress": false,
"LambdaFunctionAssociations": {
"Quantity": 0
},
"FieldLevelEncryptionId": ""
},
"CacheBehaviors": {
"Quantity": 0
},
"CustomErrorResponses": {
"Quantity": 0
},
"Comment": "",
"Logging": {
"Enabled": false,
"IncludeCookies": false,
"Bucket": "",
"Prefix": ""
},
"PriceClass": "PriceClass_All",
"Enabled": true,
"ViewerCertificate": {
"CloudFrontDefaultCertificate": true,
"MinimumProtocolVersion": "TLSv1",
"CertificateSource": "cloudfront"
},
"Restrictions": {
"GeoRestriction": {
"RestrictionType": "none",
"Quantity": 0
}
},
"WebACLId": "",
"HttpVersion": "http2",
"IsIPV6Enabled": true
}

Whether you provide the distribution information with a command line argument
or a JSON file, the output is the same::
Output::

{
"Location": "https://cloudfront.amazonaws.com/2019-03-26/distribution/EMLARXS9EXAMPLE",
Expand All @@ -143,8 +32,8 @@ or a JSON file, the output is the same::
"Quantity": 1,
"Items": [
{
"Id": "awsexamplebucket.s3.amazonaws.com-cli-example",
"DomainName": "awsexamplebucket.s3.amazonaws.com",
"Id": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example",
"DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com",
"OriginPath": "",
"CustomHeaders": {
"Quantity": 0
Expand All @@ -159,7 +48,7 @@ or a JSON file, the output is the same::
"Quantity": 0
},
"DefaultCacheBehavior": {
"TargetOriginId": "awsexamplebucket.s3.amazonaws.com-cli-example",
"TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example",
"ForwardedValues": {
"QueryString": false,
"Cookies": {
Expand Down Expand Up @@ -233,3 +122,114 @@ or a JSON file, the output is the same::
}
}
}

**Example 2: To create a CloudFront distribution using a JSON file**

The following example creates a distribution for an S3 bucket named ``amzn-s3-demo-bucket``, and also specifies ``index.html`` as the default root object, using a JSON file. ::

aws cloudfront create-distribution \
--distribution-config file://dist-config.json


Contents of ``dist-config.json``::

{
"CallerReference": "cli-example",
"Aliases": {
"Quantity": 0
},
"DefaultRootObject": "index.html",
"Origins": {
"Quantity": 1,
"Items": [
{
"Id": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example",
"DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com",
"OriginPath": "",
"CustomHeaders": {
"Quantity": 0
},
"S3OriginConfig": {
"OriginAccessIdentity": ""
}
}
]
},
"OriginGroups": {
"Quantity": 0
},
"DefaultCacheBehavior": {
"TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example",
"ForwardedValues": {
"QueryString": false,
"Cookies": {
"Forward": "none"
},
"Headers": {
"Quantity": 0
},
"QueryStringCacheKeys": {
"Quantity": 0
}
},
"TrustedSigners": {
"Enabled": false,
"Quantity": 0
},
"ViewerProtocolPolicy": "allow-all",
"MinTTL": 0,
"AllowedMethods": {
"Quantity": 2,
"Items": [
"HEAD",
"GET"
],
"CachedMethods": {
"Quantity": 2,
"Items": [
"HEAD",
"GET"
]
}
},
"SmoothStreaming": false,
"DefaultTTL": 86400,
"MaxTTL": 31536000,
"Compress": false,
"LambdaFunctionAssociations": {
"Quantity": 0
},
"FieldLevelEncryptionId": ""
},
"CacheBehaviors": {
"Quantity": 0
},
"CustomErrorResponses": {
"Quantity": 0
},
"Comment": "",
"Logging": {
"Enabled": false,
"IncludeCookies": false,
"Bucket": "",
"Prefix": ""
},
"PriceClass": "PriceClass_All",
"Enabled": true,
"ViewerCertificate": {
"CloudFrontDefaultCertificate": true,
"MinimumProtocolVersion": "TLSv1",
"CertificateSource": "cloudfront"
},
"Restrictions": {
"GeoRestriction": {
"RestrictionType": "none",
"Quantity": 0
}
},
"WebACLId": "",
"HttpVersion": "http2",
"IsIPV6Enabled": true
}

See Example 1 for sample output.
16 changes: 6 additions & 10 deletions awscli/examples/cloudfront/get-distribution-config.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
**To get a CloudFront distribution configuration**

The following example gets metadata about the CloudFront distribution with the
ID ``EDFDVBD6EXAMPLE``, including its ``ETag``. The distribution ID is returned
in the `create-distribution <create-distribution.html>`_ and
`list-distributions <list-distributions.html>`_ commands.
The following example gets metadata about the CloudFront distribution with the ID ``EDFDVBD6EXAMPLE``, including its ``ETag``. The distribution ID is returned in the `create-distribution <create-distribution.html>`__ and `list-distributions <list-distributions.html>`__ commands. ::

::

aws cloudfront get-distribution-config --id EDFDVBD6EXAMPLE
aws cloudfront get-distribution-config \
--id EDFDVBD6EXAMPLE

Output::

Expand All @@ -23,8 +19,8 @@ Output::
"Quantity": 1,
"Items": [
{
"Id": "awsexamplebucket.s3.amazonaws.com-cli-example",
"DomainName": "awsexamplebucket.s3.amazonaws.com",
"Id": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example",
"DomainName": "amzn-s3-demo-bucket.s3.amazonaws.com",
"OriginPath": "",
"CustomHeaders": {
"Quantity": 0
Expand All @@ -39,7 +35,7 @@ Output::
"Quantity": 0
},
"DefaultCacheBehavior": {
"TargetOriginId": "awsexamplebucket.s3.amazonaws.com-cli-example",
"TargetOriginId": "amzn-s3-demo-bucket.s3.amazonaws.com-cli-example",
"ForwardedValues": {
"QueryString": false,
"Cookies": {
Expand Down
Loading

0 comments on commit f43d366

Please sign in to comment.