AWS CloudFront distributions Creation

From Apoyar Wiki
Revision as of 06:26, 16 April 2021 by Admin (talk | contribs) (Created page with "Amazon Web Service CloudFront distributions creation procedure: Login into aws account and create IAM user with administrator permission. Copy Access key & secrete key ids...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Amazon Web Service CloudFront distributions creation procedure:

Login into aws account and create IAM user with administrator permission.

Copy Access key & secrete key ids.

We will use to work aws cli commands on phobos.apoyar server

Firstly, install awscli packages.

# apt-get install awscli

Configure aws GUI details to cli

  1. aws configure

Access key ID

Secrete key ID

Region

Text


II. To list out the existing CloudFront distribution names execute below command.


# aws cloudfront list-distributions --query 'DistributionList.Items[*].[Comment,Id,DomainName,Status]' 


III. Existing cloudfront distribution settings exported to one json file with all required configurations using below command.


# aws cloudfront get-distribution-config --id E22YPQLVV7ZL08 > distribution.json 


IV. To generate preshared key use below command which need to add in above distribution.json

  1. openssl rand -base64 32


Once key generated copy and keep somewhere which can be used later


And open file and delete etag and change dns name as per your requirement


vi distribution.json

Delete etag

"CallerReference": "new”

Replace url

Replace comment

And esc:wq! Save file


V. To create new cloudfront distribution from exported json file again login into new aws account and create IAM user with temporary administrator permissions and install awscli package and configure it with access & secrete key id.

  1. apt-get install awscli
  1. aws configure [new account]
  1. aws cloudfront create-distribution --cli-input-json file://distribution.json


Finally, you can list out newly created CloudFront distribution on CloudFront dashboard.