Show / Hide Table of Contents

Interface IVpcLookupOptions

Properties for looking up an existing VPC.

Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IVpcLookupOptions
Syntax (vb)
Public Interface IVpcLookupOptions
Remarks

The combination of properties must specify filter down to exactly one non-default VPC, otherwise an error is raised.

ExampleMetadata: infused

Examples
var vpc = Vpc.FromLookup(this, "Vpc", new VpcLookupOptions {
                 IsDefault = true
             });
             var cluster = new Cluster(this, "ECSCluster", new ClusterProps { Vpc = vpc });

             var taskDefinition = new TaskDefinition(this, "TD", new TaskDefinitionProps {
                 Compatibility = Compatibility.EC2
             });

             taskDefinition.AddContainer("TheContainer", new ContainerDefinitionOptions {
                 Image = ContainerImage.FromRegistry("foo/bar"),
                 MemoryLimitMiB = 256
             });

             var runTask = new EcsRunTask(this, "Run", new EcsRunTaskProps {
                 IntegrationPattern = IntegrationPattern.RUN_JOB,
                 Cluster = cluster,
                 TaskDefinition = taskDefinition,
                 LaunchTarget = new EcsEc2LaunchTarget(),
                 EnableExecuteCommand = true
             });

Synopsis

Properties

IsDefault

Whether to match the default VPC.

OwnerAccountId

The ID of the AWS account that owns the VPC.

Region

Optional to override inferred region.

ReturnVpnGateways

Whether to look up whether a VPN Gateway is attached to the looked up VPC.

SubnetGroupNameTag

Optional tag for subnet group name.

Tags

Tags on the VPC.

VpcId

The ID of the VPC.

VpcName

The name of the VPC.

Properties

IsDefault

Whether to match the default VPC.

bool? IsDefault { get; }
Property Value

bool?

Remarks

Default: Don't care whether we return the default VPC

OwnerAccountId

The ID of the AWS account that owns the VPC.

string? OwnerAccountId { get; }
Property Value

string

Remarks

Default: the account id of the parent stack

Region

Optional to override inferred region.

string? Region { get; }
Property Value

string

Remarks

Default: Current stack's environment region

ReturnVpnGateways

Whether to look up whether a VPN Gateway is attached to the looked up VPC.

bool? ReturnVpnGateways { get; }
Property Value

bool?

Remarks

You can set this to false if you know the VPC does not have a VPN Gateway attached, in order to avoid an API call.

If you change this property from false to true or undefined, you may need to clear the corresponding context entry in cdk.context.json in order to trigger a new lookup.

Default: true

SubnetGroupNameTag

Optional tag for subnet group name.

string? SubnetGroupNameTag { get; }
Property Value

string

Remarks

If not provided, we'll look at the aws-cdk:subnet-name tag. If the subnet does not have the specified tag, we'll use its type as the name.

Default: aws-cdk:subnet-name

Tags

Tags on the VPC.

IDictionary<string, string>? Tags { get; }
Property Value

IDictionary<string, string>

Remarks

The VPC must have all of these tags

Default: Don't filter on tags

VpcId

The ID of the VPC.

string? VpcId { get; }
Property Value

string

Remarks

If given, will import exactly this VPC.

Default: Don't filter on vpcId

VpcName

The name of the VPC.

string? VpcName { get; }
Property Value

string

Remarks

If given, will import the VPC with this name.

Default: Don't filter on vpcName

Back to top Generated by DocFX