| Did this page help you? Yes No Tell us about it... |
Attaches an Internet gateway to a VPC, enabling connectivity between the Internet and the VPC. For more information about your VPC and Internet gateway, go to the Amazon Virtual Private Cloud User Guide.
![]() | Note |
|---|---|
For VPCs that existed before the 2011-01-01 API version: Before you can attach an Internet gateway, you must delete the legacy security group. For more information, go to "Deleting the Legacy Security Group" in the Security Groups section of the Amazon Virtual Private Cloud User Guide. |
The short version of this command is ec2attigw.
ec2-attach-internet-gateway
internet_gateway_id -c vpc_id
| Name | Description | Required |
|---|---|---|
|
|
The ID of the Internet gateway to attach. Type: String Default: None Example: igw-c3a643aa |
Yes |
|
|
The ID of the VPC. Type: String Default: None Example: -c vpc-d9a045b0 |
Yes |
| Option | Description |
|---|---|
|
|
Overrides the Region specified in the Default: The Example: |
|
|
Default: The Example: |
|
|
The private key to use when constructing requests to Amazon EC2. Default: The value of the Example: |
|
|
The X.509 certificate to use when constructing requests to Amazon EC2. Default: The value of the Example: |
|
|
Specifies a connection timeout (in seconds). Example: --connection-timeout 30 |
|
|
Specifies a request timeout (in seconds). Example: --request-timeout 45 |
|
|
Displays verbose output by showing the SOAP request and response on the command line. This is particularly useful if you are building tools to talk directly to our SOAP API. |
|
|
Displays column headers in the output. |
|
|
Shows empty columns as |
|
|
Do not display tags for tagged resources. |
|
|
Prints internal debugging information. This is useful to assist us when troubleshooting problems. |
|
|
Displays Help. |
|
|
If Example: |
Boolean true or false
Amazon EC2 command line tools display errors on stderr.
This example attaches the Internet gateway with ID igw-eaad4883 to the VPC with ID vpc-11ad4878.
PROMPT>ec2-attach-internet-gateway igw-eaad4883 -c vpc-11ad4878ATTACHMENT vpc-11ad4878 attaching