英文:
Store or retrieve identifier from create-invalidation
问题
我正在尝试创建一个失效请求,如下所示:
aws cloudfront create-invalidation --distribution-id XXXXXX --paths '/*'
然后希望监听它以完成,使用以下命令:
aws cloudfront wait invalidation-completed --id <<NEED ID HERE>> --distribution-id XXXXXX && callback()
如何获取失效请求生成的ID?
英文:
I am trying to create an invalidation request as
aws cloudfront create-invalidation --distribution-id XXXXXX --paths '/*'
and soon want to listen for it to complete using
aws cloudfront wait invalidation-completed --id <<NEED ID HERE>> --distribution-id XXXXXX && callback()
How to get the ID generated from invalidation request?
答案1
得分: 2
将create-invalidation命令的输出存储在一个变量中
invalidation_output=$(aws cloudfront create-invalidation --distribution-id XXXXXX --paths '/*')
使用jq提取失效标识(确保您已安装jq)
invalidation_id=$(echo $invalidation_output | jq -r '.Invalidation.Id')
参考:https://docs.aws.amazon.com/cli/latest/reference/cloudfront/create-invalidation.html#examples
英文:
# Store the output of the create-invalidation command in a variable
invalidation_output=$(aws cloudfront create-invalidation --distribution-id XXXXXX --paths '/*')
# Extract the Invalidation ID using jq (make sure you have jq installed)
invalidation_id=$(echo $invalidation_output | jq -r '.Invalidation.Id')
Ref :https://docs.aws.amazon.com/cli/latest/reference/cloudfront/create-invalidation.html#examples
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论