createSecondarySubnet

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.

Samples

import aws.sdk.kotlin.services.ec2.model.ResourceType
import aws.sdk.kotlin.services.ec2.model.Tag
import aws.sdk.kotlin.services.ec2.model.TagSpecification

fun main() { 
   //sampleStart 
   // This example creates a secondary subnet with a 24 CIDR block in the specified secondary network and
// Availability Zone.
val resp = ec2Client.createSecondarySubnet {
    secondaryNetworkId = "sn-0123456789abcdef0"
    ipv4CidrBlock = "10.0.0.0/24"
    availabilityZoneId = "use2-az1"
    clientToken = "550e8400-e29b-41d4-a716-446655440000"
    tagSpecifications = listOf<TagSpecification>(
        TagSpecification {
            resourceType = ResourceType.fromValue("secondary-subnet")
            tags = listOf<Tag>(
                Tag {
                    key = "Name"
                    value = "Prod Secondary Subnet"
                },
                Tag {
                    key = "Environment"
                    value = "Production"
                }                    
            )
        }            
    )
} 
   //sampleEnd
}