We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I would like to edit/update my CloudFront distribution with awscli.
I'm using latest cli version:
aws-cli/1.11.56 Python/2.7.10 Darwin/16.4.0 botocore/1.5.19
I'm getting config of the distribution that I'd like to modify:
aws cloudfront get-distribution-config --id FOO_BAR_ID > cf_config.json
Looks like it worked as expected. Config looks ok for me. Now I'm trying to reconfigure my CF distribution with the same config.
aws cloudfront update-distribution --distribution-config file://cf_config.json --id FOO_BAR_ID
and I'm getting:
Parameter validation failed: Missing required parameter in DistributionConfig: "CallerReference" Missing required parameter in DistributionConfig: "Origins" Missing required parameter in DistributionConfig: "DefaultCacheBehavior" Missing required parameter in DistributionConfig: "Comment" Missing required parameter in DistributionConfig: "Enabled" Unknown parameter in DistributionConfig: "ETag", must be one of: CallerReference, Aliases, DefaultRootObject, Origins, DefaultCacheBehavior, CacheBehaviors, CustomErrorResponses, Comment, Logging, PriceClass, Enabled, ViewerCertificate, Restrictions, WebACLId, HttpVersion, IsIPV6Enabled Unknown parameter in DistributionConfig: "DistributionConfig", must be one of: CallerReference, Aliases, DefaultRootObject, Origins, DefaultCacheBehavior, CacheBehaviors, CustomErrorResponses, Comment, Logging, PriceClass, Enabled, ViewerCertificate, Restrictions, WebACLId, HttpVersion, IsIPV6Enabled
Is it a bug? What is the right way to reconfigure CF using awscli?
The text was updated successfully, but these errors were encountered:
Sorry. Looks like this is not a bug.
You have to edit cf_config.json before using it with update-distribution and remove
update-distribution
{ "ETag": "ETag_Value", "DistributionConfig":
from the beginning of the file and last
}
from the end of file.
Then use this command with the right id and ETag value that was removed from cf_config.json
id
ETag
cf_config.json
aws cloudfront update-distribution --distribution-config file://cf_config.json --id FOO_BAR_ID --if-match ETag_Value
Sorry, something went wrong.
Filtering by the DistributionConfig should be enough:
DistributionConfig
aws cloudfront get-distribution-config \ --id FOO_BAR_ID \ --query 'DistributionConfig' \ --output json \ > cf_config.json
@yaselc this doesn't let you push it though, since you need the etag. Here's a script I made for the purpose of updating a distribution.
#!/usr/bin/env bash configFilePath=$1 distributionId=$2 distributionToPushPath="distribution.config" etag=$(cat $configFilePath | python3 -c "import sys, json; print(json.load(sys.stdin)['ETag'])") cat $configFilePath | python3 -c "import sys, json; print(json.dumps(json.load(sys.stdin)['DistributionConfig']))" > $distributionToPushPath aws cloudfront update-distribution --distribution-config file://$distributionToPushPath --id $distributionId --if-match $etag rm distribution.config
No branches or pull requests
I would like to edit/update my CloudFront distribution with awscli.
I'm using latest cli version:
aws-cli/1.11.56 Python/2.7.10 Darwin/16.4.0 botocore/1.5.19
I'm getting config of the distribution that I'd like to modify:
aws cloudfront get-distribution-config --id FOO_BAR_ID > cf_config.json
Looks like it worked as expected. Config looks ok for me. Now I'm trying to reconfigure my CF distribution with the same config.
aws cloudfront update-distribution --distribution-config file://cf_config.json --id FOO_BAR_ID
and I'm getting:
Is it a bug?
What is the right way to reconfigure CF using awscli?
The text was updated successfully, but these errors were encountered: