Browse Source

Add a route so that subnet traffic can be routed to the gateway

Nuwan Goonasekera 8 years ago
parent
commit
5035dfd550
1 changed files with 4 additions and 1 deletions
  1. 4 1
      cloudbridge/cloud/providers/aws/resources.py

+ 4 - 1
cloudbridge/cloud/providers/aws/resources.py

@@ -1083,8 +1083,11 @@ class AWSRouter(BaseRouter):
     def attach_gateway(self, gateway):
         gw_id = (gateway.id if isinstance(gateway, AWSInternetGateway)
                  else gateway)
-        return self._provider.ec2_conn.meta.client.attach_internet_gateway(
+        result = self._provider.ec2_conn.meta.client.attach_internet_gateway(
             InternetGatewayId=gw_id, VpcId=self._route_table.vpc_id)
+        self._route_table.create_route(
+            DestinationCidrBlock='0.0.0.0/0', GatewayId=gw_id)
+        return result
 
     def detach_gateway(self, gateway):
         gw_id = (gateway.id if isinstance(gateway, AWSInternetGateway)