Question

I've created a CloudFormation stack using the Amazon AWS SDK for Ruby. When I navigate to the CloudFormation Management Console I can see it:

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.config(cloud_formation_endpoint: 'cloudformation.ap-southeast-2.amazonaws.com',
           ...

If I attempt to interrogate the VPC directly:

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; I can see it in the VPC Management Console.

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.

Était-ce utile?

La solution

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. So it existed in US East, but my code was looking in Sydney :(

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top