Class PublicSubnet
Represents a public VPC subnet resource.
Inherited Members
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class PublicSubnet : Subnet, IPublicSubnet, ISubnet, IResource, ISubnetRef, IConstruct, IDependable, IEnvironmentAware
Syntax (vb)
Public Class PublicSubnet Inherits Subnet Implements IPublicSubnet, ISubnet, IResource, ISubnetRef, IConstruct, IDependable, IEnvironmentAware
Remarks
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;
var publicSubnet = new PublicSubnet(this, "MyPublicSubnet", new PublicSubnetProps {
AvailabilityZone = "availabilityZone",
CidrBlock = "cidrBlock",
VpcId = "vpcId",
// the properties below are optional
AssignIpv6AddressOnCreation = false,
Ipv6CidrBlock = "ipv6CidrBlock",
MapPublicIpOnLaunch = false
});
Synopsis
Constructors
| PublicSubnet(Construct, string, IPublicSubnetProps) | Represents a public VPC subnet resource. |
Properties
| PROPERTY_INJECTION_ID | Uniquely identifies this class. |
Methods
| AddNatGateway(string?) | Creates a new managed NAT gateway attached to this public subnet. |
| FromPublicSubnetAttributes(Construct, string, IPublicSubnetAttributes) | Represents a public VPC subnet resource. |
Constructors
PublicSubnet(Construct, string, IPublicSubnetProps)
Represents a public VPC subnet resource.
public PublicSubnet(Construct scope, string id, IPublicSubnetProps props)
Parameters
- scope Construct
- id string
- props IPublicSubnetProps
Remarks
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;
var publicSubnet = new PublicSubnet(this, "MyPublicSubnet", new PublicSubnetProps {
AvailabilityZone = "availabilityZone",
CidrBlock = "cidrBlock",
VpcId = "vpcId",
// the properties below are optional
AssignIpv6AddressOnCreation = false,
Ipv6CidrBlock = "ipv6CidrBlock",
MapPublicIpOnLaunch = false
});
Properties
PROPERTY_INJECTION_ID
Uniquely identifies this class.
public static string PROPERTY_INJECTION_ID { get; }
Property Value
Remarks
ExampleMetadata: fixture=_generated
Methods
AddNatGateway(string?)
Creates a new managed NAT gateway attached to this public subnet.
public virtual CfnNatGateway AddNatGateway(string? eipAllocationId = null)
Parameters
- eipAllocationId string
Returns
A ref to the the NAT Gateway ID
Remarks
Also adds the EIP for the managed NAT.
FromPublicSubnetAttributes(Construct, string, IPublicSubnetAttributes)
Represents a public VPC subnet resource.
public static IPublicSubnet FromPublicSubnetAttributes(Construct scope, string id, IPublicSubnetAttributes attrs)
Parameters
- scope Construct
- id string
- attrs IPublicSubnetAttributes
Returns
Remarks
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;
var publicSubnet = new PublicSubnet(this, "MyPublicSubnet", new PublicSubnetProps {
AvailabilityZone = "availabilityZone",
CidrBlock = "cidrBlock",
VpcId = "vpcId",
// the properties below are optional
AssignIpv6AddressOnCreation = false,
Ipv6CidrBlock = "ipv6CidrBlock",
MapPublicIpOnLaunch = false
});
Implements
Constructs.IConstruct
Constructs.IDependable