1. Packages
  2. AWS
  3. API Docs
  4. ec2clientvpn
  5. NetworkAssociation
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.ec2clientvpn.NetworkAssociation

Explore with Pulumi AI

Provides network associations for AWS Client VPN endpoints. For more information on usage, please see the AWS Client VPN Administrator’s Guide.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.ec2clientvpn.NetworkAssociation("example", {
    clientVpnEndpointId: exampleAwsEc2ClientVpnEndpoint.id,
    subnetId: exampleAwsSubnet.id,
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.ec2clientvpn.NetworkAssociation("example",
    client_vpn_endpoint_id=example_aws_ec2_client_vpn_endpoint["id"],
    subnet_id=example_aws_subnet["id"])
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2clientvpn"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2clientvpn.NewNetworkAssociation(ctx, "example", &ec2clientvpn.NetworkAssociationArgs{
			ClientVpnEndpointId: pulumi.Any(exampleAwsEc2ClientVpnEndpoint.Id),
			SubnetId:            pulumi.Any(exampleAwsSubnet.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.Ec2ClientVpn.NetworkAssociation("example", new()
    {
        ClientVpnEndpointId = exampleAwsEc2ClientVpnEndpoint.Id,
        SubnetId = exampleAwsSubnet.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2clientvpn.NetworkAssociation;
import com.pulumi.aws.ec2clientvpn.NetworkAssociationArgs;
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 example = new NetworkAssociation("example", NetworkAssociationArgs.builder()
            .clientVpnEndpointId(exampleAwsEc2ClientVpnEndpoint.id())
            .subnetId(exampleAwsSubnet.id())
            .build());

    }
}
Copy
resources:
  example:
    type: aws:ec2clientvpn:NetworkAssociation
    properties:
      clientVpnEndpointId: ${exampleAwsEc2ClientVpnEndpoint.id}
      subnetId: ${exampleAwsSubnet.id}
Copy

Create NetworkAssociation Resource

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

Constructor syntax

new NetworkAssociation(name: string, args: NetworkAssociationArgs, opts?: CustomResourceOptions);
@overload
def NetworkAssociation(resource_name: str,
                       args: NetworkAssociationArgs,
                       opts: Optional[ResourceOptions] = None)

@overload
def NetworkAssociation(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       client_vpn_endpoint_id: Optional[str] = None,
                       subnet_id: Optional[str] = None)
func NewNetworkAssociation(ctx *Context, name string, args NetworkAssociationArgs, opts ...ResourceOption) (*NetworkAssociation, error)
public NetworkAssociation(string name, NetworkAssociationArgs args, CustomResourceOptions? opts = null)
public NetworkAssociation(String name, NetworkAssociationArgs args)
public NetworkAssociation(String name, NetworkAssociationArgs args, CustomResourceOptions options)
type: aws:ec2clientvpn:NetworkAssociation
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. NetworkAssociationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. NetworkAssociationArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. NetworkAssociationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. NetworkAssociationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. NetworkAssociationArgs
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 networkAssociationResource = new Aws.Ec2ClientVpn.NetworkAssociation("networkAssociationResource", new()
{
    ClientVpnEndpointId = "string",
    SubnetId = "string",
});
Copy
example, err := ec2clientvpn.NewNetworkAssociation(ctx, "networkAssociationResource", &ec2clientvpn.NetworkAssociationArgs{
	ClientVpnEndpointId: pulumi.String("string"),
	SubnetId:            pulumi.String("string"),
})
Copy
var networkAssociationResource = new NetworkAssociation("networkAssociationResource", NetworkAssociationArgs.builder()
    .clientVpnEndpointId("string")
    .subnetId("string")
    .build());
Copy
network_association_resource = aws.ec2clientvpn.NetworkAssociation("networkAssociationResource",
    client_vpn_endpoint_id="string",
    subnet_id="string")
Copy
const networkAssociationResource = new aws.ec2clientvpn.NetworkAssociation("networkAssociationResource", {
    clientVpnEndpointId: "string",
    subnetId: "string",
});
Copy
type: aws:ec2clientvpn:NetworkAssociation
properties:
    clientVpnEndpointId: string
    subnetId: string
Copy

NetworkAssociation Resource Properties

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

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The NetworkAssociation resource accepts the following input properties:

ClientVpnEndpointId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Client VPN endpoint.
SubnetId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the subnet to associate with the Client VPN endpoint.
ClientVpnEndpointId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Client VPN endpoint.
SubnetId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the subnet to associate with the Client VPN endpoint.
clientVpnEndpointId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Client VPN endpoint.
subnetId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the subnet to associate with the Client VPN endpoint.
clientVpnEndpointId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Client VPN endpoint.
subnetId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the subnet to associate with the Client VPN endpoint.
client_vpn_endpoint_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the Client VPN endpoint.
subnet_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the subnet to associate with the Client VPN endpoint.
clientVpnEndpointId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Client VPN endpoint.
subnetId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the subnet to associate with the Client VPN endpoint.

Outputs

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

AssociationId string
The unique ID of the target network association.
Id string
The provider-assigned unique ID for this managed resource.
VpcId string
The ID of the VPC in which the target subnet is located.
AssociationId string
The unique ID of the target network association.
Id string
The provider-assigned unique ID for this managed resource.
VpcId string
The ID of the VPC in which the target subnet is located.
associationId String
The unique ID of the target network association.
id String
The provider-assigned unique ID for this managed resource.
vpcId String
The ID of the VPC in which the target subnet is located.
associationId string
The unique ID of the target network association.
id string
The provider-assigned unique ID for this managed resource.
vpcId string
The ID of the VPC in which the target subnet is located.
association_id str
The unique ID of the target network association.
id str
The provider-assigned unique ID for this managed resource.
vpc_id str
The ID of the VPC in which the target subnet is located.
associationId String
The unique ID of the target network association.
id String
The provider-assigned unique ID for this managed resource.
vpcId String
The ID of the VPC in which the target subnet is located.

Look up Existing NetworkAssociation Resource

Get an existing NetworkAssociation 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?: NetworkAssociationState, opts?: CustomResourceOptions): NetworkAssociation
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        association_id: Optional[str] = None,
        client_vpn_endpoint_id: Optional[str] = None,
        subnet_id: Optional[str] = None,
        vpc_id: Optional[str] = None) -> NetworkAssociation
func GetNetworkAssociation(ctx *Context, name string, id IDInput, state *NetworkAssociationState, opts ...ResourceOption) (*NetworkAssociation, error)
public static NetworkAssociation Get(string name, Input<string> id, NetworkAssociationState? state, CustomResourceOptions? opts = null)
public static NetworkAssociation get(String name, Output<String> id, NetworkAssociationState state, CustomResourceOptions options)
resources:  _:    type: aws:ec2clientvpn:NetworkAssociation    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
AssociationId string
The unique ID of the target network association.
ClientVpnEndpointId Changes to this property will trigger replacement. string
The ID of the Client VPN endpoint.
SubnetId Changes to this property will trigger replacement. string
The ID of the subnet to associate with the Client VPN endpoint.
VpcId string
The ID of the VPC in which the target subnet is located.
AssociationId string
The unique ID of the target network association.
ClientVpnEndpointId Changes to this property will trigger replacement. string
The ID of the Client VPN endpoint.
SubnetId Changes to this property will trigger replacement. string
The ID of the subnet to associate with the Client VPN endpoint.
VpcId string
The ID of the VPC in which the target subnet is located.
associationId String
The unique ID of the target network association.
clientVpnEndpointId Changes to this property will trigger replacement. String
The ID of the Client VPN endpoint.
subnetId Changes to this property will trigger replacement. String
The ID of the subnet to associate with the Client VPN endpoint.
vpcId String
The ID of the VPC in which the target subnet is located.
associationId string
The unique ID of the target network association.
clientVpnEndpointId Changes to this property will trigger replacement. string
The ID of the Client VPN endpoint.
subnetId Changes to this property will trigger replacement. string
The ID of the subnet to associate with the Client VPN endpoint.
vpcId string
The ID of the VPC in which the target subnet is located.
association_id str
The unique ID of the target network association.
client_vpn_endpoint_id Changes to this property will trigger replacement. str
The ID of the Client VPN endpoint.
subnet_id Changes to this property will trigger replacement. str
The ID of the subnet to associate with the Client VPN endpoint.
vpc_id str
The ID of the VPC in which the target subnet is located.
associationId String
The unique ID of the target network association.
clientVpnEndpointId Changes to this property will trigger replacement. String
The ID of the Client VPN endpoint.
subnetId Changes to this property will trigger replacement. String
The ID of the subnet to associate with the Client VPN endpoint.
vpcId String
The ID of the VPC in which the target subnet is located.

Import

Using pulumi import, import AWS Client VPN network associations using the endpoint ID and the association ID. Values are separated by a ,. For example:

$ pulumi import aws:ec2clientvpn/networkAssociation:NetworkAssociation example cvpn-endpoint-0ac3a1abbccddd666,cvpn-assoc-0b8db902465d069ad
Copy

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.