Skip to content

AWS SDK fails to read route to VPC endpoint because of missing destination_cidr_block #1630

@sverchdotgov

Description

@sverchdotgov

Please fill out the sections below to help us address your issue

Issue description

When I create a route to a VPC endpoint, it creates a route in my route table that doesn't include a DestinationCidrBlock, which causes the AWS SDK to fail when it tries to create a Route object.

Gem name ('aws-sdk', 'aws-sdk-resources' or service gems like 'aws-sdk-s3') and its version

'aws-sdk-ec2'

Version of Ruby, OS environment

$ uname -a
Linux feynman 4.12.14-300.fc26.x86_64 #1 SMP Wed Sep 20 16:28:07 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ ruby --version
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
$ cat /etc/fedora-release 
Fedora release 26 (Twenty Six)

Code snippets / steps to reproduce

First create a VPC endpoint and associate it with your route table (I used: https://www.terraform.io/docs/providers/aws/r/vpc_endpoint.html).

Code snippet to reproduce the issue:

require 'aws-sdk'

puts Gem.loaded_specs["aws-sdk"].version
resource = Aws::EC2::Resource.new
resource.route_table("rtb-c2834fb8").routes.each do |route|
  puts route.inspect
end

Starting state/outputs:

$ aws ec2 describe-vpc-endpoints --vpc-endpoint-id vpce-270abd4e
{
    "VpcEndpoints": [
        {
            "CreationTimestamp": "2017-10-06T17:45:31Z",
            "PolicyDocument": "{\"Version\":\"2008-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":\"*\",\"Action\":\"*\",\"Resource\":\"*\"}]}",
            "RouteTableIds": [
                "rtb-ac9c50d6",
                "rtb-c2834fb8",
                "rtb-1e995564"
            ],
            "ServiceName": "com.amazonaws.us-east-1.s3",
            "State": "available",
            "VpcEndpointId": "vpce-270abd4e",
            "VpcId": "vpc-d2fa03aa"
        }
    ]
}
$ aws ec2 describe-route-tables --route-table-ids rtb-c2834fb8 --query "RouteTables[*].Routes[*]"
[
    [
        {
            "DestinationCidrBlock": "10.0.0.0/16",
            "GatewayId": "local",
            "Origin": "CreateRouteTable",
            "State": "active"
        },
        {
            "DestinationCidrBlock": "0.0.0.0/0",
            "NatGatewayId": "nat-0c3817b08e4743081",
            "Origin": "CreateRoute",
            "State": "active"
        },
        {
            "DestinationPrefixListId": "pl-63a5400a",
            "GatewayId": "vpce-270abd4e",
            "Origin": "CreateRoute",
            "State": "active"
        }
    ]
]
$ ruby get_routes.rb 
3.0.1
/home/sverch/.gem/ruby/2.4.0/gems/aws-sdk-ec2-1.10.0/lib/aws-sdk-ec2/route.rb:350:in `extract_destination_cidr_block': missing required option :destination_cidr_block (ArgumentError)
	from /home/sverch/.gem/ruby/2.4.0/gems/aws-sdk-ec2-1.10.0/lib/aws-sdk-ec2/route.rb:24:in `initialize'
	from /home/sverch/.gem/ruby/2.4.0/gems/aws-sdk-ec2-1.10.0/lib/aws-sdk-ec2/route_table.rb:333:in `new'
	from /home/sverch/.gem/ruby/2.4.0/gems/aws-sdk-ec2-1.10.0/lib/aws-sdk-ec2/route_table.rb:333:in `block in routes'
	from /home/sverch/.gem/ruby/2.4.0/gems/aws-sdk-ec2-1.10.0/lib/aws-sdk-ec2/route_table.rb:332:in `each'
	from /home/sverch/.gem/ruby/2.4.0/gems/aws-sdk-ec2-1.10.0/lib/aws-sdk-ec2/route_table.rb:332:in `routes'
	from get_routes.rb:5:in `<main>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    service-apiGeneral API label for AWS Services.wontfixWe have determined that we will not resolve the issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions