AWS SDK Version 3 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.

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.

Note:

For .NET Core this operation is only available in asynchronous form. Please refer to CreateSecondarySubnetAsync.

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

Syntax

C#
public virtual CreateSecondarySubnetResponse CreateSecondarySubnet(
         CreateSecondarySubnetRequest request
)

Parameters

request
Type: Amazon.EC2.Model.CreateSecondarySubnetRequest

Container for the necessary parameters to execute the CreateSecondarySubnet service method.

Return Value


The response from the CreateSecondarySubnet service method, as returned by EC2.

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 Framework:
Supported in: 4.5 and newer, 3.5

See Also