@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:38.498Z") @Stability(value=Stable) public class Subnet extends Resource implements ISubnet
Example:
Cluster cluster;
ApplicationLoadBalancedFargateService loadBalancedFargateService = ApplicationLoadBalancedFargateService.Builder.create(this, "Service")
.cluster(cluster)
.memoryLimitMiB(1024)
.desiredCount(1)
.cpu(512)
.taskImageOptions(ApplicationLoadBalancedTaskImageOptions.builder()
.image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample"))
.build())
.taskSubnets(SubnetSelection.builder()
.subnets(List.of(Subnet.fromSubnetId(this, "subnet", "VpcISOLATEDSubnet1Subnet80F07FA0")))
.build())
.build();
| Modifier and Type | Class and Description |
|---|---|
static class |
Subnet.Builder
A fluent builder for
Subnet. |
software.amazon.jsii.JsiiObject.InitializationModeISubnet.Jsii$Default, ISubnet.Jsii$Proxy| Modifier | Constructor and Description |
|---|---|
|
Subnet(software.constructs.Construct scope,
String id,
SubnetProps props) |
protected |
Subnet(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Subnet(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
void |
addDefaultInternetRoute(String gatewayId,
software.constructs.IDependable gatewayAttachment)
Create a default route that points to a passed IGW, with a dependency on the IGW's attachment to the VPC.
|
void |
addDefaultNatRoute(String natGatewayId)
Adds an entry to this subnets route table that points to the passed NATGatewayId.
|
void |
addRoute(String id,
AddRouteOptions options)
Adds an entry to this subnets route table.
|
void |
associateNetworkAcl(String id,
INetworkAcl networkAcl)
Associate a Network ACL with this subnet.
|
static ISubnet |
fromSubnetAttributes(software.constructs.Construct scope,
String id,
SubnetAttributes attrs) |
static ISubnet |
fromSubnetId(software.constructs.Construct scope,
String id,
String subnetId)
Import existing subnet from id.
|
String |
getAvailabilityZone()
The Availability Zone the subnet is located in.
|
List<software.constructs.IDependable> |
getDependencyElements()
Parts of this VPC subnet.
|
software.constructs.IDependable |
getInternetConnectivityEstablished()
Dependable that can be depended upon to force internet connectivity established on the VPC.
|
String |
getIpv4CidrBlock()
The IPv4 CIDR block for this subnet.
|
INetworkAcl |
getNetworkAcl()
Network ACL associated with this Subnet.
|
IRouteTable |
getRouteTable()
The routeTableId attached to this subnet.
|
String |
getSubnetAvailabilityZone() |
String |
getSubnetId()
The subnetId for this particular subnet.
|
List<String> |
getSubnetIpv6CidrBlocks() |
String |
getSubnetNetworkAclAssociationId() |
String |
getSubnetOutpostArn()
The Amazon Resource Name (ARN) of the Outpost for this subnet (if one exists).
|
String |
getSubnetVpcId() |
static Boolean |
isVpcSubnet(Object x) |
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourcejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitapplyRemovalPolicy, getEnv, getStackprotected Subnet(software.amazon.jsii.JsiiObjectRef objRef)
protected Subnet(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public Subnet(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
SubnetProps props)
scope - This parameter is required.id - This parameter is required.props - This parameter is required.@Stability(value=Stable) @NotNull public static ISubnet fromSubnetAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull SubnetAttributes attrs)
scope - This parameter is required.id - This parameter is required.attrs - This parameter is required.@Stability(value=Stable) @NotNull public static ISubnet fromSubnetId(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String subnetId)
scope - This parameter is required.id - This parameter is required.subnetId - This parameter is required.@Stability(value=Stable) @NotNull public static Boolean isVpcSubnet(@NotNull Object x)
x - This parameter is required.@Stability(value=Stable)
public void addDefaultInternetRoute(@NotNull
String gatewayId,
@NotNull
software.constructs.IDependable gatewayAttachment)
gatewayId - the logical ID (ref) of the gateway attached to your VPC. This parameter is required.gatewayAttachment - the gateway attachment construct to be added as a dependency. This parameter is required.@Stability(value=Stable)
public void addDefaultNatRoute(@NotNull
String natGatewayId)
natGatewayId - The ID of the NAT gateway. This parameter is required.@Stability(value=Stable)
public void addRoute(@NotNull
String id,
@NotNull
AddRouteOptions options)
id - This parameter is required.options - This parameter is required.@Stability(value=Stable)
public void associateNetworkAcl(@NotNull
String id,
@NotNull
INetworkAcl networkAcl)
associateNetworkAcl in interface ISubnetid - This parameter is required.networkAcl - This parameter is required.@Stability(value=Stable) @NotNull public String getAvailabilityZone()
getAvailabilityZone in interface ISubnet@Stability(value=Stable) @NotNull public List<software.constructs.IDependable> getDependencyElements()
@Stability(value=Stable) @NotNull public software.constructs.IDependable getInternetConnectivityEstablished()
getInternetConnectivityEstablished in interface ISubnet@Stability(value=Stable) @NotNull public String getIpv4CidrBlock()
getIpv4CidrBlock in interface ISubnet@Stability(value=Stable) @NotNull public INetworkAcl getNetworkAcl()
Upon creation, this is the default ACL which allows all traffic, except explicit DENY entries that you add.
You can replace it with a custom ACL which denies all traffic except
the explicit ALLOW entries that you add by creating a NetworkAcl
object and calling associateNetworkAcl().
@Stability(value=Stable) @NotNull public IRouteTable getRouteTable()
getRouteTable in interface ISubnet@Stability(value=Stable) @NotNull public String getSubnetAvailabilityZone()
@Stability(value=Stable) @NotNull public String getSubnetId()
getSubnetId in interface ISubnet@Stability(value=Stable) @NotNull public List<String> getSubnetIpv6CidrBlocks()
@Stability(value=Stable) @NotNull public String getSubnetNetworkAclAssociationId()
@Stability(value=Stable) @NotNull public String getSubnetOutpostArn()
@Stability(value=Stable) @NotNull public String getSubnetVpcId()
Copyright © 2022. All rights reserved.