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.
virtual Nullable<bool> IsDefault { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: Don't care whether we return the default VPC
OwnerAccountId
The ID of the AWS account that owns the VPC.
virtual string OwnerAccountId { get; }
Property Value
System.String
Remarks
Default: the account id of the parent stack
Region
Optional to override inferred region.
virtual string Region { get; }
Property Value
System.String
Remarks
Default: Current stack's environment region
ReturnVpnGateways
Whether to look up whether a VPN Gateway is attached to the looked up VPC.
virtual Nullable<bool> ReturnVpnGateways { get; }
Property Value
System.Nullable<System.Boolean>
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.
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