VpcLookupOptions

class aws_cdk.aws_ec2.VpcLookupOptions(*, is_default=None, region=None, subnet_group_name_tag=None, tags=None, vpc_id=None, vpc_name=None)

Bases: object

Properties for looking up an existing VPC.

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

Parameters
  • is_default (Optional[bool]) – Whether to match the default VPC. Default: Don’t care whether we return the default VPC

  • region (Optional[str]) – Optional to override inferred region. Default: Current stack’s environment region

  • subnet_group_name_tag (Optional[str]) – Optional tag for subnet group name. 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 (Optional[Mapping[str, str]]) – Tags on the VPC. The VPC must have all of these tags Default: Don’t filter on tags

  • vpc_id (Optional[str]) – The ID of the VPC. If given, will import exactly this VPC. Default: Don’t filter on vpcId

  • vpc_name (Optional[str]) – The name of the VPC. If given, will import the VPC with this name. Default: Don’t filter on vpcName

ExampleMetadata

infused

Example:

# create a cloud9 ec2 environment in a new VPC
vpc = ec2.Vpc(self, "VPC", max_azs=3)
cloud9.Ec2Environment(self, "Cloud9Env", vpc=vpc)

# or create the cloud9 environment in the default VPC with specific instanceType
default_vpc = ec2.Vpc.from_lookup(self, "DefaultVPC", is_default=True)
cloud9.Ec2Environment(self, "Cloud9Env2",
    vpc=default_vpc,
    instance_type=ec2.InstanceType("t3.large")
)

# or specify in a different subnetSelection
c9env = cloud9.Ec2Environment(self, "Cloud9Env3",
    vpc=vpc,
    subnet_selection=ec2.SubnetSelection(
        subnet_type=ec2.SubnetType.PRIVATE_WITH_NAT
    )
)

# print the Cloud9 IDE URL in the output
CfnOutput(self, "URL", value=c9env.ide_url)

Attributes

is_default

Whether to match the default VPC.

Default

Don’t care whether we return the default VPC

Return type

Optional[bool]

region

Optional to override inferred region.

Default

Current stack’s environment region

Return type

Optional[str]

subnet_group_name_tag

Optional tag for subnet group name.

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

Return type

Optional[str]

tags

Tags on the VPC.

The VPC must have all of these tags

Default

Don’t filter on tags

Return type

Optional[Mapping[str, str]]

vpc_id

The ID of the VPC.

If given, will import exactly this VPC.

Default

Don’t filter on vpcId

Return type

Optional[str]

vpc_name

The name of the VPC.

If given, will import the VPC with this name.

Default

Don’t filter on vpcName

Return type

Optional[str]