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

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

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 an association between a VPC endpoint and a subnet.

    NOTE on VPC Endpoints and VPC Endpoint Subnet Associations: This provider provides both a standalone VPC Endpoint Subnet Association (an association between a VPC endpoint and a single subnet_id) and a VPC Endpoint resource with a subnet_ids attribute. Do not use the same subnet ID in both a VPC Endpoint resource and a VPC Endpoint Subnet Association resource. Doing so will cause a conflict of associations and will overwrite the association.

    Example Usage

    Basic usage:

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const snEc2 = new aws.ec2.VpcEndpointSubnetAssociation("sn_ec2", {
        vpcEndpointId: ec2.id,
        subnetId: sn.id,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    sn_ec2 = aws.ec2.VpcEndpointSubnetAssociation("sn_ec2",
        vpc_endpoint_id=ec2["id"],
        subnet_id=sn["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.NewVpcEndpointSubnetAssociation(ctx, "sn_ec2", &ec2.VpcEndpointSubnetAssociationArgs{
    			VpcEndpointId: pulumi.Any(ec2.Id),
    			SubnetId:      pulumi.Any(sn.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 snEc2 = new Aws.Ec2.VpcEndpointSubnetAssociation("sn_ec2", new()
        {
            VpcEndpointId = ec2.Id,
            SubnetId = sn.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ec2.VpcEndpointSubnetAssociation;
    import com.pulumi.aws.ec2.VpcEndpointSubnetAssociationArgs;
    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 snEc2 = new VpcEndpointSubnetAssociation("snEc2", VpcEndpointSubnetAssociationArgs.builder()
                .vpcEndpointId(ec2.id())
                .subnetId(sn.id())
                .build());
    
        }
    }
    
    resources:
      snEc2:
        type: aws:ec2:VpcEndpointSubnetAssociation
        name: sn_ec2
        properties:
          vpcEndpointId: ${ec2.id}
          subnetId: ${sn.id}
    

    Create VpcEndpointSubnetAssociation Resource

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

    Constructor syntax

    new VpcEndpointSubnetAssociation(name: string, args: VpcEndpointSubnetAssociationArgs, opts?: CustomResourceOptions);
    @overload
    def VpcEndpointSubnetAssociation(resource_name: str,
                                     args: VpcEndpointSubnetAssociationArgs,
                                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def VpcEndpointSubnetAssociation(resource_name: str,
                                     opts: Optional[ResourceOptions] = None,
                                     subnet_id: Optional[str] = None,
                                     vpc_endpoint_id: Optional[str] = None)
    func NewVpcEndpointSubnetAssociation(ctx *Context, name string, args VpcEndpointSubnetAssociationArgs, opts ...ResourceOption) (*VpcEndpointSubnetAssociation, error)
    public VpcEndpointSubnetAssociation(string name, VpcEndpointSubnetAssociationArgs args, CustomResourceOptions? opts = null)
    public VpcEndpointSubnetAssociation(String name, VpcEndpointSubnetAssociationArgs args)
    public VpcEndpointSubnetAssociation(String name, VpcEndpointSubnetAssociationArgs args, CustomResourceOptions options)
    
    type: aws:ec2:VpcEndpointSubnetAssociation
    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 VpcEndpointSubnetAssociationArgs
    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 VpcEndpointSubnetAssociationArgs
    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 VpcEndpointSubnetAssociationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args VpcEndpointSubnetAssociationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args VpcEndpointSubnetAssociationArgs
    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 vpcEndpointSubnetAssociationResource = new Aws.Ec2.VpcEndpointSubnetAssociation("vpcEndpointSubnetAssociationResource", new()
    {
        SubnetId = "string",
        VpcEndpointId = "string",
    });
    
    example, err := ec2.NewVpcEndpointSubnetAssociation(ctx, "vpcEndpointSubnetAssociationResource", &ec2.VpcEndpointSubnetAssociationArgs{
    	SubnetId:      pulumi.String("string"),
    	VpcEndpointId: pulumi.String("string"),
    })
    
    var vpcEndpointSubnetAssociationResource = new VpcEndpointSubnetAssociation("vpcEndpointSubnetAssociationResource", VpcEndpointSubnetAssociationArgs.builder()
        .subnetId("string")
        .vpcEndpointId("string")
        .build());
    
    vpc_endpoint_subnet_association_resource = aws.ec2.VpcEndpointSubnetAssociation("vpcEndpointSubnetAssociationResource",
        subnet_id="string",
        vpc_endpoint_id="string")
    
    const vpcEndpointSubnetAssociationResource = new aws.ec2.VpcEndpointSubnetAssociation("vpcEndpointSubnetAssociationResource", {
        subnetId: "string",
        vpcEndpointId: "string",
    });
    
    type: aws:ec2:VpcEndpointSubnetAssociation
    properties:
        subnetId: string
        vpcEndpointId: string
    

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

    SubnetId string
    The ID of the subnet to be associated with the VPC endpoint.
    VpcEndpointId string
    The ID of the VPC endpoint with which the subnet will be associated.
    SubnetId string
    The ID of the subnet to be associated with the VPC endpoint.
    VpcEndpointId string
    The ID of the VPC endpoint with which the subnet will be associated.
    subnetId String
    The ID of the subnet to be associated with the VPC endpoint.
    vpcEndpointId String
    The ID of the VPC endpoint with which the subnet will be associated.
    subnetId string
    The ID of the subnet to be associated with the VPC endpoint.
    vpcEndpointId string
    The ID of the VPC endpoint with which the subnet will be associated.
    subnet_id str
    The ID of the subnet to be associated with the VPC endpoint.
    vpc_endpoint_id str
    The ID of the VPC endpoint with which the subnet will be associated.
    subnetId String
    The ID of the subnet to be associated with the VPC endpoint.
    vpcEndpointId String
    The ID of the VPC endpoint with which the subnet will be associated.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the VpcEndpointSubnetAssociation 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 VpcEndpointSubnetAssociation Resource

    Get an existing VpcEndpointSubnetAssociation 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?: VpcEndpointSubnetAssociationState, opts?: CustomResourceOptions): VpcEndpointSubnetAssociation
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            subnet_id: Optional[str] = None,
            vpc_endpoint_id: Optional[str] = None) -> VpcEndpointSubnetAssociation
    func GetVpcEndpointSubnetAssociation(ctx *Context, name string, id IDInput, state *VpcEndpointSubnetAssociationState, opts ...ResourceOption) (*VpcEndpointSubnetAssociation, error)
    public static VpcEndpointSubnetAssociation Get(string name, Input<string> id, VpcEndpointSubnetAssociationState? state, CustomResourceOptions? opts = null)
    public static VpcEndpointSubnetAssociation get(String name, Output<String> id, VpcEndpointSubnetAssociationState 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:
    SubnetId string
    The ID of the subnet to be associated with the VPC endpoint.
    VpcEndpointId string
    The ID of the VPC endpoint with which the subnet will be associated.
    SubnetId string
    The ID of the subnet to be associated with the VPC endpoint.
    VpcEndpointId string
    The ID of the VPC endpoint with which the subnet will be associated.
    subnetId String
    The ID of the subnet to be associated with the VPC endpoint.
    vpcEndpointId String
    The ID of the VPC endpoint with which the subnet will be associated.
    subnetId string
    The ID of the subnet to be associated with the VPC endpoint.
    vpcEndpointId string
    The ID of the VPC endpoint with which the subnet will be associated.
    subnet_id str
    The ID of the subnet to be associated with the VPC endpoint.
    vpc_endpoint_id str
    The ID of the VPC endpoint with which the subnet will be associated.
    subnetId String
    The ID of the subnet to be associated with the VPC endpoint.
    vpcEndpointId String
    The ID of the VPC endpoint with which the subnet will be associated.

    Import

    Using pulumi import, import VPC Endpoint Subnet Associations using vpc_endpoint_id together with subnet_id. For example:

    $ pulumi import aws:ec2/vpcEndpointSubnetAssociation:VpcEndpointSubnetAssociation example vpce-aaaaaaaa/subnet-bbbbbbbbbbbbbbbbb
    

    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