Interface VpcLookupOptions

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
VpcLookupOptions.Jsii$Proxy

@Generated(value="jsii-pacmak/1.97.0 (build 729de35)", date="2024-04-18T17:54:16.164Z") @Stability(Stable) public interface VpcLookupOptions extends software.amazon.jsii.JsiiSerializable
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:

 IVpc vpc = Vpc.fromLookup(this, "Vpc", VpcLookupOptions.builder()
         .isDefault(true)
         .build());
 Cluster cluster = Cluster.Builder.create(this, "ECSCluster").vpc(vpc).build();
 TaskDefinition taskDefinition = TaskDefinition.Builder.create(this, "TD")
         .compatibility(Compatibility.EC2)
         .build();
 taskDefinition.addContainer("TheContainer", ContainerDefinitionOptions.builder()
         .image(ContainerImage.fromRegistry("foo/bar"))
         .memoryLimitMiB(256)
         .build());
 EcsRunTask runTask = EcsRunTask.Builder.create(this, "Run")
         .integrationPattern(IntegrationPattern.RUN_JOB)
         .cluster(cluster)
         .taskDefinition(taskDefinition)
         .launchTarget(new EcsEc2LaunchTarget())
         .enableExecuteCommand(true)
         .build();
 
  • Method Details

    • getIsDefault

      @Stability(Stable) @Nullable default Boolean getIsDefault()
      Whether to match the default VPC.

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

    • getOwnerAccountId

      @Stability(Stable) @Nullable default String getOwnerAccountId()
      The ID of the AWS account that owns the VPC.

      Default: the account id of the parent stack

    • getRegion

      @Stability(Stable) @Nullable default String getRegion()
      Optional to override inferred region.

      Default: Current stack's environment region

    • getReturnVpnGateways

      @Stability(Stable) @Nullable default Boolean getReturnVpnGateways()
      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.

      Default: true

    • getSubnetGroupNameTag

      @Stability(Stable) @Nullable default String getSubnetGroupNameTag()
      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

    • getTags

      @Stability(Stable) @Nullable default Map<String,String> getTags()
      Tags on the VPC.

      The VPC must have all of these tags

      Default: Don't filter on tags

    • getVpcId

      @Stability(Stable) @Nullable default String getVpcId()
      The ID of the VPC.

      If given, will import exactly this VPC.

      Default: Don't filter on vpcId

    • getVpcName

      @Stability(Stable) @Nullable default String getVpcName()
      The name of the VPC.

      If given, will import the VPC with this name.

      Default: Don't filter on vpcName

    • builder

      @Stability(Stable) static VpcLookupOptions.Builder builder()
      Returns:
      a VpcLookupOptions.Builder of VpcLookupOptions