简体   繁体   English

SDK无法看到已创建的CloudFormation堆栈

[英]Created CloudFormation stack not visible to SDK

I've created a CloudFormation stack using the Amazon AWS SDK for Ruby. 我已经使用适用于Ruby的Amazon AWS开发工具包创建了CloudFormation堆栈。 When I navigate to the CloudFormation Management Console I can see it: 导航到CloudFormation管理控制台时,可以看到它:

my-vpc-stack-name  2013-04-26 11:33:22 UTC+10  CREATE_COMPLETE

I'm trying to query the resources used by the stack with the following code: 我正在尝试通过以下代码查询堆栈使用的资源:

cf_client = AWS::CloudFormation.new.client
response = cf_client.describe_stack_resources(:stack_name => 'my-vpc-stack-name')

This raises the following exception: 这引发了以下异常:

AWS::CloudFormation::Errors::ValidationError: Stack with name biq-vpc-prod does not exist
    from /home/duncan/.rvm/gems/ruby-1.9.3-p392/gems/aws-sdk-1.9.3/lib/aws/core/client.rb:360:in `return_or_raise'
    from /home/duncan/.rvm/gems/ruby-1.9.3-p392/gems/aws-sdk-1.9.3/lib/aws/core/client.rb:461:in `client_request'

I believe I've configured AWS to use the same zones in both cases: 我相信我已经将AWS配置为在两种情况下都使用相同的区域:

AWS.config(cloud_formation_endpoint: 'cloudformation.ap-southeast-2.amazonaws.com',
           ...

If I attempt to interrogate the VPC directly: 如果我尝试直接询问VPC:

vpc = AWS::EC2::VPC.new('my-vpc-id')
vpc.state

... then I get a similar error: ...然后我得到一个类似的错误:

AWS::EC2::Errors::InvalidVpcID::NotFound: The vpc ID 'my-vpc-id' does not exist
    from /home/duncan/.rvm/gems/ruby-1.9.3-p392/gems/aws-sdk-1.9.3/lib/aws/core/client.rb:360:in `return_or_raise'
    from /home/duncan/.rvm/gems/ruby-1.9.3-p392/gems/aws-sdk-1.9.3/lib/aws/core/client.rb:461:in `client_request'
    from (eval):3:in `describe_vpcs'

But the VPC definitely exists; 但是VPC确实存在; I can see it in the VPC Management Console. 我可以在VPC管理控制台中看到它。

Does anyone know what I need to do in order to get this to work? 有谁知道我需要做些什么才能使它工作? I suspect I'm failing to understand something fundamental about the way the SDK works. 我怀疑我无法理解有关SDK工作方式的一些基本知识。

PEBKAC . PEBKAC I'd created the stack in the wrong region, because I'd neglected to specify the region when calling create_stack in the first place. 我在错误的区域中创建了堆栈,因为当初调用create_stack时忽略了指定区域。 So it existed in US East, but my code was looking in Sydney :( 因此它存在于美国东部,但是我的代码正在悉尼寻找:(

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM