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

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.VpcPeeringConnection

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 manage a VPC peering connection.

    NOTE on VPC Peering Connections and VPC Peering Connection Options: This provider provides both a standalone VPC Peering Connection Options and a VPC Peering Connection resource with accepter and requester attributes. Do not manage options for the same VPC peering connection in both a VPC Peering Connection resource and a VPC Peering Connection Options resource. Doing so will cause a conflict of options and will overwrite the options. Using a VPC Peering Connection Options resource decouples management of the connection options from management of the VPC Peering Connection and allows options to be set correctly in cross-account scenarios.

    Note: For cross-account (requester’s AWS account differs from the accepter’s AWS account) or inter-region VPC Peering Connections use the aws.ec2.VpcPeeringConnection resource to manage the requester’s side of the connection and use the aws.ec2.VpcPeeringConnectionAccepter resource to manage the accepter’s side of the connection.

    Note: Creating multiple aws.ec2.VpcPeeringConnection resources with the same peer_vpc_id and vpc_id will not produce an error. Instead, AWS will return the connection id that already exists, resulting in multiple aws.ec2.VpcPeeringConnection resources with the same id.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const foo = new aws.ec2.VpcPeeringConnection("foo", {
        peerOwnerId: peerOwnerId,
        peerVpcId: bar.id,
        vpcId: fooAwsVpc.id,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    foo = aws.ec2.VpcPeeringConnection("foo",
        peer_owner_id=peer_owner_id,
        peer_vpc_id=bar["id"],
        vpc_id=foo_aws_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 {
    		_, err := ec2.NewVpcPeeringConnection(ctx, "foo", &ec2.VpcPeeringConnectionArgs{
    			PeerOwnerId: pulumi.Any(peerOwnerId),
    			PeerVpcId:   pulumi.Any(bar.Id),
    			VpcId:       pulumi.Any(fooAwsVpc.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 foo = new Aws.Ec2.VpcPeeringConnection("foo", new()
        {
            PeerOwnerId = peerOwnerId,
            PeerVpcId = bar.Id,
            VpcId = fooAwsVpc.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ec2.VpcPeeringConnection;
    import com.pulumi.aws.ec2.VpcPeeringConnectionArgs;
    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 foo = new VpcPeeringConnection("foo", VpcPeeringConnectionArgs.builder()
                .peerOwnerId(peerOwnerId)
                .peerVpcId(bar.id())
                .vpcId(fooAwsVpc.id())
                .build());
    
        }
    }
    
    resources:
      foo:
        type: aws:ec2:VpcPeeringConnection
        properties:
          peerOwnerId: ${peerOwnerId}
          peerVpcId: ${bar.id}
          vpcId: ${fooAwsVpc.id}
    

    Basic usage with connection options:

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const foo = new aws.ec2.VpcPeeringConnection("foo", {
        peerOwnerId: peerOwnerId,
        peerVpcId: bar.id,
        vpcId: fooAwsVpc.id,
        accepter: {
            allowRemoteVpcDnsResolution: true,
        },
        requester: {
            allowRemoteVpcDnsResolution: true,
        },
    });
    
    import pulumi
    import pulumi_aws as aws
    
    foo = aws.ec2.VpcPeeringConnection("foo",
        peer_owner_id=peer_owner_id,
        peer_vpc_id=bar["id"],
        vpc_id=foo_aws_vpc["id"],
        accepter={
            "allowRemoteVpcDnsResolution": True,
        },
        requester={
            "allowRemoteVpcDnsResolution": True,
        })
    
    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 {
    		_, err := ec2.NewVpcPeeringConnection(ctx, "foo", &ec2.VpcPeeringConnectionArgs{
    			PeerOwnerId: pulumi.Any(peerOwnerId),
    			PeerVpcId:   pulumi.Any(bar.Id),
    			VpcId:       pulumi.Any(fooAwsVpc.Id),
    			Accepter: &ec2.VpcPeeringConnectionAccepterTypeArgs{
    				AllowRemoteVpcDnsResolution: pulumi.Bool(true),
    			},
    			Requester: &ec2.VpcPeeringConnectionRequesterArgs{
    				AllowRemoteVpcDnsResolution: pulumi.Bool(true),
    			},
    		})
    		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 foo = new Aws.Ec2.VpcPeeringConnection("foo", new()
        {
            PeerOwnerId = peerOwnerId,
            PeerVpcId = bar.Id,
            VpcId = fooAwsVpc.Id,
            Accepter = new Aws.Ec2.Inputs.VpcPeeringConnectionAccepterArgs
            {
                AllowRemoteVpcDnsResolution = true,
            },
            Requester = new Aws.Ec2.Inputs.VpcPeeringConnectionRequesterArgs
            {
                AllowRemoteVpcDnsResolution = true,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ec2.VpcPeeringConnection;
    import com.pulumi.aws.ec2.VpcPeeringConnectionArgs;
    import com.pulumi.aws.ec2.inputs.VpcPeeringConnectionAccepterArgs;
    import com.pulumi.aws.ec2.inputs.VpcPeeringConnectionRequesterArgs;
    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 foo = new VpcPeeringConnection("foo", VpcPeeringConnectionArgs.builder()
                .peerOwnerId(peerOwnerId)
                .peerVpcId(bar.id())
                .vpcId(fooAwsVpc.id())
                .accepter(VpcPeeringConnectionAccepterArgs.builder()
                    .allowRemoteVpcDnsResolution(true)
                    .build())
                .requester(VpcPeeringConnectionRequesterArgs.builder()
                    .allowRemoteVpcDnsResolution(true)
                    .build())
                .build());
    
        }
    }
    
    resources:
      foo:
        type: aws:ec2:VpcPeeringConnection
        properties:
          peerOwnerId: ${peerOwnerId}
          peerVpcId: ${bar.id}
          vpcId: ${fooAwsVpc.id}
          accepter:
            allowRemoteVpcDnsResolution: true
          requester:
            allowRemoteVpcDnsResolution: true
    

    Basic usage with tags:

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const fooVpc = new aws.ec2.Vpc("foo", {cidrBlock: "10.1.0.0/16"});
    const bar = new aws.ec2.Vpc("bar", {cidrBlock: "10.2.0.0/16"});
    const foo = new aws.ec2.VpcPeeringConnection("foo", {
        peerOwnerId: peerOwnerId,
        peerVpcId: bar.id,
        vpcId: fooVpc.id,
        autoAccept: true,
        tags: {
            Name: "VPC Peering between foo and bar",
        },
    });
    
    import pulumi
    import pulumi_aws as aws
    
    foo_vpc = aws.ec2.Vpc("foo", cidr_block="10.1.0.0/16")
    bar = aws.ec2.Vpc("bar", cidr_block="10.2.0.0/16")
    foo = aws.ec2.VpcPeeringConnection("foo",
        peer_owner_id=peer_owner_id,
        peer_vpc_id=bar.id,
        vpc_id=foo_vpc.id,
        auto_accept=True,
        tags={
            "Name": "VPC Peering between foo and bar",
        })
    
    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 {
    		fooVpc, err := ec2.NewVpc(ctx, "foo", &ec2.VpcArgs{
    			CidrBlock: pulumi.String("10.1.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		bar, err := ec2.NewVpc(ctx, "bar", &ec2.VpcArgs{
    			CidrBlock: pulumi.String("10.2.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ec2.NewVpcPeeringConnection(ctx, "foo", &ec2.VpcPeeringConnectionArgs{
    			PeerOwnerId: pulumi.Any(peerOwnerId),
    			PeerVpcId:   bar.ID(),
    			VpcId:       fooVpc.ID(),
    			AutoAccept:  pulumi.Bool(true),
    			Tags: pulumi.StringMap{
    				"Name": pulumi.String("VPC Peering between foo and bar"),
    			},
    		})
    		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 fooVpc = new Aws.Ec2.Vpc("foo", new()
        {
            CidrBlock = "10.1.0.0/16",
        });
    
        var bar = new Aws.Ec2.Vpc("bar", new()
        {
            CidrBlock = "10.2.0.0/16",
        });
    
        var foo = new Aws.Ec2.VpcPeeringConnection("foo", new()
        {
            PeerOwnerId = peerOwnerId,
            PeerVpcId = bar.Id,
            VpcId = fooVpc.Id,
            AutoAccept = true,
            Tags = 
            {
                { "Name", "VPC Peering between foo and bar" },
            },
        });
    
    });
    
    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.VpcPeeringConnection;
    import com.pulumi.aws.ec2.VpcPeeringConnectionArgs;
    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 fooVpc = new Vpc("fooVpc", VpcArgs.builder()
                .cidrBlock("10.1.0.0/16")
                .build());
    
            var bar = new Vpc("bar", VpcArgs.builder()
                .cidrBlock("10.2.0.0/16")
                .build());
    
            var foo = new VpcPeeringConnection("foo", VpcPeeringConnectionArgs.builder()
                .peerOwnerId(peerOwnerId)
                .peerVpcId(bar.id())
                .vpcId(fooVpc.id())
                .autoAccept(true)
                .tags(Map.of("Name", "VPC Peering between foo and bar"))
                .build());
    
        }
    }
    
    resources:
      foo:
        type: aws:ec2:VpcPeeringConnection
        properties:
          peerOwnerId: ${peerOwnerId}
          peerVpcId: ${bar.id}
          vpcId: ${fooVpc.id}
          autoAccept: true
          tags:
            Name: VPC Peering between foo and bar
      fooVpc:
        type: aws:ec2:Vpc
        name: foo
        properties:
          cidrBlock: 10.1.0.0/16
      bar:
        type: aws:ec2:Vpc
        properties:
          cidrBlock: 10.2.0.0/16
    

    Basic usage with region:

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const fooVpc = new aws.ec2.Vpc("foo", {cidrBlock: "10.1.0.0/16"});
    const bar = new aws.ec2.Vpc("bar", {cidrBlock: "10.2.0.0/16"});
    const foo = new aws.ec2.VpcPeeringConnection("foo", {
        peerOwnerId: peerOwnerId,
        peerVpcId: bar.id,
        vpcId: fooVpc.id,
        peerRegion: "us-east-1",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    foo_vpc = aws.ec2.Vpc("foo", cidr_block="10.1.0.0/16")
    bar = aws.ec2.Vpc("bar", cidr_block="10.2.0.0/16")
    foo = aws.ec2.VpcPeeringConnection("foo",
        peer_owner_id=peer_owner_id,
        peer_vpc_id=bar.id,
        vpc_id=foo_vpc.id,
        peer_region="us-east-1")
    
    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 {
    		fooVpc, err := ec2.NewVpc(ctx, "foo", &ec2.VpcArgs{
    			CidrBlock: pulumi.String("10.1.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		bar, err := ec2.NewVpc(ctx, "bar", &ec2.VpcArgs{
    			CidrBlock: pulumi.String("10.2.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ec2.NewVpcPeeringConnection(ctx, "foo", &ec2.VpcPeeringConnectionArgs{
    			PeerOwnerId: pulumi.Any(peerOwnerId),
    			PeerVpcId:   bar.ID(),
    			VpcId:       fooVpc.ID(),
    			PeerRegion:  pulumi.String("us-east-1"),
    		})
    		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 fooVpc = new Aws.Ec2.Vpc("foo", new()
        {
            CidrBlock = "10.1.0.0/16",
        });
    
        var bar = new Aws.Ec2.Vpc("bar", new()
        {
            CidrBlock = "10.2.0.0/16",
        });
    
        var foo = new Aws.Ec2.VpcPeeringConnection("foo", new()
        {
            PeerOwnerId = peerOwnerId,
            PeerVpcId = bar.Id,
            VpcId = fooVpc.Id,
            PeerRegion = "us-east-1",
        });
    
    });
    
    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.VpcPeeringConnection;
    import com.pulumi.aws.ec2.VpcPeeringConnectionArgs;
    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 fooVpc = new Vpc("fooVpc", VpcArgs.builder()
                .cidrBlock("10.1.0.0/16")
                .build());
    
            var bar = new Vpc("bar", VpcArgs.builder()
                .cidrBlock("10.2.0.0/16")
                .build());
    
            var foo = new VpcPeeringConnection("foo", VpcPeeringConnectionArgs.builder()
                .peerOwnerId(peerOwnerId)
                .peerVpcId(bar.id())
                .vpcId(fooVpc.id())
                .peerRegion("us-east-1")
                .build());
    
        }
    }
    
    resources:
      foo:
        type: aws:ec2:VpcPeeringConnection
        properties:
          peerOwnerId: ${peerOwnerId}
          peerVpcId: ${bar.id}
          vpcId: ${fooVpc.id}
          peerRegion: us-east-1
      fooVpc:
        type: aws:ec2:Vpc
        name: foo
        properties:
          cidrBlock: 10.1.0.0/16
      bar:
        type: aws:ec2:Vpc
        properties:
          cidrBlock: 10.2.0.0/16
    

    Notes

    If both VPCs are not in the same AWS account and region do not enable the auto_accept attribute. The accepter can manage its side of the connection using the aws.ec2.VpcPeeringConnectionAccepter resource or accept the connection manually using the AWS Management Console, AWS CLI, through SDKs, etc.

    Create VpcPeeringConnection Resource

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

    Constructor syntax

    new VpcPeeringConnection(name: string, args: VpcPeeringConnectionArgs, opts?: CustomResourceOptions);
    @overload
    def VpcPeeringConnection(resource_name: str,
                             args: VpcPeeringConnectionArgs,
                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def VpcPeeringConnection(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             peer_vpc_id: Optional[str] = None,
                             vpc_id: Optional[str] = None,
                             accepter: Optional[VpcPeeringConnectionAccepterArgs] = None,
                             auto_accept: Optional[bool] = None,
                             peer_owner_id: Optional[str] = None,
                             peer_region: Optional[str] = None,
                             requester: Optional[VpcPeeringConnectionRequesterArgs] = None,
                             tags: Optional[Mapping[str, str]] = None)
    func NewVpcPeeringConnection(ctx *Context, name string, args VpcPeeringConnectionArgs, opts ...ResourceOption) (*VpcPeeringConnection, error)
    public VpcPeeringConnection(string name, VpcPeeringConnectionArgs args, CustomResourceOptions? opts = null)
    public VpcPeeringConnection(String name, VpcPeeringConnectionArgs args)
    public VpcPeeringConnection(String name, VpcPeeringConnectionArgs args, CustomResourceOptions options)
    
    type: aws:ec2:VpcPeeringConnection
    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 VpcPeeringConnectionArgs
    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 VpcPeeringConnectionArgs
    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 VpcPeeringConnectionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args VpcPeeringConnectionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args VpcPeeringConnectionArgs
    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 vpcPeeringConnectionResource = new Aws.Ec2.VpcPeeringConnection("vpcPeeringConnectionResource", new()
    {
        PeerVpcId = "string",
        VpcId = "string",
        Accepter = new Aws.Ec2.Inputs.VpcPeeringConnectionAccepterArgs
        {
            AllowRemoteVpcDnsResolution = false,
        },
        AutoAccept = false,
        PeerOwnerId = "string",
        PeerRegion = "string",
        Requester = new Aws.Ec2.Inputs.VpcPeeringConnectionRequesterArgs
        {
            AllowRemoteVpcDnsResolution = false,
        },
        Tags = 
        {
            { "string", "string" },
        },
    });
    
    example, err := ec2.NewVpcPeeringConnection(ctx, "vpcPeeringConnectionResource", &ec2.VpcPeeringConnectionArgs{
    	PeerVpcId: pulumi.String("string"),
    	VpcId:     pulumi.String("string"),
    	Accepter: &ec2.VpcPeeringConnectionAccepterTypeArgs{
    		AllowRemoteVpcDnsResolution: pulumi.Bool(false),
    	},
    	AutoAccept:  pulumi.Bool(false),
    	PeerOwnerId: pulumi.String("string"),
    	PeerRegion:  pulumi.String("string"),
    	Requester: &ec2.VpcPeeringConnectionRequesterArgs{
    		AllowRemoteVpcDnsResolution: pulumi.Bool(false),
    	},
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    var vpcPeeringConnectionResource = new VpcPeeringConnection("vpcPeeringConnectionResource", VpcPeeringConnectionArgs.builder()
        .peerVpcId("string")
        .vpcId("string")
        .accepter(VpcPeeringConnectionAccepterArgs.builder()
            .allowRemoteVpcDnsResolution(false)
            .build())
        .autoAccept(false)
        .peerOwnerId("string")
        .peerRegion("string")
        .requester(VpcPeeringConnectionRequesterArgs.builder()
            .allowRemoteVpcDnsResolution(false)
            .build())
        .tags(Map.of("string", "string"))
        .build());
    
    vpc_peering_connection_resource = aws.ec2.VpcPeeringConnection("vpcPeeringConnectionResource",
        peer_vpc_id="string",
        vpc_id="string",
        accepter={
            "allowRemoteVpcDnsResolution": False,
        },
        auto_accept=False,
        peer_owner_id="string",
        peer_region="string",
        requester={
            "allowRemoteVpcDnsResolution": False,
        },
        tags={
            "string": "string",
        })
    
    const vpcPeeringConnectionResource = new aws.ec2.VpcPeeringConnection("vpcPeeringConnectionResource", {
        peerVpcId: "string",
        vpcId: "string",
        accepter: {
            allowRemoteVpcDnsResolution: false,
        },
        autoAccept: false,
        peerOwnerId: "string",
        peerRegion: "string",
        requester: {
            allowRemoteVpcDnsResolution: false,
        },
        tags: {
            string: "string",
        },
    });
    
    type: aws:ec2:VpcPeeringConnection
    properties:
        accepter:
            allowRemoteVpcDnsResolution: false
        autoAccept: false
        peerOwnerId: string
        peerRegion: string
        peerVpcId: string
        requester:
            allowRemoteVpcDnsResolution: false
        tags:
            string: string
        vpcId: string
    

    VpcPeeringConnection 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 VpcPeeringConnection resource accepts the following input properties:

    PeerVpcId string
    The ID of the target VPC with which you are creating the VPC Peering Connection.
    VpcId string
    The ID of the requester VPC.
    Accepter VpcPeeringConnectionAccepter
    An optional configuration block that allows for VPC Peering Connection options to be set for the VPC that accepts the peering connection (a maximum of one).
    AutoAccept bool
    Accept the peering (both VPCs need to be in the same AWS account and region).
    PeerOwnerId string
    The AWS account ID of the target peer VPC. Defaults to the account ID the [AWS provider][1] is currently connected to, so must be managed if connecting cross-account.
    PeerRegion string
    The region of the accepter VPC of the VPC Peering Connection. auto_accept must be false, and use the aws.ec2.VpcPeeringConnectionAccepter to manage the accepter side.
    Requester VpcPeeringConnectionRequester
    A optional configuration block that allows for VPC Peering Connection options to be set for the VPC that requests the peering connection (a maximum of one).
    Tags Dictionary<string, string>
    A map of tags to assign to the resource. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    PeerVpcId string
    The ID of the target VPC with which you are creating the VPC Peering Connection.
    VpcId string
    The ID of the requester VPC.
    Accepter VpcPeeringConnectionAccepterTypeArgs
    An optional configuration block that allows for VPC Peering Connection options to be set for the VPC that accepts the peering connection (a maximum of one).
    AutoAccept bool
    Accept the peering (both VPCs need to be in the same AWS account and region).
    PeerOwnerId string
    The AWS account ID of the target peer VPC. Defaults to the account ID the [AWS provider][1] is currently connected to, so must be managed if connecting cross-account.
    PeerRegion string
    The region of the accepter VPC of the VPC Peering Connection. auto_accept must be false, and use the aws.ec2.VpcPeeringConnectionAccepter to manage the accepter side.
    Requester VpcPeeringConnectionRequesterArgs
    A optional configuration block that allows for VPC Peering Connection options to be set for the VPC that requests the peering connection (a maximum of one).
    Tags map[string]string
    A map of tags to assign to the resource. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    peerVpcId String
    The ID of the target VPC with which you are creating the VPC Peering Connection.
    vpcId String
    The ID of the requester VPC.
    accepter VpcPeeringConnectionAccepter
    An optional configuration block that allows for VPC Peering Connection options to be set for the VPC that accepts the peering connection (a maximum of one).
    autoAccept Boolean
    Accept the peering (both VPCs need to be in the same AWS account and region).
    peerOwnerId String
    The AWS account ID of the target peer VPC. Defaults to the account ID the [AWS provider][1] is currently connected to, so must be managed if connecting cross-account.
    peerRegion String
    The region of the accepter VPC of the VPC Peering Connection. auto_accept must be false, and use the aws.ec2.VpcPeeringConnectionAccepter to manage the accepter side.
    requester VpcPeeringConnectionRequester
    A optional configuration block that allows for VPC Peering Connection options to be set for the VPC that requests the peering connection (a maximum of one).
    tags Map<String,String>
    A map of tags to assign to the resource. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    peerVpcId string
    The ID of the target VPC with which you are creating the VPC Peering Connection.
    vpcId string
    The ID of the requester VPC.
    accepter VpcPeeringConnectionAccepter
    An optional configuration block that allows for VPC Peering Connection options to be set for the VPC that accepts the peering connection (a maximum of one).
    autoAccept boolean
    Accept the peering (both VPCs need to be in the same AWS account and region).
    peerOwnerId string
    The AWS account ID of the target peer VPC. Defaults to the account ID the [AWS provider][1] is currently connected to, so must be managed if connecting cross-account.
    peerRegion string
    The region of the accepter VPC of the VPC Peering Connection. auto_accept must be false, and use the aws.ec2.VpcPeeringConnectionAccepter to manage the accepter side.
    requester VpcPeeringConnectionRequester
    A optional configuration block that allows for VPC Peering Connection options to be set for the VPC that requests the peering connection (a maximum of one).
    tags {[key: string]: string}
    A map of tags to assign to the resource. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    peer_vpc_id str
    The ID of the target VPC with which you are creating the VPC Peering Connection.
    vpc_id str
    The ID of the requester VPC.
    accepter VpcPeeringConnectionAccepterArgs
    An optional configuration block that allows for VPC Peering Connection options to be set for the VPC that accepts the peering connection (a maximum of one).
    auto_accept bool
    Accept the peering (both VPCs need to be in the same AWS account and region).
    peer_owner_id str
    The AWS account ID of the target peer VPC. Defaults to the account ID the [AWS provider][1] is currently connected to, so must be managed if connecting cross-account.
    peer_region str
    The region of the accepter VPC of the VPC Peering Connection. auto_accept must be false, and use the aws.ec2.VpcPeeringConnectionAccepter to manage the accepter side.
    requester VpcPeeringConnectionRequesterArgs
    A optional configuration block that allows for VPC Peering Connection options to be set for the VPC that requests the peering connection (a maximum of one).
    tags Mapping[str, str]
    A map of tags to assign to the resource. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    peerVpcId String
    The ID of the target VPC with which you are creating the VPC Peering Connection.
    vpcId String
    The ID of the requester VPC.
    accepter Property Map
    An optional configuration block that allows for VPC Peering Connection options to be set for the VPC that accepts the peering connection (a maximum of one).
    autoAccept Boolean
    Accept the peering (both VPCs need to be in the same AWS account and region).
    peerOwnerId String
    The AWS account ID of the target peer VPC. Defaults to the account ID the [AWS provider][1] is currently connected to, so must be managed if connecting cross-account.
    peerRegion String
    The region of the accepter VPC of the VPC Peering Connection. auto_accept must be false, and use the aws.ec2.VpcPeeringConnectionAccepter to manage the accepter side.
    requester Property Map
    A optional configuration block that allows for VPC Peering Connection options to be set for the VPC that requests the peering connection (a maximum of one).
    tags Map<String>
    A map of tags to assign to the resource. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    Outputs

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

    AcceptStatus string
    The status of the VPC Peering Connection request.
    Id string
    The provider-assigned unique ID for this managed resource.
    TagsAll Dictionary<string, string>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    AcceptStatus string
    The status of the VPC Peering Connection request.
    Id string
    The provider-assigned unique ID for this managed resource.
    TagsAll map[string]string
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    acceptStatus String
    The status of the VPC Peering Connection request.
    id String
    The provider-assigned unique ID for this managed resource.
    tagsAll Map<String,String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    acceptStatus string
    The status of the VPC Peering Connection request.
    id string
    The provider-assigned unique ID for this managed resource.
    tagsAll {[key: string]: string}
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    accept_status str
    The status of the VPC Peering Connection request.
    id str
    The provider-assigned unique ID for this managed resource.
    tags_all Mapping[str, str]
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    acceptStatus String
    The status of the VPC Peering Connection request.
    id String
    The provider-assigned unique ID for this managed resource.
    tagsAll Map<String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Look up Existing VpcPeeringConnection Resource

    Get an existing VpcPeeringConnection 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?: VpcPeeringConnectionState, opts?: CustomResourceOptions): VpcPeeringConnection
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            accept_status: Optional[str] = None,
            accepter: Optional[VpcPeeringConnectionAccepterArgs] = None,
            auto_accept: Optional[bool] = None,
            peer_owner_id: Optional[str] = None,
            peer_region: Optional[str] = None,
            peer_vpc_id: Optional[str] = None,
            requester: Optional[VpcPeeringConnectionRequesterArgs] = None,
            tags: Optional[Mapping[str, str]] = None,
            tags_all: Optional[Mapping[str, str]] = None,
            vpc_id: Optional[str] = None) -> VpcPeeringConnection
    func GetVpcPeeringConnection(ctx *Context, name string, id IDInput, state *VpcPeeringConnectionState, opts ...ResourceOption) (*VpcPeeringConnection, error)
    public static VpcPeeringConnection Get(string name, Input<string> id, VpcPeeringConnectionState? state, CustomResourceOptions? opts = null)
    public static VpcPeeringConnection get(String name, Output<String> id, VpcPeeringConnectionState 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:
    AcceptStatus string
    The status of the VPC Peering Connection request.
    Accepter VpcPeeringConnectionAccepter
    An optional configuration block that allows for VPC Peering Connection options to be set for the VPC that accepts the peering connection (a maximum of one).
    AutoAccept bool
    Accept the peering (both VPCs need to be in the same AWS account and region).
    PeerOwnerId string
    The AWS account ID of the target peer VPC. Defaults to the account ID the [AWS provider][1] is currently connected to, so must be managed if connecting cross-account.
    PeerRegion string
    The region of the accepter VPC of the VPC Peering Connection. auto_accept must be false, and use the aws.ec2.VpcPeeringConnectionAccepter to manage the accepter side.
    PeerVpcId string
    The ID of the target VPC with which you are creating the VPC Peering Connection.
    Requester VpcPeeringConnectionRequester
    A optional configuration block that allows for VPC Peering Connection options to be set for the VPC that requests the peering connection (a maximum of one).
    Tags Dictionary<string, string>
    A map of tags to assign to the resource. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    TagsAll Dictionary<string, string>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    VpcId string
    The ID of the requester VPC.
    AcceptStatus string
    The status of the VPC Peering Connection request.
    Accepter VpcPeeringConnectionAccepterTypeArgs
    An optional configuration block that allows for VPC Peering Connection options to be set for the VPC that accepts the peering connection (a maximum of one).
    AutoAccept bool
    Accept the peering (both VPCs need to be in the same AWS account and region).
    PeerOwnerId string
    The AWS account ID of the target peer VPC. Defaults to the account ID the [AWS provider][1] is currently connected to, so must be managed if connecting cross-account.
    PeerRegion string
    The region of the accepter VPC of the VPC Peering Connection. auto_accept must be false, and use the aws.ec2.VpcPeeringConnectionAccepter to manage the accepter side.
    PeerVpcId string
    The ID of the target VPC with which you are creating the VPC Peering Connection.
    Requester VpcPeeringConnectionRequesterArgs
    A optional configuration block that allows for VPC Peering Connection options to be set for the VPC that requests the peering connection (a maximum of one).
    Tags map[string]string
    A map of tags to assign to the resource. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    TagsAll map[string]string
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    VpcId string
    The ID of the requester VPC.
    acceptStatus String
    The status of the VPC Peering Connection request.
    accepter VpcPeeringConnectionAccepter
    An optional configuration block that allows for VPC Peering Connection options to be set for the VPC that accepts the peering connection (a maximum of one).
    autoAccept Boolean
    Accept the peering (both VPCs need to be in the same AWS account and region).
    peerOwnerId String
    The AWS account ID of the target peer VPC. Defaults to the account ID the [AWS provider][1] is currently connected to, so must be managed if connecting cross-account.
    peerRegion String
    The region of the accepter VPC of the VPC Peering Connection. auto_accept must be false, and use the aws.ec2.VpcPeeringConnectionAccepter to manage the accepter side.
    peerVpcId String
    The ID of the target VPC with which you are creating the VPC Peering Connection.
    requester VpcPeeringConnectionRequester
    A optional configuration block that allows for VPC Peering Connection options to be set for the VPC that requests the peering connection (a maximum of one).
    tags Map<String,String>
    A map of tags to assign to the resource. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll Map<String,String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    vpcId String
    The ID of the requester VPC.
    acceptStatus string
    The status of the VPC Peering Connection request.
    accepter VpcPeeringConnectionAccepter
    An optional configuration block that allows for VPC Peering Connection options to be set for the VPC that accepts the peering connection (a maximum of one).
    autoAccept boolean
    Accept the peering (both VPCs need to be in the same AWS account and region).
    peerOwnerId string
    The AWS account ID of the target peer VPC. Defaults to the account ID the [AWS provider][1] is currently connected to, so must be managed if connecting cross-account.
    peerRegion string
    The region of the accepter VPC of the VPC Peering Connection. auto_accept must be false, and use the aws.ec2.VpcPeeringConnectionAccepter to manage the accepter side.
    peerVpcId string
    The ID of the target VPC with which you are creating the VPC Peering Connection.
    requester VpcPeeringConnectionRequester
    A optional configuration block that allows for VPC Peering Connection options to be set for the VPC that requests the peering connection (a maximum of one).
    tags {[key: string]: string}
    A map of tags to assign to the resource. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll {[key: string]: string}
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    vpcId string
    The ID of the requester VPC.
    accept_status str
    The status of the VPC Peering Connection request.
    accepter VpcPeeringConnectionAccepterArgs
    An optional configuration block that allows for VPC Peering Connection options to be set for the VPC that accepts the peering connection (a maximum of one).
    auto_accept bool
    Accept the peering (both VPCs need to be in the same AWS account and region).
    peer_owner_id str
    The AWS account ID of the target peer VPC. Defaults to the account ID the [AWS provider][1] is currently connected to, so must be managed if connecting cross-account.
    peer_region str
    The region of the accepter VPC of the VPC Peering Connection. auto_accept must be false, and use the aws.ec2.VpcPeeringConnectionAccepter to manage the accepter side.
    peer_vpc_id str
    The ID of the target VPC with which you are creating the VPC Peering Connection.
    requester VpcPeeringConnectionRequesterArgs
    A optional configuration block that allows for VPC Peering Connection options to be set for the VPC that requests the peering connection (a maximum of one).
    tags Mapping[str, str]
    A map of tags to assign to the resource. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tags_all Mapping[str, str]
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    vpc_id str
    The ID of the requester VPC.
    acceptStatus String
    The status of the VPC Peering Connection request.
    accepter Property Map
    An optional configuration block that allows for VPC Peering Connection options to be set for the VPC that accepts the peering connection (a maximum of one).
    autoAccept Boolean
    Accept the peering (both VPCs need to be in the same AWS account and region).
    peerOwnerId String
    The AWS account ID of the target peer VPC. Defaults to the account ID the [AWS provider][1] is currently connected to, so must be managed if connecting cross-account.
    peerRegion String
    The region of the accepter VPC of the VPC Peering Connection. auto_accept must be false, and use the aws.ec2.VpcPeeringConnectionAccepter to manage the accepter side.
    peerVpcId String
    The ID of the target VPC with which you are creating the VPC Peering Connection.
    requester Property Map
    A optional configuration block that allows for VPC Peering Connection options to be set for the VPC that requests the peering connection (a maximum of one).
    tags Map<String>
    A map of tags to assign to the resource. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll Map<String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    vpcId String
    The ID of the requester VPC.

    Supporting Types

    VpcPeeringConnectionAccepter, VpcPeeringConnectionAccepterArgs

    VpcPeeringConnectionRequester, VpcPeeringConnectionRequesterArgs

    Import

    Using pulumi import, import VPC Peering resources using the VPC peering id. For example:

    $ pulumi import aws:ec2/vpcPeeringConnection:VpcPeeringConnection test_connection pcx-111aaa111
    

    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