Posted at

S3のVPCエンドポイントがあるとaws-sdk-v1のRouteTable#routesがコケる

More than 3 years have passed since last update.

aws-sdk-v1でRouteTable#routesがなんかエラーになるなと思ったら、

$ pry

[1] pry(main)> require 'aws-sdk-v1'
=> true
[2] pry(main)> ec2 = AWS::EC2.new
=> <AWS::EC2>
[3] pry(main)> rt = ec2.route_tables['rtb-26882xxx']
=> <AWS::EC2::RouteTable id:rtb-26882xxx>
[4] pry(main)> rt.routes
NoMethodError: undefined method `destination_cidr_block' for #<Hash:0x007f895ba35480>
from /Library/Ruby/Gems/2.0.0/gems/aws-sdk-v1-1.64.0/lib/aws/core/data.rb:101:in `method_missing'

S3のVPCエンドポイントを使ってるとダメそう。destination_cidr_blockはないよなぁ。

[5] pry(main)> rt.send :route_set

=> [{:destination_cidr_block=>"192.168.0.0/24", :instance_id=>"i-5f9f66ad", :instance_owner_id=>"7890350xxxxx", :network_interface_id=>"eni-30a33146", :state=>"active", :origin=>"CreateRoute"},...
{:gateway_id=>"vpce-746782xx", :state=>"active", :origin=>"CreateRoute"}]

そろそろv1使うのやめないとなぁ。