DEV Community

Discussion on: Update an AWS CloudFront custom SSL/TLS certificate using AWS CLI

Collapse
 
feargalwag profile image
Feargal

I got it working by using jq instead of sed, thanks for the great guide! Here's an example on how to use jq to manipulate the json for anyone else stuck on the tricky regex of sed

tmp=${mktemp}
jq '.ViewerCertificate.SSLSupportMethod = "sni-only"'  config.json > "$tmp" && mv "$tmp" config.json
Enter fullscreen mode Exit fullscreen mode
Collapse
 
feargalwag profile image
Feargal

One issue is that it's tricky to get environment variables in jq so I just hardcoded everything I need to update in the cloudfront distro.