This is the new *CloudFormation Template Reference Guide*. Please update your bookmarks and links. For help getting started with CloudFormation, see the [AWS CloudFormation User Guide](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html). # AWS::EC2::InternetGateway Allocates an internet gateway for use with a VPC. After creating the Internet gateway, you then attach it to a VPC. ## Syntax To declare this entity in your CloudFormation template, use the following syntax: ### JSON ``` { "Type" : "AWS::EC2::InternetGateway", "Properties" : { "[Tags](#cfn-ec2-internetgateway-tags)" : {{[ Tag, ... ]}} } } ``` ### YAML ``` Type: AWS::EC2::InternetGateway Properties: [Tags](#cfn-ec2-internetgateway-tags): {{ - Tag}} ``` ## Properties `Tags` Any tags to assign to the internet gateway. *Required*: No *Type*: Array of [Tag](aws-properties-ec2-internetgateway-tag.md) *Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt) ## Return values ### Ref When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the ID of the internet gateway. For more information about using the `Ref` function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html). ### Fn::GetAtt The `Fn::GetAtt` intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values. For more information about using the `Fn::GetAtt` intrinsic function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html). #### `InternetGatewayId` The ID of the internet gateway. ## Examples ### Create an internet gateway The following example creates an internet gateway and assigns it a tag. #### JSON ``` "Resources" : { "myInternetGateway" : { "Type" : "AWS::EC2::InternetGateway", "Properties" : { "Tags" : [ {"Key" : "stack", "Value" : "production"}] } } } ``` #### YAML ``` myInternetGateway: Type: AWS::EC2::InternetGateway Properties: Tags: - Key: stack Value: production ``` ## See also + [ CreateInternetGateway](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateInternetGateway.html) in the *Amazon EC2 API Reference* + [Internet gateways](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Internet_Gateway.html) in the *Amazon VPC User Guide* + Use the [ AWS::EC2::VPCGatewayAttachment](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html) resource to associate an internet gateway with a VPC

AltStyle によって変換されたページ (->オリジナル) /