interface VpcLookupOptions
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.EC2.VpcLookupOptions |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsec2#VpcLookupOptions |
![]() | software.amazon.awscdk.services.ec2.VpcLookupOptions |
![]() | aws_cdk.aws_ec2.VpcLookupOptions |
![]() | aws-cdk-lib » aws_ec2 » VpcLookupOptions |
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
Name | Type | Description |
---|---|---|
is | boolean | Whether to match the default VPC. |
owner | string | The ID of the AWS account that owns the VPC. |
region? | string | Optional to override inferred region. |
return | boolean | Whether to look up whether a VPN Gateway is attached to the looked up VPC. |
subnet | string | Optional tag for subnet group name. |
tags? | { [string]: string } | Tags on the VPC. |
vpc | string | The ID of the VPC. |
vpc | string | The name of the VPC. |
isDefault?
Type:
boolean
(optional, default: Don't care whether we return the default VPC)
Whether to match the default VPC.
ownerAccountId?
Type:
string
(optional, default: the account id of the parent stack)
The ID of the AWS account that owns the VPC.
region?
Type:
string
(optional, default: Current stack's environment region)
Optional to override inferred region.
returnVpnGateways?
Type:
boolean
(optional, default: true)
Whether to look up whether a VPN Gateway is attached to the looked up VPC.
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.
subnetGroupNameTag?
Type:
string
(optional, default: aws-cdk:subnet-name)
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.
tags?
Type:
{ [string]: string }
(optional, default: Don't filter on tags)
Tags on the VPC.
The VPC must have all of these tags
vpcId?
Type:
string
(optional, default: Don't filter on vpcId)
The ID of the VPC.
If given, will import exactly this VPC.
vpcName?
Type:
string
(optional, default: Don't filter on vpcName)
The name of the VPC.
If given, will import the VPC with this name.