AWS CLI commands

I will be creating the bucket in the ap-south-1 region; you may choose any region of your choice:

  1. Create a bucket, qnatime.com, for the primary domain.
  2. Create an index document, index.html, and an error document, error.html, for the S3 website.
  3. Upload the index and error documents.
  4. Create a website configuration JSON file, specifying the index and error filenames.
  5. Create a static website, specifying the website configuration JSON file.
  6. Create a bucket policy, with read permission for everyone, for the bucket qnatime.com.
  7. Create an S3 bucket with the name www.qnatime.com.
  8. Configure the bucket as a website by using the aws s3aoi put-bucket-website command, with a configuration JSON file for redirection, as follows:
{
"RedirectAllRequestsTo": {
"HostName": "qnatime.com",
"Protocol": "http"
}
}
  1. Create the change-resource-record-sets JSON file for creating alias records for the naked domain (qnatime.com) and the WWW sub-domain (www.qnatime.com).

The changes for the naked domain are as follows:

{
"Comment": "change batch request for qnatime",
"Changes": [
{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "qnatime.com",
"Type": "A",
"AliasTarget": {
"HostedZoneId": "Z11RGJOFQNVJUP",
"DNSName": "s3-website.ap-south-1.amazonaws.com",
"EvaluateTargetHealth": false
}
}
},
...

The DNS name and the hosted zone ID are available at https://docs.aws.amazon.com/general/latest/gr/rande.html

The second part (to be added instead of the ... in the preceding snippet) is similar to the first, but with the name as www.qnatime.com.  

This should return the following response:

  1. You can check the status by using the aws route53 get-change command:
aws route53 get-change 
--id /change/C1KSXLKZ4DWPPW
--profile admin

If it is successful, this should provide the following response:

You can also use the AWS Management Console to verify that two new alias records were created in the HostedZone for this domain.

  1. Go to the domain names from the browser.

You should get a response from our bucket, as follows:

 

Executing the sub-domain www.qnatime.com should redirect you to the naked domain (qnatime.com), and the final response should look the same as in the previous step. 

..................Content has been hidden....................

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