AWS SDK Version 4 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Container for the parameters to the CreateSecondarySubnet operation. Creates a secondary subnet in a secondary network.

A secondary subnet CIDR block must not overlap with the CIDR block of an existing secondary subnet in the secondary network. After you create a secondary subnet, you can't change its CIDR block.

The allowed size for a secondary subnet CIDR block is between /28 netmask (16 IP addresses) and /12 netmask (1,048,576 IP addresses). Amazon reserves the first four IP addresses and the last IP address in each secondary subnet for internal use.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.EC2.AmazonEC2Request
      Amazon.EC2.Model.CreateSecondarySubnetRequest

Namespace: Amazon.EC2.Model
Assembly: AWSSDK.EC2.dll
Version: 3.x.y.z

Syntax

C#
public class CreateSecondarySubnetRequest : AmazonEC2Request
         IAmazonWebServiceRequest

The CreateSecondarySubnetRequest type exposes the following members

Constructors

Properties

NameTypeDescription
Public Property AvailabilityZone System.String

Gets and sets the property AvailabilityZone.

The Availability Zone for the secondary subnet. You cannot specify both AvailabilityZone and AvailabilityZoneId in the same request.

Public Property AvailabilityZoneId System.String

Gets and sets the property AvailabilityZoneId.

The ID of the Availability Zone for the secondary subnet. This option is preferred over AvailabilityZone as it provides a consistent identifier across Amazon Web Services accounts. You cannot specify both AvailabilityZone and AvailabilityZoneId in the same request.

Public Property ClientToken System.String

Gets and sets the property ClientToken.

Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensure Idempotency.

Public Property DryRun System.Nullable<System.Boolean>

Gets and sets the property DryRun.

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Public Property Ipv4CidrBlock System.String

Gets and sets the property Ipv4CidrBlock.

The IPv4 CIDR block for the secondary subnet. The CIDR block size must be between /12 and /28.

Public Property SecondaryNetworkId System.String

Gets and sets the property SecondaryNetworkId.

The ID of the secondary network in which to create the secondary subnet.

Public Property TagSpecifications System.Collections.Generic.List<Amazon.EC2.Model.TagSpecification>

Gets and sets the property TagSpecifications.

The tags to assign to the secondary subnet.

Starting with version 4 of the SDK this property will default to null. If no data for this property is returned from the service the property will also be null. This was changed to improve performance and allow the SDK and caller to distinguish between a property not set or a property being empty to clear out a value. To retain the previous SDK behavior set the AWSConfigs.InitializeCollections static property to true.

Examples

This example creates a secondary subnet with a /24 CIDR block in the specified secondary network and Availability Zone.

To create a secondary subnet


var client = new AmazonEC2Client();
var response = client.CreateSecondarySubnet(new CreateSecondarySubnetRequest 
{
    AvailabilityZoneId = "use2-az1",
    ClientToken = "550e8400-e29b-41d4-a716-446655440000",
    Ipv4CidrBlock = "10.0.0.0/24",
    SecondaryNetworkId = "sn-0123456789abcdef0",
    TagSpecifications = new List<TagSpecification> {
        new TagSpecification {
            ResourceType = "secondary-subnet",
            Tags = new List<Tag> {
                new Tag {
                    Key = "Name",
                    Value = "Prod Secondary Subnet"
                },
                new Tag {
                    Key = "Environment",
                    Value = "Production"
                }
            }
        }
    }
});

string clientToken = response.ClientToken;
SecondarySubnet secondarySubnet = response.SecondarySubnet;

            

Version Information

.NET:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.7.2 and newer