create_secondary_subnet
¶
create_secondary_subnet(
*,
config_overrides: Optional[EC2ClientConfig] = None,
client_token: Optional[String] = None,
availability_zone: Optional[AvailabilityZoneName] = None,
availability_zone_id: Optional[AvailabilityZoneId] = None,
dry_run: Optional[Boolean] = None,
ipv4_cidr_block: Optional[String] = None,
secondary_network_id: Optional[SecondaryNetworkId] = None,
tag_specifications: Optional[TagSpecificationList] = None,
) -> CreateSecondarySubnetResult
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.
Parameters:
-
client_token(Optional[String], default:None) –Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensure Idempotency.
-
availability_zone(Optional[AvailabilityZoneName], default:None) –The Availability Zone for the secondary subnet. You cannot specify both
AvailabilityZoneandAvailabilityZoneIdin the same request. -
availability_zone_id(Optional[AvailabilityZoneId], default:None) –The ID of the Availability Zone for the secondary subnet. This option is preferred over
AvailabilityZoneas it provides a consistent identifier across Amazon Web Services accounts. You cannot specify bothAvailabilityZoneandAvailabilityZoneIdin the same request. -
dry_run(Optional[Boolean], default:None) –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 isUnauthorizedOperation. -
ipv4_cidr_block(Optional[String], default:None) –The IPv4 CIDR block for the secondary subnet. The CIDR block size must be between /12 and /28.
-
secondary_network_id(Optional[SecondaryNetworkId], default:None) –The ID of the secondary network in which to create the secondary subnet.
-
tag_specifications(Optional[TagSpecificationList], default:None) –The tags to assign to the secondary subnet.
Raises:
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To create a secondary subnet This example creates a secondary subnet with a /24 CIDR block in the specified secondary network and Availability Zone.
>>> client.create_secondary_subnet(secondary_network_id='sn-0123456789abcdef0', ipv4_cidr_block='10.0.0.0/24', availability_zone_id='use2-az1', client_token='550e8400-e29b-41d4-a716-446655440000', tag_specifications=[{'ResourceType': 'secondary-subnet', 'Tags': [{'Key': 'Name', 'Value': 'Prod Secondary Subnet'}, {'Key': 'Environment', 'Value': 'Production'}]}])
Source code in docs_src/capo_ec2/_services/ec2.py
12136 12137 12138 12139 12140 12141 12142 12143 12144 12145 12146 12147 12148 12149 12150 12151 12152 12153 12154 12155 12156 12157 12158 12159 12160 12161 12162 12163 12164 12165 12166 12167 12168 12169 12170 12171 12172 12173 12174 12175 12176 12177 12178 12179 12180 12181 12182 12183 12184 12185 12186 12187 12188 12189 12190 12191 12192 12193 12194 12195 12196 12197 12198 12199 12200 12201 12202 12203 12204 12205 12206 12207 12208 12209 12210 12211 12212 12213 12214 12215 12216 12217 | |