amazon-cloudformation - 用于执行 CloudFormation 更改集的直接 URL
问题描述
在 AWS CloudFormation 中,我有一些更改集:
{
"eks-alb-ingress-private-security-groups": [
{
"StackId": "arn:aws:cloudformation:ap-southeast-2:111111111111:stack/eks-alb-ingress-private-security-groups/f452e940-3fe0-11ea-a91a-0a564743ac36",
"StackName": "eks-alb-ingress-private-security-groups",
"ChangeSetId": "arn:aws:cloudformation:ap-southeast-2:111111111111:changeSet/sceptre-change-set-eks-cluster-addons/2d497c25-2a02-4373-96c2-9f099076d264",
"ChangeSetName": "sceptre-change-set-eks-cluster-addons",
"ExecutionStatus": "AVAILABLE",
"Status": "CREATE_COMPLETE",
"CreationTime": "2020-03-17 08:05:53.943000+00:00"
}
]
}
文档中很好地解释了我如何执行该更改集。
但是,当应用许多更改集时,如果我可以在运行aws cloudformation list-change-sets
. 这将节省我很多点击!
我尝试从以下开始:
https://ap-southeast-2.console.aws.amazon.com/cloudformation/home?region=ap-southeast-2#/stacks/events?
然后使用https://www.url-encode-decode.com进行 URL 编码:
encoded_stack_id=...
encoded_change_set_id=...
导致生成的 URL:
url="https://ap-southeast-2.console.aws.amazon.com/cloudformation/home?region=ap-southeast-2#/stacks/events?StackId=${encoded_stack_id}&ChangeSetId=${encoded_change_set_id}"
但这会导致发出此错误:
You must specify a Stack ID. Displaying your Stacks page.
The URL specified is invalid.
You must specify both a Stack ID and a Change Set ID. Displaying your Stacks page.
有可能做我想做的事吗?如果是这样,怎么做?
解决方案
经过多次试验和错误,我终于得到了这个工作:
首先,我安装了gridsite-clients
:
apt-get install gridsite-clients
然后:
main_part="https://ap-southeast-2.console.aws.amazon.com/cloudformation/home?region=ap-southeast-2#/stacks/changesets/changes"
stack_id=$(urlencode \
"arn:aws:cloudformation:ap-southeast-2:111111111111:stack/eks-alb-ingress-private-security-groups/f452e940-3fe0-11ea-a91a-0a564743ac36")
change_set_id=$(urlencode \
"arn:aws:cloudformation:ap-southeast-2:111111111111:changeSet/sceptre-change-set-eks-cluster-addons/2d497c25-2a02-4373-96c2-9f099076d264")
url="$main_part?stackId=$stack_id&changeSetId=$change_set_id"
然后,该变量$url
包含将您带到 AWS 控制台中的更改集执行页面的直接 URL。
推荐阅读
- c# - 将字符串绑定到 WPF RichTextBox
- javascript - 每个浏览器会话运行一次 JQuery
- c# - NavigationStack 的 ScanPage 有问题
- c# - 如何使用具有不同数据表示的轨迹栏?
- html - 为什么我的 Angular PWA 独立显示器无法在 Android 上的 Chrome 中运行?
- python - 使用 Django-todo 时使用空数据库运行 makemigrations 时出现“OperationalError:没有这样的表:django_site”
- python - Python:猜词游戏
- cors - 从作曲家休息服务器取消跨域请求
- javascript - 有没有办法修改使用闭包访问的变量并且无法访问它们
- r - 多个时间序列数据的指数时间序列