Modifier un attribut d’un Subnet
Vous pouvez modifier un attribut d’un Subnet.
Vous pouvez spécifier si une IP publique est attribuée aux interfaces réseau créées dans le Subnet, y compris les interfaces réseau créées lorsque vous lancez une machine virtuelle (VM) dans un Subnet.
Mettre à jour un Subnet avec OSC CLI
|
À ce jour, cette section est disponible en anglais uniquement. |
The UpdateSubnet command [IMPORTANT]
If you set MapPublicIpOnLaunch to true for a Subnet where you have created an internal load balancer, make sure that the security group of the load balancer does not allow flows coming from the internet, or your internal load balancer risks being exposed to the Internet.
Modifies the specified attribute of a Subnet.
$ osc-cli api UpdateSubnet --profile "default" \
--SubnetId "subnet-12345678" \
--MapPublicIpOnLaunch True
This command contains the following attributes that you need to specify:
-
DryRun: (optional) If true, checks whether you have the required permissions to perform the action. -
MapPublicIpOnLaunch: If true, a public IP is assigned to the network interface cards (NICs) created in the specified Subnet. -
SubnetId: The ID of the Subnet.
The UpdateSubnet command returns the following elements:
-
ResponseContext: Information about the context of the response.-
RequestId: The ID of the request.
-
-
Subnet: Information about the Subnet.-
AvailableIpsCount: The number of available IPs in the Subnets. -
IpRange: The IP range in the Subnet, in CIDR notation (for example,10.0.0.0/16). -
MapPublicIpOnLaunch: If true, a public IP is assigned to the network interface cards (NICs) created in the specified Subnet. By default, false. -
NetId: The ID of the Net in which the Subnet is. -
State: The state of the Subnet (pending|available|deleted). -
SubnetId: The ID of the Subnet. -
SubregionName: The name of the Subregion in which the Subnet is located. -
Tags: One or more tags associated with the Subnet.-
Key: The key of the tag, between 1 and 255 characters. -
Value: The value of the tag, between 0 and 255 characters.
-
-
{
"Subnet": {
"Tags": [],
"SubregionName": "eu-west-2a",
"SubnetId": "subnet-12345678",
"AvailableIpsCount": 16379,
"IpRange": "10.0.0.0/18",
"MapPublicIpOnLaunch": true,
"State": "available",
"NetId": "vpc-12345678"
},
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
Mettre à jour un Subnet avec oapi-cli
|
À ce jour, cette section est disponible en anglais uniquement. |
The UpdateSubnet command [IMPORTANT]
If you set MapPublicIpOnLaunch to true for a Subnet where you have created an internal load balancer, make sure that the security group of the load balancer does not allow flows coming from the internet, or your internal load balancer risks being exposed to the Internet.
Modifies the specified attribute of a Subnet.
$ oapi-cli --profile "default" UpdateSubnet \
--SubnetId "subnet-12345678" \
--MapPublicIpOnLaunch true
This command contains the following attributes that you need to specify:
-
DryRun: (optional) If true, checks whether you have the required permissions to perform the action. -
MapPublicIpOnLaunch: If true, a public IP is assigned to the network interface cards (NICs) created in the specified Subnet. -
SubnetId: The ID of the Subnet.
The UpdateSubnet command returns the following elements:
-
ResponseContext: Information about the context of the response.-
RequestId: The ID of the request.
-
-
Subnet: Information about the Subnet.-
AvailableIpsCount: The number of available IPs in the Subnets. -
IpRange: The IP range in the Subnet, in CIDR notation (for example,10.0.0.0/16). -
MapPublicIpOnLaunch: If true, a public IP is assigned to the network interface cards (NICs) created in the specified Subnet. By default, false. -
NetId: The ID of the Net in which the Subnet is. -
State: The state of the Subnet (pending|available|deleted). -
SubnetId: The ID of the Subnet. -
SubregionName: The name of the Subregion in which the Subnet is located. -
Tags: One or more tags associated with the Subnet.-
Key: The key of the tag, between 1 and 255 characters. -
Value: The value of the tag, between 0 and 255 characters.
-
-
{
"Subnet": {
"Tags": [],
"SubregionName": "eu-west-2a",
"SubnetId": "subnet-12345678",
"AvailableIpsCount": 16379,
"IpRange": "10.0.0.0/18",
"MapPublicIpOnLaunch": true,
"State": "available",
"NetId": "vpc-12345678"
},
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
Modifier un attribut d’un subnet avec AWS CLI
Avant de commencer : Installez et configurez AWS CLI. Pour en savoir plus, voir Installer et configurer AWS CLI. |
Pour modifier un attribut d’un subnet, utilisez la commande modify-subnet-attribute en suivant cette syntaxe :
$ aws ec2 modify-subnet-attribute \
--profile YOUR_PROFILE \
--subnet-id subnet-12ab34cd \
--map-public-ip-on-launch \
--endpoint https://fcu.eu-west-2.outscale.com
Cette commande contient les options suivantes que vous devez spécifier :
-
(optionnel)
profile: Le profil nommé que vous voulez utiliser, créé pendant la configuration d’AWS CLI. Pour en savoir plus, voir Installer et configurer AWS CLI. -
subnet-id: L’ID du subnet dont vous voulez modifier un attribut. -
(optionnel)
map-public-ip-on-launch|no-map-public-ip-on-launch: Si paramétré surmap-public-ip-on-launch, une IP publique est attribuée à chaque instance créée dans le subnet. L’IP publique reste attribuée à l’instance même lorsque celle-ci est arrêtée. L’IP publique est libérée lorsque l’instance est terminée.
Si paramétré surno-map-public-ip-on-launch, aucune IP publique n’est attribuée. -
endpoint: Le endpoint correspondant à la Région à laquelle vous voulez envoyer la requête. Pour en savoir plus, voir Installer et configurer AWS CLI.
L’attribut spécifié est modifié.
Pages connexes
Méthodes API correspondantes
AWS™ et Amazon Web Services™ sont des marques de commerce d'Amazon Technologies, Inc. ou de ses affiliées aux États-Unis et/ou dans les autres pays.