Class CfnSubnet
A CloudFormation AWS::EC2::Subnet
.
Inherited Members
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.AWS.EC2.dll
Syntax (csharp)
public class CfnSubnet : CfnResource, IConstruct, IDependable, IInspectable
Syntax (vb)
Public Class CfnSubnet
Inherits CfnResource
Implements IConstruct, IDependable, IInspectable
Remarks
Specifies a subnet for the specified VPC.
For an IPv4 only subnet, specify an IPv4 CIDR block. If the VPC has an IPv6 CIDR block, you can create an IPv6 only subnet or a dual stack subnet instead. For an IPv6 only subnet, specify an IPv6 CIDR block. For a dual stack subnet, specify both an IPv4 CIDR block and an IPv6 CIDR block.
For more information, see Subnets for your VPC in the Amazon VPC User Guide .
CloudformationResource: AWS::EC2::Subnet
Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html
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 privateDnsNameOptionsOnLaunch;
var cfnSubnet = new CfnSubnet(this, "MyCfnSubnet", new CfnSubnetProps {
VpcId = "vpcId",
// the properties below are optional
AssignIpv6AddressOnCreation = false,
AvailabilityZone = "availabilityZone",
AvailabilityZoneId = "availabilityZoneId",
CidrBlock = "cidrBlock",
EnableDns64 = false,
Ipv6CidrBlock = "ipv6CidrBlock",
Ipv6Native = false,
MapPublicIpOnLaunch = false,
OutpostArn = "outpostArn",
PrivateDnsNameOptionsOnLaunch = privateDnsNameOptionsOnLaunch,
Tags = new [] { new CfnTag {
Key = "key",
Value = "value"
} }
});
Synopsis
Constructors
CfnSubnet(Construct, String, ICfnSubnetProps) | Create a new |
CfnSubnet(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CfnSubnet(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
AssignIpv6AddressOnCreation | Indicates whether a network interface created in this subnet receives an IPv6 address. The default value is |
AttrAvailabilityZone | The Availability Zone of this subnet. For example:. |
AttrIpv6CidrBlocks | The IPv6 CIDR blocks that are associated with the subnet, such as |
AttrNetworkAclAssociationId | The ID of the network ACL that is associated with the subnet's VPC, such as |
AttrOutpostArn | The Amazon Resource Name (ARN) of the Outpost. |
AttrSubnetId | The ID of the subnet. |
AttrVpcId | The ID of the subnet's VPC, such as |
AvailabilityZone | The Availability Zone of the subnet. |
AvailabilityZoneId | The AZ ID of the subnet. |
CFN_RESOURCE_TYPE_NAME | The CloudFormation resource type name for this resource class. |
CfnProperties | |
CidrBlock | The IPv4 CIDR block assigned to the subnet. |
EnableDns64 | Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. |
Ipv6CidrBlock | The IPv6 CIDR block. |
Ipv6Native | Indicates whether this is an IPv6 only subnet. |
MapPublicIpOnLaunch | Indicates whether instances launched in this subnet receive a public IPv4 address. |
OutpostArn | The Amazon Resource Name (ARN) of the Outpost. |
PrivateDnsNameOptionsOnLaunch | The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries to the instances should be handled. |
Tags | Any tags assigned to the subnet. |
VpcId | The ID of the VPC the subnet is in. |
Methods
Inspect(TreeInspector) | Examines the CloudFormation resource and discloses attributes. |
RenderProperties(IDictionary<String, Object>) |
Constructors
CfnSubnet(Construct, String, ICfnSubnetProps)
Create a new AWS::EC2::Subnet
.
public CfnSubnet(Construct scope, string id, ICfnSubnetProps props)
Parameters
- scope Construct
- scope in which this resource is defined.
- id System.String
- scoped id of the resource.
- props ICfnSubnetProps
- resource properties.
CfnSubnet(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CfnSubnet(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CfnSubnet(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CfnSubnet(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
AssignIpv6AddressOnCreation
Indicates whether a network interface created in this subnet receives an IPv6 address. The default value is false
.
public virtual object AssignIpv6AddressOnCreation { get; set; }
Property Value
System.Object
Remarks
If you specify AssignIpv6AddressOnCreation
, you must also specify Ipv6CidrBlock
.
AttrAvailabilityZone
The Availability Zone of this subnet. For example:.
public virtual string AttrAvailabilityZone { get; }
Property Value
System.String
Remarks
{ "Fn::GetAtt" : [ "mySubnet", "AvailabilityZone" ] }
CloudformationAttribute: AvailabilityZone
AttrIpv6CidrBlocks
The IPv6 CIDR blocks that are associated with the subnet, such as [ 2001:db8:1234:1a00::/64 ]
.
public virtual string[] AttrIpv6CidrBlocks { get; }
Property Value
System.String[]
Remarks
CloudformationAttribute: Ipv6CidrBlocks
AttrNetworkAclAssociationId
The ID of the network ACL that is associated with the subnet's VPC, such as acl-5fb85d36
.
public virtual string AttrNetworkAclAssociationId { get; }
Property Value
System.String
Remarks
CloudformationAttribute: NetworkAclAssociationId
AttrOutpostArn
The Amazon Resource Name (ARN) of the Outpost.
public virtual string AttrOutpostArn { get; }
Property Value
System.String
Remarks
CloudformationAttribute: OutpostArn
AttrSubnetId
The ID of the subnet.
public virtual string AttrSubnetId { get; }
Property Value
System.String
Remarks
CloudformationAttribute: SubnetId
AttrVpcId
The ID of the subnet's VPC, such as vpc-11ad4878
.
public virtual string AttrVpcId { get; }
Property Value
System.String
Remarks
CloudformationAttribute: VpcId
AvailabilityZone
The Availability Zone of the subnet.
public virtual string AvailabilityZone { get; set; }
Property Value
System.String
Remarks
If you update this property, you must also update the CidrBlock
property.
AvailabilityZoneId
The AZ ID of the subnet.
public virtual string AvailabilityZoneId { get; set; }
Property Value
System.String
Remarks
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
public static string CFN_RESOURCE_TYPE_NAME { get; }
Property Value
System.String
CfnProperties
protected override IDictionary<string, object> CfnProperties { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.Object>
Overrides
CidrBlock
The IPv4 CIDR block assigned to the subnet.
public virtual string CidrBlock { get; set; }
Property Value
System.String
Remarks
If you update this property, we create a new subnet, and then delete the existing one.
EnableDns64
Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations.
public virtual object EnableDns64 { get; set; }
Property Value
System.Object
Remarks
For more information, see DNS64 and NAT64 in the Amazon Virtual Private Cloud User Guide .
Ipv6CidrBlock
The IPv6 CIDR block.
public virtual string Ipv6CidrBlock { get; set; }
Property Value
System.String
Remarks
If you specify AssignIpv6AddressOnCreation
, you must also specify Ipv6CidrBlock
.
Ipv6Native
Indicates whether this is an IPv6 only subnet.
public virtual object Ipv6Native { get; set; }
Property Value
System.Object
Remarks
For more information, see Subnet basics in the Amazon Virtual Private Cloud User Guide .
MapPublicIpOnLaunch
Indicates whether instances launched in this subnet receive a public IPv4 address.
public virtual object MapPublicIpOnLaunch { get; set; }
Property Value
System.Object
Remarks
The default value is false
.
OutpostArn
The Amazon Resource Name (ARN) of the Outpost.
public virtual string OutpostArn { get; set; }
Property Value
System.String
Remarks
PrivateDnsNameOptionsOnLaunch
The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries to the instances should be handled.
public virtual object PrivateDnsNameOptionsOnLaunch { get; set; }
Property Value
System.Object
Remarks
For more information, see Amazon EC2 instance hostname types in the Amazon Elastic Compute Cloud User Guide .
Available options:
Tags
Any tags assigned to the subnet.
public virtual TagManager Tags { get; }
Property Value
Remarks
VpcId
The ID of the VPC the subnet is in.
public virtual string VpcId { get; set; }
Property Value
System.String
Remarks
If you update this property, you must also update the CidrBlock
property.
Methods
Inspect(TreeInspector)
Examines the CloudFormation resource and discloses attributes.
public virtual void Inspect(TreeInspector inspector)
Parameters
- inspector TreeInspector
- tree inspector to collect and process attributes.
RenderProperties(IDictionary<String, Object>)
protected override IDictionary<string, object> RenderProperties(IDictionary<string, object> props)
Parameters
- props System.Collections.Generic.IDictionary<System.String, System.Object>
Returns
System.Collections.Generic.IDictionary<System.String, System.Object>