1. Packages
  2. AWS Classic
  3. API Docs
  4. ec2
  5. InternetGatewayAttachment

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

aws.ec2.InternetGatewayAttachment

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

    Provides a resource to create a VPC Internet Gateway Attachment.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const exampleVpc = new aws.ec2.Vpc("example", {cidrBlock: "10.1.0.0/16"});
    const exampleInternetGateway = new aws.ec2.InternetGateway("example", {});
    const example = new aws.ec2.InternetGatewayAttachment("example", {
        internetGatewayId: exampleInternetGateway.id,
        vpcId: exampleVpc.id,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example_vpc = aws.ec2.Vpc("example", cidr_block="10.1.0.0/16")
    example_internet_gateway = aws.ec2.InternetGateway("example")
    example = aws.ec2.InternetGatewayAttachment("example",
        internet_gateway_id=example_internet_gateway.id,
        vpc_id=example_vpc.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleVpc, err := ec2.NewVpc(ctx, "example", &ec2.VpcArgs{
    			CidrBlock: pulumi.String("10.1.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleInternetGateway, err := ec2.NewInternetGateway(ctx, "example", nil)
    		if err != nil {
    			return err
    		}
    		_, err = ec2.NewInternetGatewayAttachment(ctx, "example", &ec2.InternetGatewayAttachmentArgs{
    			InternetGatewayId: exampleInternetGateway.ID(),
    			VpcId:             exampleVpc.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleVpc = new Aws.Ec2.Vpc("example", new()
        {
            CidrBlock = "10.1.0.0/16",
        });
    
        var exampleInternetGateway = new Aws.Ec2.InternetGateway("example");
    
        var example = new Aws.Ec2.InternetGatewayAttachment("example", new()
        {
            InternetGatewayId = exampleInternetGateway.Id,
            VpcId = exampleVpc.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ec2.Vpc;
    import com.pulumi.aws.ec2.VpcArgs;
    import com.pulumi.aws.ec2.InternetGateway;
    import com.pulumi.aws.ec2.InternetGatewayAttachment;
    import com.pulumi.aws.ec2.InternetGatewayAttachmentArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var exampleVpc = new Vpc("exampleVpc", VpcArgs.builder()
                .cidrBlock("10.1.0.0/16")
                .build());
    
            var exampleInternetGateway = new InternetGateway("exampleInternetGateway");
    
            var example = new InternetGatewayAttachment("example", InternetGatewayAttachmentArgs.builder()
                .internetGatewayId(exampleInternetGateway.id())
                .vpcId(exampleVpc.id())
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:ec2:InternetGatewayAttachment
        properties:
          internetGatewayId: ${exampleInternetGateway.id}
          vpcId: ${exampleVpc.id}
      exampleVpc:
        type: aws:ec2:Vpc
        name: example
        properties:
          cidrBlock: 10.1.0.0/16
      exampleInternetGateway:
        type: aws:ec2:InternetGateway
        name: example
    

    Create InternetGatewayAttachment Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new InternetGatewayAttachment(name: string, args: InternetGatewayAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def InternetGatewayAttachment(resource_name: str,
                                  args: InternetGatewayAttachmentArgs,
                                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def InternetGatewayAttachment(resource_name: str,
                                  opts: Optional[ResourceOptions] = None,
                                  internet_gateway_id: Optional[str] = None,
                                  vpc_id: Optional[str] = None)
    func NewInternetGatewayAttachment(ctx *Context, name string, args InternetGatewayAttachmentArgs, opts ...ResourceOption) (*InternetGatewayAttachment, error)
    public InternetGatewayAttachment(string name, InternetGatewayAttachmentArgs args, CustomResourceOptions? opts = null)
    public InternetGatewayAttachment(String name, InternetGatewayAttachmentArgs args)
    public InternetGatewayAttachment(String name, InternetGatewayAttachmentArgs args, CustomResourceOptions options)
    
    type: aws:ec2:InternetGatewayAttachment
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args InternetGatewayAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args InternetGatewayAttachmentArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args InternetGatewayAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args InternetGatewayAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args InternetGatewayAttachmentArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var internetGatewayAttachmentResource = new Aws.Ec2.InternetGatewayAttachment("internetGatewayAttachmentResource", new()
    {
        InternetGatewayId = "string",
        VpcId = "string",
    });
    
    example, err := ec2.NewInternetGatewayAttachment(ctx, "internetGatewayAttachmentResource", &ec2.InternetGatewayAttachmentArgs{
    	InternetGatewayId: pulumi.String("string"),
    	VpcId:             pulumi.String("string"),
    })
    
    var internetGatewayAttachmentResource = new InternetGatewayAttachment("internetGatewayAttachmentResource", InternetGatewayAttachmentArgs.builder()
        .internetGatewayId("string")
        .vpcId("string")
        .build());
    
    internet_gateway_attachment_resource = aws.ec2.InternetGatewayAttachment("internetGatewayAttachmentResource",
        internet_gateway_id="string",
        vpc_id="string")
    
    const internetGatewayAttachmentResource = new aws.ec2.InternetGatewayAttachment("internetGatewayAttachmentResource", {
        internetGatewayId: "string",
        vpcId: "string",
    });
    
    type: aws:ec2:InternetGatewayAttachment
    properties:
        internetGatewayId: string
        vpcId: string
    

    InternetGatewayAttachment Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The InternetGatewayAttachment resource accepts the following input properties:

    InternetGatewayId string
    The ID of the internet gateway.
    VpcId string
    The ID of the VPC.
    InternetGatewayId string
    The ID of the internet gateway.
    VpcId string
    The ID of the VPC.
    internetGatewayId String
    The ID of the internet gateway.
    vpcId String
    The ID of the VPC.
    internetGatewayId string
    The ID of the internet gateway.
    vpcId string
    The ID of the VPC.
    internet_gateway_id str
    The ID of the internet gateway.
    vpc_id str
    The ID of the VPC.
    internetGatewayId String
    The ID of the internet gateway.
    vpcId String
    The ID of the VPC.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the InternetGatewayAttachment resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing InternetGatewayAttachment Resource

    Get an existing InternetGatewayAttachment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: InternetGatewayAttachmentState, opts?: CustomResourceOptions): InternetGatewayAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            internet_gateway_id: Optional[str] = None,
            vpc_id: Optional[str] = None) -> InternetGatewayAttachment
    func GetInternetGatewayAttachment(ctx *Context, name string, id IDInput, state *InternetGatewayAttachmentState, opts ...ResourceOption) (*InternetGatewayAttachment, error)
    public static InternetGatewayAttachment Get(string name, Input<string> id, InternetGatewayAttachmentState? state, CustomResourceOptions? opts = null)
    public static InternetGatewayAttachment get(String name, Output<String> id, InternetGatewayAttachmentState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    InternetGatewayId string
    The ID of the internet gateway.
    VpcId string
    The ID of the VPC.
    InternetGatewayId string
    The ID of the internet gateway.
    VpcId string
    The ID of the VPC.
    internetGatewayId String
    The ID of the internet gateway.
    vpcId String
    The ID of the VPC.
    internetGatewayId string
    The ID of the internet gateway.
    vpcId string
    The ID of the VPC.
    internet_gateway_id str
    The ID of the internet gateway.
    vpc_id str
    The ID of the VPC.
    internetGatewayId String
    The ID of the internet gateway.
    vpcId String
    The ID of the VPC.

    Import

    Using pulumi import, import Internet Gateway Attachments using the id. For example:

    $ pulumi import aws:ec2/internetGatewayAttachment:InternetGatewayAttachment example igw-c0a643a9:vpc-123456
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi