D’autres exemples de kits AWS SDK sont disponibles dans le référentiel GitHub AWS Doc SDK Examples
Utilisation de ModifyTargetGroup avec une CLI
Les exemples de code suivants illustrent comment utiliser ModifyTargetGroup.
- CLI
-
- AWS CLI
-
Pour modifier la configuration de la surveillance de l’état pour un groupe cible
L’exemple
modify-target-groupsuivant modifie la configuration des surveillances de l’état utilisées pour évaluer l’état des cibles pour le groupe cible spécifié. Notez qu’en raison de la façon dont l’interface de ligne de commande analyse les virgules, vous devez entourer la plage de l’option--matcherde guillemets simples plutôt que de guillemets doubles.aws elbv2 modify-target-group \ --target-group-arnarn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-https-targets/2453ed029918f21f\ --health-check-protocolHTTPS\ --health-check-port443\ --matcher HttpCode='200,299'Sortie :
{ "TargetGroups": [ { "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-https-targets/2453ed029918f21f", "TargetGroupName": "my-https-targets", "Protocol": "HTTPS", "Port": 443, "VpcId": "vpc-3ac0fb5f", "HealthCheckProtocol": "HTTPS", "HealthCheckPort": "443", "HealthCheckEnabled": true, "HealthCheckIntervalSeconds": 30, "HealthCheckTimeoutSeconds": 5, "HealthyThresholdCount": 5, "UnhealthyThresholdCount": 2, "Matcher": { "HttpCode": "200,299" }, "LoadBalancerArns": [ "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188" ], "TargetType": "instance", "ProtocolVersion": "HTTP1", "IpAddressType": "ipv4" } ] }Pour plus d’informations, consultez Groupes cibles dans le Guide de l’utilisateur des Application Load Balancers.
-
Pour plus de détails sur l’API, consultez ModifyTargetGroup
dans la Référence des commandes de l’AWS CLI.
-
- PowerShell
-
- Outils pour PowerShell V4
-
Exemple 1 : cet exemple modifie les propriétés du groupe cible spécifié.
Edit-ELB2TargetGroup -TargetGroupArn 'arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/test-tg/a4e04b3688be1970' -HealthCheckIntervalSecond 60 -HealthCheckPath '/index.html' -HealthCheckPort 8080Sortie :
HealthCheckEnabled : True HealthCheckIntervalSeconds : 60 HealthCheckPath : /index.html HealthCheckPort : 8080 HealthCheckProtocol : HTTP HealthCheckTimeoutSeconds : 5 HealthyThresholdCount : 5 LoadBalancerArns : {} Matcher : Amazon.ElasticLoadBalancingV2.Model.Matcher Port : 80 Protocol : HTTP TargetGroupArn : arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/test-tg/a4e04b3688be1970 TargetGroupName : test-tg TargetType : instance UnhealthyThresholdCount : 2 VpcId : vpc-2cfd7000-
Pour plus de détails sur l’API, consultez ModifyTargetGroup dans la Référence des applets de commande pour les Outils AWS pour PowerShell (V4).
-
- Outils pour PowerShell V5
-
Exemple 1 : cet exemple modifie les propriétés du groupe cible spécifié.
Edit-ELB2TargetGroup -TargetGroupArn 'arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/test-tg/a4e04b3688be1970' -HealthCheckIntervalSecond 60 -HealthCheckPath '/index.html' -HealthCheckPort 8080Sortie :
HealthCheckEnabled : True HealthCheckIntervalSeconds : 60 HealthCheckPath : /index.html HealthCheckPort : 8080 HealthCheckProtocol : HTTP HealthCheckTimeoutSeconds : 5 HealthyThresholdCount : 5 LoadBalancerArns : {} Matcher : Amazon.ElasticLoadBalancingV2.Model.Matcher Port : 80 Protocol : HTTP TargetGroupArn : arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/test-tg/a4e04b3688be1970 TargetGroupName : test-tg TargetType : instance UnhealthyThresholdCount : 2 VpcId : vpc-2cfd7000-
Pour plus de détails sur l’API, consultez ModifyTargetGroup dans la Référence des applets de commande pour les Outils AWS pour PowerShell (V5).
-