Create clone of CloudFront distribution using AWS CLI

Revision as of 06:13, 17 June 2024 by Admin (talk | contribs)

Connect to ZEB LB (lb.zeb.apoyar) or any ZEB server where we have CLI access to AWS


And below two commands one by one at /home/neal/


---> aws cloudfront get-distribution-config --id E2KCQM43EXPGWB --output json > sourceCFconfig.json (In this, we have to edit the ID, from which we need to create clone)


---> cp sourceCFconfig.json newCFconfig.json


Then we need to open & edit the newCFconfig.json file


---> vi newCFconfig.json


edit out the first parent element (2nd and 3rd line) and don't forget to delete the 2nd last curly bracket


Edit the Aliases (new info)


Change the origin (if you are using a different one), example - cdn.zeb.be


Change the comment (CloudFront Distribution Name)


Change Caller Reference to something else (timestamp is OK) --> its nothing but the unique ID, we can put timestamp, example - 201406131130


At last run below command


---> aws cloudfront create-distribution --distribution-config file://newCFconfig.json


once done, go to AWS console ---> CloudFront , we can see here new distribution is created and status as deploying.