diff --git a/library/cloud/ec2_vpc b/library/cloud/ec2_vpc index 561e0db696c..41d9720af23 100644 --- a/library/cloud/ec2_vpc +++ b/library/cloud/ec2_vpc @@ -427,8 +427,10 @@ def create_vpc(module, vpc_conn): '(igw) route, but you have no Internet Gateway' ) route_kwargs['gateway_id'] = igw.id - else: + elif route['gw'].startswith('i-'): route_kwargs['instance_id'] = route['gw'] + else: + route_kwargs['gateway_id'] = route['gw'] vpc_conn.create_route(new_rt.id, route['dest'], **route_kwargs) # Associate with subnets