Jananath Banuka
Jananath Banuka

Reputation: 3873

How to update CloudFront aliase with AWS CLI

I have a cloudfront and I need to update the alias (CNAME) of that using the aws cli.

According to the documentation I have have a configuration json.

Command I tried looks like this:

aws cloudfront update-distribution --distribution-config file://cfconfig.json --id <ID>

and the cfconfig.json looks like this:

{
    "CallerReference": "terraformer",
    "Aliases": {
      "Quantity": 1,
      "Items": ["test.dev.domain.com.au"]
    }
}

But I get the error:

enter image description here

I need to only update the cloudfront CNAME value and how can I simply do that? Why we need the json file at all? Are there any other good ways to add only the Cname?

Upvotes: 1

Views: 919

Answers (1)

Anna Slastnikova
Anna Slastnikova

Reputation: 1548

I'd suggest to download current distribution config using aws cloudfront get-distribution-config and than amend it according to the changes you need to apply and feed it to update-distribution command.

Upvotes: 2

Related Questions