Show / Hide Table of Contents

Interface IVpcLookupOptions

Properties for looking up an existing VPC.

Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.AWS.EC2.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
// create a cloud9 ec2 environment in a new VPC
Vpc vpc = new Vpc(this, "VPC", new VpcProps { MaxAzs = 3 });
new Ec2Environment(this, "Cloud9Env", new Ec2EnvironmentProps { Vpc = vpc });

// or create the cloud9 environment in the default VPC with specific instanceType
IVpc defaultVpc = Vpc.FromLookup(this, "DefaultVPC", new VpcLookupOptions { IsDefault = true });
new Ec2Environment(this, "Cloud9Env2", new Ec2EnvironmentProps {
    Vpc = defaultVpc,
    InstanceType = new InstanceType("t3.large")
});

// or specify in a different subnetSelection
Ec2Environment c9env = new Ec2Environment(this, "Cloud9Env3", new Ec2EnvironmentProps {
    Vpc = vpc,
    SubnetSelection = new SubnetSelection {
        SubnetType = SubnetType.PRIVATE_WITH_NAT
    }
});

// print the Cloud9 IDE URL in the output
// print the Cloud9 IDE URL in the output
new CfnOutput(this, "URL", new CfnOutputProps { Value = c9env.IdeUrl });

Synopsis

Properties

IsDefault

Whether to match the default VPC.

Region

Optional to override inferred region.

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.

virtual Nullable<bool> IsDefault { get; }
Property Value

System.Nullable<System.Boolean>

Remarks

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

Region

Optional to override inferred region.

virtual string Region { get; }
Property Value

System.String

Remarks

Default: Current stack's environment region

SubnetGroupNameTag

Optional tag for subnet group name.

virtual string SubnetGroupNameTag { get; }
Property Value

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

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

System.Collections.Generic.IDictionary<System.String, System.String>

Remarks

The VPC must have all of these tags

Default: Don't filter on tags

VpcId

The ID of the VPC.

virtual string VpcId { get; }
Property Value

System.String

Remarks

If given, will import exactly this VPC.

Default: Don't filter on vpcId

VpcName

The name of the VPC.

virtual string VpcName { get; }
Property Value

System.String

Remarks

If given, will import the VPC with this name.

Default: Don't filter on vpcName

Back to top Generated by DocFX