amazon-web-services - AWS Java SDK Cloudformation 无法按名称或 Id 描述堆栈
问题描述
尝试通过 SDK 发出简单请求会抛出 404 Stack not found,但是使用完全相同的堆栈名称进行调用会按预期返回堆栈信息。
我正在使用的代码:
public String getStatus() {
final DescribeStackInstanceRequest describeStackInstanceRequest =
new DescribeStackInstanceRequest();
describeStackInstanceRequest
.withStackSetName("a-1593589243-example-com")
.withStackInstanceAccount("6**********") // My AWS account ID
.withStackInstanceRegion(Regions.US_EAST_1.getName());
return amazonCloudFormation
.describeStackInstance(describeStackInstanceRequest)
.getStackInstance()
.getStatus();
}
尝试用堆栈 ID 替换名称,我得到无效的正则表达式错误。
和等价的 CLI 命令
aws cloudformation describe-stacks --stack-name a-1593589243-example-com
使用最新版本的 SDK
implementation 'com.amazonaws:aws-java-sdk-cloudformation:1.11.812'
解决方案
The describeStackInstanceRequest
call is for Stack Sets not Stacks. These are two different things in CloudFormation.
I think the following should be used DescribeStacksRequest or an equivalent.
推荐阅读
- java - Wikidata Toolkit:是否可以访问实体的属性?
- paypal - PayPal IPN 消息问题
- python - 后跟逗号和换行符的变量的 Python 含义
- r - 闪亮应用程序中用户定义函数中的闪亮输入
- wpf - SQLite 数据结果在 .NET 中四舍五入,在 SQLite 的 DB 浏览器中显示正确的结果
- powershell - 如何在不指定参数的情况下使用 invoke-wmimethod?
- javascript - 在呈现后更改单个事件的 startEditable 值
- c++ - 使用 std::thread 时,主线程中的循环卡住了
- r - 如何将 if-else 函数应用于多个“if 语句”和两个不同的数据帧大小?
- view - 实体框架使用视图而不是表创建模型