AWS CLI commands

You can create a CloudFront distribution with the AWS CLI by either passing a distribution config, or by specifying the original domain name (for example, an S3 bucket name). In this recipe, we will use the shorter option:

  1. Create the CloudFront distribution by using the create-distribution command with aws cloudfront:
aws cloudfront create-distribution 
--origin-domain-name qnatime.s3.amazonaws.com
--default-root-object index.html
--profile admin

This command will immediately return the ID of the distribution and the defaults that are considered:

The Etag in the response from the CloudFront command is needed to make further commands, such as update or delete requests, from the CLI. The response also contains the DistributionConfig property, which contains all of the properties related to the distribution. This should take some time to complete.

  1. Check the status by using the aws cloudfront get-distribution command:
aws cloudfront get-distribution 
--id E1ZX6JAV6EDQVO
--profile admin

If it is successful, the status will change to Deployed in the response:

The remainder of the response is similar to the previous one. The DistributionConfig property within the response will be discussed in detail later on.

  1. Execute the CloudFront domain URL in a browser, as shown in the following screenshot:
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.29.119