VpcLookupOptions Struct
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.
Example
const vpc = ec2.Vpc.fromLookup(this, 'Vpc', {
isDefault: true,
});
const cluster = new ecs.Cluster(this, 'ECSCluster', { vpc });
const taskDefinition = new ecs.TaskDefinition(this, 'TD', {
compatibility: ecs.Compatibility.EC2,
});
taskDefinition.addContainer('TheContainer', {
image: ecs.ContainerImage.fromRegistry('foo/bar'),
memoryLimitMiB: 256,
});
const runTask = new tasks.EcsRunTask(this, 'Run', {
integrationPattern: sfn.IntegrationPattern.RUN_JOB,
cluster,
taskDefinition,
launchTarget: new tasks.EcsEc2LaunchTarget(),
enableExecuteCommand: true,
});
Properties
isDefaultoptionalbooleanis_defaultoptionalboolisDefaultoptionalBooleanIsDefaultoptionalboolIsDefaultoptional*bool#Default: Don't care whether we return the default VPC
ownerAccountIdoptionalstringowner_account_idoptionalstrownerAccountIdoptionalStringOwnerAccountIdoptionalstringOwnerAccountIdoptional*string#Default: the account id of the parent stack
Default: Current stack's environment region
returnVpnGatewaysoptionalbooleanreturn_vpn_gatewaysoptionalboolreturnVpnGatewaysoptionalBooleanReturnVpnGatewaysoptionalboolReturnVpnGatewaysoptional*bool= true#notes
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.
subnetGroupNameTagoptionalstringsubnet_group_name_tagoptionalstrsubnetGroupNameTagoptionalStringSubnetGroupNameTagoptionalstringSubnetGroupNameTagoptional*string= aws-cdk:subnet-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.
tagsoptional{ [key: string]: string }tagsoptionaltyping.Mapping[str, str]tagsoptionalMap<String, String>TagsoptionalIDictionary<string, string>Tagsoptional*map[string]*string#Default: Don't filter on tags
The VPC must have all of these tags
Default: Don't filter on vpcId
If given, will import exactly this VPC.
vpcNameoptionalstringvpc_nameoptionalstrvpcNameoptionalStringVpcNameoptionalstringVpcNameoptional*string#Default: Don't filter on vpcName
If given, will import the VPC with this name.