

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

# Elastic Load Balancing - Contoh versi 2 menggunakan AWS CLI
<a name="cli_elastic-load-balancing-v2_code_examples"></a>

Contoh kode berikut menunjukkan cara melakukan tindakan dan mengimplementasikan skenario umum dengan menggunakan AWS Command Line Interface with Elastic Load Balancing - Versi 2.

*Tindakan* merupakan kutipan kode dari program yang lebih besar dan harus dijalankan dalam konteks. Sementara tindakan menunjukkan cara memanggil fungsi layanan individual, Anda dapat melihat tindakan dalam konteks dalam skenario terkait.

Setiap contoh menyertakan tautan ke kode sumber lengkap, di mana Anda dapat menemukan instruksi tentang cara mengatur dan menjalankan kode dalam konteks.

**Topics**
+ [Tindakan](#actions)

## Tindakan
<a name="actions"></a>

### `add-listener-certificates`
<a name="elastic-load-balancing-v2_AddListenerCertificates_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`add-listener-certificates`.

**AWS CLI**  
**Untuk menambahkan sertifikat ke pendengar yang aman**  
Contoh ini menambahkan sertifikat yang ditentukan ke pendengar aman yang ditentukan.  
Perintah:  

```
aws elbv2 add-listener-certificates --listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2 --certificates CertificateArn=arn:aws:acm:us-west-2:123456789012:certificate/5cc54884-f4a3-4072-80be-05b9ba72f705
```
Output:  

```
{
  "Certificates": [
      {
          "CertificateArn": "arn:aws:acm:us-west-2:123456789012:certificate/5cc54884-f4a3-4072-80be-05b9ba72f705",
          "IsDefault": false
      }
  ]
}
```
+  Untuk detail API, lihat [AddListenerCertificates](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/add-listener-certificates.html)di *Referensi AWS CLI Perintah*. 

### `add-tags`
<a name="elastic-load-balancing-v2_AddTags_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`add-tags`.

**AWS CLI**  
**Untuk menambahkan tag ke penyeimbang beban**  
`add-tags`Contoh berikut menambahkan `project` dan `department` tag ke penyeimbang beban tertentu.  

```
aws elbv2 add-tags \
    --resource-arns arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188 \
    --tags "Key=project,Value=lima" "Key=department,Value=digital-media"
```
+  Untuk detail API, lihat [AddTags](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/add-tags.html)di *Referensi AWS CLI Perintah*. 

### `create-listener`
<a name="elastic-load-balancing-v2_CreateListener_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`create-listener`.

**AWS CLI**  
**Contoh 1: Untuk membuat pendengar HTTP**  
`create-listener`Contoh berikut membuat listener HTTP untuk Application Load Balancer tertentu yang meneruskan permintaan ke grup target yang ditentukan.  

```
aws elbv2 create-listener \
    --load-balancer-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188 \
    --protocol HTTP \
    --port 80 \
    --default-actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067
```
Untuk informasi selengkapnya, lihat [Tutorial: Membuat Application Load Balancer menggunakan AWS CLI](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/tutorial-application-load-balancer-cli.html#create-load-balancer-aws-cli) di *Panduan Pengguna untuk* Application Load Balancers.  
**Contoh 2: Untuk membuat pendengar HTTPS**  
`create-listener`Contoh berikut membuat listener HTTPS untuk Application Load Balancer tertentu yang meneruskan permintaan ke grup target yang ditentukan. Anda harus menentukan sertifikat SSL untuk pendengar HTTPS. Anda dapat membuat dan mengelola sertifikat menggunakan AWS Certificate Manager (ACM). Atau, Anda dapat membuat sertifikat menggunakan SSL/TLS alat, mendapatkan sertifikat yang ditandatangani oleh otoritas sertifikat (CA), dan mengunggah sertifikat ke AWS Identity and Access Management (IAM).  

```
aws elbv2 create-listener \
    --load-balancer-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188 \
    --protocol HTTPS \
    --port 443 \
    --certificates CertificateArn=arn:aws:acm:us-west-2:123456789012:certificate/3dcb0a41-bd72-4774-9ad9-756919c40557 \
    --ssl-policy ELBSecurityPolicy-2016-08 \
    --default-actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067
```
Untuk informasi selengkapnya, lihat [Menambahkan pendengar HTTPS](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/tutorial-application-load-balancer-cli.html#https-listener-aws-cli) di *Panduan Pengguna untuk Penyeimbang Beban Aplikasi*.  
**Contoh 3: Untuk membuat pendengar TCP**  
`create-listener`Contoh berikut membuat pendengar TCP untuk Network Load Balancer tertentu yang meneruskan permintaan ke grup target yang ditentukan.  

```
aws elbv2 create-listener \
    --load-balancer-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/net/my-network-load-balancer/5d1b75f4f1cee11e \
    --protocol TCP \
    --port 80 \
    --default-actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-tcp-targets/b6bba954d1361c78
```
Untuk informasi selengkapnya, lihat [Tutorial: Membuat Network Load Balancer menggunakan AWS CLI](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancer-cli.html#create-load-balancer-aws-cli) di *Panduan Pengguna untuk* Network Load Balancers.  
**Contoh 4: Untuk membuat pendengar TLS**  
`create-listener`Contoh berikut membuat pendengar TLS untuk Network Load Balancer tertentu yang meneruskan permintaan ke grup target yang ditentukan. Anda harus menentukan sertifikat SSL untuk pendengar TLS.  

```
aws elbv2 create-listener \
    --load-balancer-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188 \
    --protocol TLS \
    --port 443 \
    --certificates CertificateArn=arn:aws:acm:us-west-2:123456789012:certificate/3dcb0a41-bd72-4774-9ad9-756919c40557 \
    --ssl-policy ELBSecurityPolicy-2016-08 \
    --default-actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067
```
Untuk informasi selengkapnya, lihat [pendengar TLS untuk Network Load Balancer Anda di *Panduan Pengguna* untuk Network Load Balancers](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html).  
**Contoh 5: Untuk membuat pendengar UDP**  
`create-listener`Contoh berikut membuat pendengar UDP untuk Network Load Balancer tertentu yang meneruskan permintaan ke grup target yang ditentukan.  

```
aws elbv2 create-listener \
    --load-balancer-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/net/my-network-load-balancer/5d1b75f4f1cee11e \
    --protocol UDP \
    --port 53 \
    --default-actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-tcp-targets/b6bba954d1361c78
```
Untuk informasi selengkapnya, lihat [Tutorial: Membuat Network Load Balancer menggunakan AWS CLI](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancer-cli.html#create-load-balancer-aws-cli) di *Panduan Pengguna untuk* Network Load Balancers.  
**Contoh 6: Untuk membuat pendengar untuk gateway dan penerusan yang ditentukan**  
`create-listener`Contoh berikut membuat listener untuk Load Balancer Gateway tertentu yang meneruskan permintaan ke grup target yang ditentukan.  

```
aws elbv2 create-listener \
    --load-balancer-arn arn:aws:elasticloadbalancing:us-east-1:850631746142:loadbalancer/gwy/my-gateway-load-balancer/e0f9b3d5c7f7d3d6 \
    --default-actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:us-east-1:850631746142:targetgroup/my-glb-targets/007ca469fae3bb1615
```
Output:  

```
{
    "Listeners": [
        {
            "ListenerArn": "arn:aws:elasticloadbalancing:us-east-1:850631746142:listener/gwy/my-agw-lb-example2/e0f9b3d5c7f7d3d6/afc127db15f925de",
            "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-east-1:850631746142:loadbalancer/gwy/my-agw-lb-example2/e0f9b3d5c7f7d3d6",
            "DefaultActions": [
                {
                    "Type": "forward",
                    "TargetGroupArn": "arn:aws:elasticloadbalancing:us-east-1:850631746142:targetgroup/test-tg-agw-2/007ca469fae3bb1615",
                    "ForwardConfig": {
                        "TargetGroups": [
                            {
                                "TargetGroupArn": "arn:aws:elasticloadbalancing:us-east-1:850631746142:targetgroup/test-tg-agw-2/007ca469fae3bb1615"
                            }
                        ]
                    }
                }
            ]
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Memulai Gateway Load Balancer menggunakan AWS CLI](https://docs.aws.amazon.com/elasticloadbalancing/latest/gateway/getting-started-cli.html) di *Panduan Pengguna untuk* Penyeimbang Beban Gateway.  
+  Untuk detail API, lihat [CreateListener](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/create-listener.html)di *Referensi AWS CLI Perintah*. 

### `create-load-balancer`
<a name="elastic-load-balancing-v2_CreateLoadBalancer_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`create-load-balancer`.

**AWS CLI**  
**Contoh 1: Untuk membuat penyeimbang beban yang menghadap ke Internet**  
`create-load-balancer`Contoh berikut membuat Application Load Balancer yang menghadap Internet dan mengaktifkan Availability Zones untuk subnet yang ditentukan.  

```
aws elbv2 create-load-balancer \
    --name my-load-balancer \
    --subnets subnet-b7d581c0 subnet-8360a9e7
```
Output:  

```
{
    "LoadBalancers": [
        {
            "Type": "application",
            "Scheme": "internet-facing",
            "IpAddressType": "ipv4",
            "VpcId": "vpc-3ac0fb5f",
            "AvailabilityZones": [
                {
                    "ZoneName": "us-west-2a",
                    "SubnetId": "subnet-8360a9e7"
                },
                {
                    "ZoneName": "us-west-2b",
                    "SubnetId": "subnet-b7d581c0"
                }
            ],
            "CreatedTime": "2017-08-25T21:26:12.920Z",
            "CanonicalHostedZoneId": "Z2P70J7EXAMPLE",
            "DNSName": "my-load-balancer-424835706.us-west-2.elb.amazonaws.com",
            "SecurityGroups": [
                "sg-5943793c"
            ],
            "LoadBalancerName": "my-load-balancer",
            "State": {
                "Code": "provisioning"
            },
            "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Tutorial: Membuat Application Load Balancer menggunakan AWS CLI](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/tutorial-application-load-balancer-cli.html) di *Panduan Pengguna untuk* Application Load Balancers.  
**Contoh 2: Untuk membuat penyeimbang beban internal**  
`create-load-balancer`Contoh berikut membuat Application Load Balancer internal dan mengaktifkan Availability Zones untuk subnet yang ditentukan.  

```
aws elbv2 create-load-balancer \
    --name my-internal-load-balancer \
    --scheme internal \
    --subnets subnet-b7d581c0 subnet-8360a9e7
```
Output:  

```
{
    "LoadBalancers": [
        {
            "Type": "application",
            "Scheme": "internal",
            "IpAddressType": "ipv4",
            "VpcId": "vpc-3ac0fb5f",
            "AvailabilityZones": [
                {
                    "ZoneName": "us-west-2a",
                    "SubnetId": "subnet-8360a9e7"
                },
                {
                    "ZoneName": "us-west-2b",
                    "SubnetId": "subnet-b7d581c0"
                }
            ],
            "CreatedTime": "2016-03-25T21:29:48.850Z",
            "CanonicalHostedZoneId": "Z2P70J7EXAMPLE",
            "DNSName": "internal-my-internal-load-balancer-1529930873.us-west-2.elb.amazonaws.com",
            "SecurityGroups": [
                "sg-5943793c"
            ],
            "LoadBalancerName": "my-internal-load-balancer",
            "State": {
                "Code": "provisioning"
            },
            "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-internal-load-balancer/5b49b8d4303115c2"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Tutorial: Membuat Application Load Balancer menggunakan AWS CLI](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/tutorial-application-load-balancer-cli.html) di *Panduan Pengguna untuk* Application Load Balancers.  
**Contoh 3: Untuk membuat Network Load Balancer**  
`create-load-balancer`Contoh berikut membuat Network Load Balancer yang menghadap Internet dan mengaktifkan Availability Zone untuk subnet yang ditentukan. Ini menggunakan pemetaan subnet untuk mengaitkan alamat IP Elastis yang ditentukan dengan antarmuka jaringan yang digunakan oleh node penyeimbang beban untuk Availability Zone.  

```
aws elbv2 create-load-balancer \
    --name my-network-load-balancer \
    --type network \
    --subnet-mappings SubnetId=subnet-b7d581c0,AllocationId=eipalloc-64d5890a
```
Output:  

```
{
    "LoadBalancers": [
        {
            "Type": "network",
            "Scheme": "internet-facing",
            "IpAddressType": "ipv4",
            "VpcId": "vpc-3ac0fb5f",
            "AvailabilityZones": [
                {
                    "LoadBalancerAddresses": [
                        {
                            "IpAddress": "35.161.207.171",
                            "AllocationId": "eipalloc-64d5890a"
                        }
                    ],
                    "ZoneName": "us-west-2b",
                    "SubnetId": "subnet-5264e837"
                }
            ],
            "CreatedTime": "2017-10-15T22:41:25.657Z",
            "CanonicalHostedZoneId": "Z2P70J7EXAMPLE",
            "DNSName": "my-network-load-balancer-5d1b75f4f1cee11e.elb.us-west-2.amazonaws.com",
            "LoadBalancerName": "my-network-load-balancer",
            "State": {
                "Code": "provisioning"
            },
            "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/net/my-network-load-balancer/5d1b75f4f1cee11e"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Tutorial: Membuat Network Load Balancer menggunakan AWS CLI](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancer-cli.html) di *Panduan Pengguna untuk* Network Load Balancers.  
**Contoh 4: Untuk membuat Load Balancer Gateway**  
`create-load-balancer`Contoh berikut membuat Load Balancer Gateway dan mengaktifkan Availability Zones untuk subnet yang ditentukan.  

```
aws elbv2 create-load-balancer \
    --name my-gateway-load-balancer \
    --type gateway \
    --subnets subnet-dc83f691 subnet-a62583f9
```
Output:  

```
{
    "LoadBalancers": [
        {
            "Type": "gateway",
            "VpcId": "vpc-838475fe",
            "AvailabilityZones": [
                {
                    "ZoneName": "us-east-1b",
                    "SubnetId": "subnet-a62583f9"
                },
            {
                    "ZoneName": "us-east-1a",
                    "SubnetId": "subnet-dc83f691"
                }
            ],
            "CreatedTime": "2021-07-14T19:33:43.324000+00:00",
            "LoadBalancerName": "my-gateway-load-balancer",
            "State": {
                "Code": "provisioning"
            },
            "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-east-1:850631746142:loadbalancer/gwy/my-gateway-load-balancer/dfbb5a7d32cdee79"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Memulai Gateway Load Balancer menggunakan AWS CLI](https://docs.aws.amazon.com/elasticloadbalancing/latest/gateway/getting-started-cli.html) di *Panduan Pengguna untuk* Penyeimbang Beban Gateway.  
+  Untuk detail API, lihat [CreateLoadBalancer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/create-load-balancer.html)di *Referensi AWS CLI Perintah*. 

### `create-rule`
<a name="elastic-load-balancing-v2_CreateRule_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`create-rule`.

**AWS CLI**  
**Contoh 1: Untuk membuat aturan menggunakan kondisi jalur dan tindakan maju**  
`create-rule`Contoh berikut membuat aturan yang meneruskan permintaan ke grup target yang ditentukan jika URL berisi pola yang ditentukan.  

```
aws elbv2 create-rule \
    --listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2 \
    --priority 5 \
    --conditions file://conditions-pattern.json
    --actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067
```
Isi dari `conditions-pattern.json`:  

```
[
    {
        "Field": "path-pattern",
        "PathPatternConfig": {
            "Values": ["/images/*"]
        }
    }
]
```
**Contoh 2: Untuk membuat aturan menggunakan kondisi host dan respons tetap**  
`create-rule`Contoh berikut membuat aturan yang memberikan respons tetap jika nama host di header host cocok dengan nama host yang ditentukan.  

```
aws elbv2 create-rule \
    --listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2 \
    --priority 10 \
    --conditions file://conditions-host.json \
    --actions file://actions-fixed-response.json
```
Isi dari `conditions-host.json`  

```
[
  {
      "Field": "host-header",
      "HostHeaderConfig": {
          "Values": ["*.example.com"]
      }
  }
]
```
Isi dari `actions-fixed-response.json`  

```
[
    {
        "Type": "fixed-response",
        "FixedResponseConfig": {
            "MessageBody": "Hello world",
            "StatusCode": "200",
            "ContentType": "text/plain"
        }
    }
]
```
**Contoh 3: Untuk membuat aturan menggunakan kondisi alamat IP sumber, tindakan otentikasi, dan tindakan maju**  
`create-rule`Contoh berikut membuat aturan yang mengautentikasi pengguna jika alamat IP sumber cocok dengan alamat IP yang ditentukan, dan meneruskan permintaan ke grup target yang ditentukan jika otentikasi berhasil.  

```
aws elbv2 create-rule \
    --listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2 \
    --priority 20 \
    --conditions file://conditions-source-ip.json \
    --actions file://actions-authenticate.json
```
Isi dari `conditions-source-ip.json`  

```
[
    {
        "Field": "source-ip",
        "SourceIpConfig": {
            "Values": ["192.0.2.0/24", "198.51.100.10/32"]
        }
    }
]
```
Isi dari `actions-authenticate.json`  

```
[
    {
        "Type": "authenticate-oidc",
        "AuthenticateOidcConfig": {
            "Issuer": "https://idp-issuer.com",
            "AuthorizationEndpoint": "https://authorization-endpoint.com",
            "TokenEndpoint": "https://token-endpoint.com",
            "UserInfoEndpoint": "https://user-info-endpoint.com",
            "ClientId": "abcdefghijklmnopqrstuvwxyz123456789",
            "ClientSecret": "123456789012345678901234567890",
            "SessionCookieName": "my-cookie",
            "SessionTimeout": 3600,
            "Scope": "email",
            "AuthenticationRequestExtraParams": {
                "display": "page",
                "prompt": "login"
            },
            "OnUnauthenticatedRequest": "deny"
        },
        "Order": 1
    },
    {
        "Type": "forward",
        "TargetGroupArn": "arn:aws:elasticloadbalancing:us-east-1:880185128111:targetgroup/cli-test/642a97ecb0e0f26b",
        "Order": 2
    }
]
```
+  Untuk detail API, lihat [CreateRule](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/create-rule.html)di *Referensi AWS CLI Perintah*. 

### `create-target-group`
<a name="elastic-load-balancing-v2_CreateTargetGroup_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`create-target-group`.

**AWS CLI**  
**Contoh 1: Untuk membuat grup target untuk Application Load Balancer**  
`create-target-group`Contoh berikut membuat grup target untuk Application Load Balancer tempat Anda mendaftarkan target berdasarkan ID instance (tipe targetnya adalah`instance`). Grup target ini menggunakan protokol HTTP, port 80, dan pengaturan pemeriksaan kesehatan default untuk grup target HTTP.  

```
aws elbv2 create-target-group \
    --name my-targets \
    --protocol HTTP \
    --port 80 \
    --target-type instance \
    --vpc-id vpc-3ac0fb5f
```
Output:  

```
{
    "TargetGroups": [
        {
            "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067",
            "TargetGroupName": "my-targets",
            "Protocol": "HTTP",
            "Port": 80,
            "VpcId": "vpc-3ac0fb5f",
            "HealthCheckProtocol": "HTTP",
            "HealthCheckPort": "traffic-port",
            "HealthCheckEnabled": true,
            "HealthCheckIntervalSeconds": 30,
            "HealthCheckTimeoutSeconds": 5,
            "HealthyThresholdCount": 5,
            "UnhealthyThresholdCount": 2,
            "HealthCheckPath": "/",
            "Matcher": {
                "HttpCode": "200"
            },
            "TargetType": "instance",
            "ProtocolVersion": "HTTP1",
            "IpAddressType": "ipv4"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Membuat grup target](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-target-group.html) di *Panduan Pengguna untuk Penyeimbang Beban Aplikasi*.  
**Contoh 2: Untuk membuat grup target untuk merutekan lalu lintas dari Application Load Balancer ke fungsi Lambda**  
`create-target-group`Contoh berikut membuat grup target untuk Application Load Balancer di mana targetnya adalah fungsi Lambda (tipe targetnya adalah). `lambda` Pemeriksaan kesehatan dinonaktifkan untuk grup target ini secara default.  

```
aws elbv2 create-target-group \
    --name my-lambda-target \
    --target-type lambda
```
Output:  

```
{
    "TargetGroups": [
        {
            "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-lambda-target/a3003e085dbb8ddc",
            "TargetGroupName": "my-lambda-target",
            "HealthCheckEnabled": false,
            "HealthCheckIntervalSeconds": 35,
            "HealthCheckTimeoutSeconds": 30,
            "HealthyThresholdCount": 5,
            "UnhealthyThresholdCount": 2,
            "HealthCheckPath": "/",
            "Matcher": {
                "HttpCode": "200"
            },
            "TargetType": "lambda",
            "IpAddressType": "ipv4"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat: [Fungsi Lambda sebagai target](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html) di *Panduan pengguna untuk Application Load Balancers*.  
**Contoh 3: Untuk membuat grup target untuk Network Load Balancer**  
`create-target-group`Contoh berikut membuat grup target untuk Network Load Balancer tempat Anda mendaftarkan target berdasarkan alamat IP (tipe targetnya adalah`ip`). Grup target ini menggunakan protokol TCP, port 80, dan pengaturan pemeriksaan kesehatan default untuk grup target TCP.  

```
aws elbv2 create-target-group \
    --name my-ip-targets \
    --protocol TCP \
    --port 80 \
    --target-type ip \
    --vpc-id vpc-3ac0fb5f
```
Output:  

```
{
    "TargetGroups": [
        {
            "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-ip-targets/b6bba954d1361c78",
            "TargetGroupName": "my-ip-targets",
            "Protocol": "TCP",
            "Port": 80,
            "VpcId": "vpc-3ac0fb5f",
            "HealthCheckEnabled": true,
            "HealthCheckProtocol": "TCP",
            "HealthCheckPort": "traffic-port",
            "HealthCheckIntervalSeconds": 30,
            "HealthCheckTimeoutSeconds": 10,
            "HealthyThresholdCount": 5,
            "UnhealthyThresholdCount": 2,
            "TargetType": "ip",
            "IpAddressType": "ipv4"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Membuat grup target](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-target-group.html) di *Panduan Pengguna untuk Network Load Balancers*.  
**Contoh 4: Untuk membuat grup target untuk merutekan lalu lintas dari Network Load Balancer ke Application Load Balancer**  
`create-target-group`Contoh berikut membuat grup target untuk Network Load Balancer tempat Anda mendaftarkan Application Load Balancer sebagai target (tipe targetnya adalah). `alb`  
aws elbv2 create-target-group --name my-alb-target --protocol TCP --port 80 --target-type alb --vpc-id vpc-id vpc-3ac0fb5f  
Output:  

```
{
    "TargetGroups": [
        {
            "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-alb-target/a3003e085dbb8ddc",
            "TargetGroupName": "my-alb-target",
            "Protocol": "TCP",
            "Port": 80,
            "VpcId": "vpc-838475fe",
            "HealthCheckProtocol": "HTTP",
            "HealthCheckPort": "traffic-port",
            "HealthCheckEnabled": true,
            "HealthCheckIntervalSeconds": 30,
            "HealthCheckTimeoutSeconds": 6,
            "HealthyThresholdCount": 5,
            "UnhealthyThresholdCount": 2,
            "HealthCheckPath": "/",
            "Matcher": {
                "HttpCode": "200-399"
            },
            "TargetType": "alb",
            "IpAddressType": "ipv4"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Membuat grup target dengan Application Load Balancer sebagai target](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/application-load-balancer-target.html) dalam *Panduan Pengguna untuk Network Load* Balancers.  
**Contoh 5: Untuk membuat grup target untuk Load Balancer Gateway**  
`create-target-group`Contoh berikut membuat grup target untuk Load Balancer Gateway di mana target adalah sebuah instance, dan protokol grup target adalah. `GENEVE`  

```
aws elbv2 create-target-group \
    --name my-glb-targetgroup \
    --protocol GENEVE \
    --port 6081 \
    --target-type instance \
    --vpc-id vpc-838475fe
```
Output:  

```
{
    "TargetGroups": [
        {
            "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-glb-targetgroup/00c3d57eacd6f40b6f",
            "TargetGroupName": "my-glb-targetgroup",
            "Protocol": "GENEVE",
            "Port": 6081,
            "VpcId": "vpc-838475fe",
            "HealthCheckProtocol": "TCP",
            "HealthCheckPort": "80",
            "HealthCheckEnabled": true,
            "HealthCheckIntervalSeconds": 10,
            "HealthCheckTimeoutSeconds": 5,
            "HealthyThresholdCount": 5,
            "UnhealthyThresholdCount": 2,
            "TargetType": "instance"
        }
    ]
}
```
*Untuk informasi selengkapnya, lihat Membuat grup target < https://docs.aws.amazon.com/elasticloadbalancing/ latest/gateway/create -target-group.html>`\$1\$1 di Panduan Pengguna Load Balancer Gateway.*  
+  Untuk detail API, lihat [CreateTargetGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/create-target-group.html)di *Referensi AWS CLI Perintah*. 

### `delete-listener`
<a name="elastic-load-balancing-v2_DeleteListener_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`delete-listener`.

**AWS CLI**  
**Untuk menghapus pendengar**  
`delete-listener`Contoh berikut menghapus pendengar yang ditentukan.  

```
aws elbv2 delete-listener \
    --listener-arn arn:aws:elasticloadbalancing:ua-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2
```
+  Untuk detail API, lihat [DeleteListener](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/delete-listener.html)di *Referensi AWS CLI Perintah*. 

### `delete-load-balancer`
<a name="elastic-load-balancing-v2_DeleteLoadBalancer_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`delete-load-balancer`.

**AWS CLI**  
**Untuk menghapus penyeimbang beban**  
`delete-load-balancer`Contoh berikut menghapus penyeimbang beban yang ditentukan.  

```
aws elbv2 delete-load-balancer \
    --load-balancer-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188
```
+  Untuk detail API, lihat [DeleteLoadBalancer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/delete-load-balancer.html)di *Referensi AWS CLI Perintah*. 

### `delete-rule`
<a name="elastic-load-balancing-v2_DeleteRule_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`delete-rule`.

**AWS CLI**  
**Untuk menghapus aturan**  
`delete-rule`Contoh berikut menghapus aturan yang ditentukan.  

```
aws elbv2 delete-rule \
    --rule-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/1291d13826f405c3
```
+  Untuk detail API, lihat [DeleteRule](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/delete-rule.html)di *Referensi AWS CLI Perintah*. 

### `delete-target-group`
<a name="elastic-load-balancing-v2_DeleteTargetGroup_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`delete-target-group`.

**AWS CLI**  
**Untuk menghapus grup target**  
`delete-target-group`Contoh berikut menghapus kelompok target yang ditentukan.  

```
aws elbv2 delete-target-group \
    --target-group-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067
```
Perintah ini tidak menghasilkan output.  
Untuk informasi selengkapnya, lihat [Menghapus penyeimbang beban di Panduan *Application Load Balancer*](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-delete.html).  
+  Untuk detail API, lihat [DeleteTargetGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/delete-target-group.html)di *Referensi AWS CLI Perintah*. 

### `deregister-targets`
<a name="elastic-load-balancing-v2_DeregisterTargets_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`deregister-targets`.

**AWS CLI**  
**Contoh 1: Untuk membatalkan pendaftaran target dari grup target**  
`deregister-targets`Contoh berikut menghapus contoh tertentu dari kelompok target yang ditentukan.  

```
aws elbv2 deregister-targets \
    --target-group-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067 \
    --targets Id=i-1234567890abcdef0
```
**Contoh 2: Untuk membatalkan pendaftaran target yang terdaftar menggunakan penggantian port**  
`deregister-targets`Contoh berikut menghapus instance dari grup target yang terdaftar menggunakan port overrides.  

```
aws elbv2 deregister-targets \
    --target-group-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-internal-targets/3bb63f11dfb0faf9 \
    --targets Id=i-1234567890abcdef0,Port=80 Id=i-1234567890abcdef0,Port=766
```
+  Untuk detail API, lihat [DeregisterTargets](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/deregister-targets.html)di *Referensi AWS CLI Perintah*. 

### `describe-account-limits`
<a name="elastic-load-balancing-v2_DescribeAccountLimits_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`describe-account-limits`.

**AWS CLI**  
**Untuk menjelaskan batas Elastic Load Balancing Anda**  
`describe-account-limits`Contoh berikut menampilkan batas Elastic Load Balancing untuk AWS akun Anda di Wilayah saat ini.  

```
aws elbv2 describe-account-limits
```
Output:  

```
{
    "Limits": [
        {
            "Name": "target-groups",
            "Max": "3000"
        },
        {
            "Name": "targets-per-application-load-balancer",
            "Max": "1000"
        },
        {
            "Name": "listeners-per-application-load-balancer",
            "Max": "50"
        },
        {
            "Name": "rules-per-application-load-balancer",
            "Max": "100"
        },
        {
            "Name": "network-load-balancers",
            "Max": "50"
        },
        {
            "Name": "targets-per-network-load-balancer",
            "Max": "3000"
        },
        {
            "Name": "targets-per-availability-zone-per-network-load-balancer",
            "Max": "500"
        },
        {
            "Name": "listeners-per-network-load-balancer",
            "Max": "50"
        },
        {
            "Name": "condition-values-per-alb-rule",
            "Max": "5"
        },
        {
            "Name": "condition-wildcards-per-alb-rule",
            "Max": "5"
        },
        {
            "Name": "target-groups-per-application-load-balancer",
            "Max": "100"
        },
        {
            "Name": "target-groups-per-action-on-application-load-balancer",
            "Max": "5"
        },
        {
            "Name": "target-groups-per-action-on-network-load-balancer",
            "Max": "1"
        },
        {
            "Name": "certificates-per-application-load-balancer",
            "Max": "25"
        },
        {
            "Name": "certificates-per-network-load-balancer",
            "Max": "25"
        },
        {
            "Name": "targets-per-target-group",
            "Max": "1000"
        },
        {
            "Name": "target-id-registrations-per-application-load-balancer",
            "Max": "1000"
        },
        {
            "Name": "network-load-balancer-enis-per-vpc",
            "Max": "1200"
        },
        {
            "Name": "application-load-balancers",
            "Max": "50"
        },
        {
            "Name": "gateway-load-balancers",
            "Max": "100"
        },
        {
            "Name": "gateway-load-balancers-per-vpc",
            "Max": "100"
        },
        {
            "Name": "geneve-target-groups",
            "Max": "100"
        },
        {
            "Name": "targets-per-availability-zone-per-gateway-load-balancer",
            "Max": "300"
        }
    ]
}
```
Untuk informasi lebih lanjut, lihat [Kuota](https://docs.aws.amazon.com/general/latest/gr/elb.html#limits_elastic_load_balancer) di *Referensi AWS Umum*.  
+  Untuk detail API, lihat [DescribeAccountLimits](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/describe-account-limits.html)di *Referensi AWS CLI Perintah*. 

### `describe-listener-certificates`
<a name="elastic-load-balancing-v2_DescribeListenerCertificates_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`describe-listener-certificates`.

**AWS CLI**  
**Untuk mendeskripsikan sertifikat untuk pendengar yang aman**  
Contoh ini menjelaskan sertifikat untuk pendengar aman yang ditentukan.  
Perintah:  

```
aws elbv2 describe-listener-certificates --listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2
```
Output:  

```
{
  "Certificates": [
      {
          "CertificateArn": "arn:aws:acm:us-west-2:123456789012:certificate/5cc54884-f4a3-4072-80be-05b9ba72f705",
          "IsDefault": false
      },
      {
          "CertificateArn": "arn:aws:acm:us-west-2:123456789012:certificate/3dcb0a41-bd72-4774-9ad9-756919c40557",
          "IsDefault": false
      },
      {
          "CertificateArn": "arn:aws:acm:us-west-2:123456789012:certificate/fe59da96-6f58-4a22-8eed-6d0d50477e1d",
          "IsDefault": true
      }
  ]
}
```
+  Untuk detail API, lihat [DescribeListenerCertificates](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/describe-listener-certificates.html)di *Referensi AWS CLI Perintah*. 

### `describe-listeners`
<a name="elastic-load-balancing-v2_DescribeListeners_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`describe-listeners`.

**AWS CLI**  
**Untuk menggambarkan pendengar**  
Contoh ini menjelaskan pendengar yang ditentukan.  
Perintah:  

```
aws elbv2 describe-listeners --listener-arns arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2
```
Output:  

```
{
  "Listeners": [
      {
          "Port": 80,
          "Protocol": "HTTP",
          "DefaultActions": [
              {
                  "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067",
                  "Type": "forward"
              }
          ],
          "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188",
          "ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2"
      }
  ]
}
```
**Untuk menggambarkan pendengar untuk penyeimbang beban**  
Contoh ini menjelaskan pendengar untuk penyeimbang beban yang ditentukan.  
Perintah:  

```
aws elbv2 describe-listeners --load-balancer-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188
```
Output:  

```
{
  "Listeners": [
      {
          "Port": 443,
          "Protocol": "HTTPS",
          "DefaultActions": [
              {
                  "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067",
                  "Type": "forward"
              }
          ],
          "SslPolicy": "ELBSecurityPolicy-2015-05",
          "Certificates": [
              {
                  "CertificateArn": "arn:aws:iam::123456789012:server-certificate/my-server-cert"
              }
          ],
          "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188",
          "ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/0467ef3c8400ae65"
      },
      {
          "Port": 80,
          "Protocol": "HTTP",
          "DefaultActions": [
              {
                  "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067",
                  "Type": "forward"
              }
          ],
          "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188",
          "ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2"
      }
  ]
}
```
+  Untuk detail API, lihat [DescribeListeners](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/describe-listeners.html)di *Referensi AWS CLI Perintah*. 

### `describe-load-balancer-attributes`
<a name="elastic-load-balancing-v2_DescribeLoadBalancerAttributes_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`describe-load-balancer-attributes`.

**AWS CLI**  
**Untuk menggambarkan atribut penyeimbang beban**  
`describe-load-balancer-attributes`Contoh berikut menampilkan atribut penyeimbang beban tertentu.  

```
aws elbv2 describe-load-balancer-attributes \
    --load-balancer-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188
```
Contoh output berikut menunjukkan atribut untuk Application Load Balancer.  

```
{
    "Attributes": [
        {
            "Value": "false",
            "Key": "access_logs.s3.enabled"
        },
        {
            "Value": "",
            "Key": "access_logs.s3.bucket"
        },
        {
            "Value": "",
            "Key": "access_logs.s3.prefix"
        },
        {
            "Value": "60",
            "Key": "idle_timeout.timeout_seconds"
        },
        {
            "Value": "false",
            "Key": "deletion_protection.enabled"
        },
        {
            "Value": "true",
            "Key": "routing.http2.enabled"
        }
    ]
}
```
Contoh output berikut mencakup atribut untuk Network Load Balancer.  

```
{
    "Attributes": [
        {
            "Value": "false",
            "Key": "access_logs.s3.enabled"
        },
        {
            "Value": "",
            "Key": "access_logs.s3.bucket"
        },
        {
            "Value": "",
            "Key": "access_logs.s3.prefix"
        },
        {
            "Value": "false",
            "Key": "deletion_protection.enabled"
        },
        {
            "Value": "false",
            "Key": "load_balancing.cross_zone.enabled"
        }
    ]
}
```
+  Untuk detail API, lihat [DescribeLoadBalancerAttributes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/describe-load-balancer-attributes.html)di *Referensi AWS CLI Perintah*. 

### `describe-load-balancers`
<a name="elastic-load-balancing-v2_DescribeLoadBalancers_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`describe-load-balancers`.

**AWS CLI**  
**Untuk menggambarkan penyeimbang beban**  
Contoh ini menjelaskan penyeimbang beban yang ditentukan.  
Perintah:  

```
aws elbv2 describe-load-balancers --load-balancer-arns arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188
```
Output:  

```
{
  "LoadBalancers": [
      {
          "Type": "application",
          "Scheme": "internet-facing",
          "IpAddressType": "ipv4",
          "VpcId": "vpc-3ac0fb5f",
          "AvailabilityZones": [
              {
                  "ZoneName": "us-west-2a",
                  "SubnetId": "subnet-8360a9e7"
              },
              {
                  "ZoneName": "us-west-2b",
                  "SubnetId": "subnet-b7d581c0"
              }
          ],
          "CreatedTime": "2016-03-25T21:26:12.920Z",
          "CanonicalHostedZoneId": "Z2P70J7EXAMPLE",
          "DNSName": "my-load-balancer-424835706.us-west-2.elb.amazonaws.com",
          "SecurityGroups": [
              "sg-5943793c"
          ],
          "LoadBalancerName": "my-load-balancer",
          "State": {
              "Code": "active"
          },
          "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"
      }
  ]
}
```
**Untuk menggambarkan semua penyeimbang beban**  
Contoh ini menjelaskan semua penyeimbang beban Anda.  
Perintah:  

```
aws elbv2 describe-load-balancers
```
+  Untuk detail API, lihat [DescribeLoadBalancers](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/describe-load-balancers.html)di *Referensi AWS CLI Perintah*. 

### `describe-rules`
<a name="elastic-load-balancing-v2_DescribeRules_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`describe-rules`.

**AWS CLI**  
**Contoh 1: Untuk mendeskripsikan aturan**  
`describe-rules`Contoh berikut menampilkan rincian untuk aturan yang ditentukan.  

```
aws elbv2 describe-rules \
    --rule-arns arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/9683b2d02a6cabee
```
**Contoh 2: Untuk menjelaskan aturan untuk pendengar**  
`describe-rules`Contoh berikut menampilkan rincian untuk aturan untuk listener tertentu. Outputnya mencakup aturan default dan aturan lain yang telah Anda tambahkan.  

```
aws elbv2 describe-rules \
    --listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2
```
+  Untuk detail API, lihat [DescribeRules](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/describe-rules.html)di *Referensi AWS CLI Perintah*. 

### `describe-ssl-policies`
<a name="elastic-load-balancing-v2_DescribeSslPolicies_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`describe-ssl-policies`.

**AWS CLI**  
**Contoh 1: Untuk membuat daftar kebijakan yang digunakan untuk negosiasi SSL berdasarkan jenis penyeimbang beban**  
`describe-ssl-policies`Contoh berikut menampilkan nama-nama kebijakan yang dapat Anda gunakan untuk negosiasi SSL dengan Application Load Balancer. Contoh menggunakan `--query` parameter untuk menampilkan hanya nama-nama kebijakan.  

```
aws elbv2 describe-ssl-policies \
    --load-balancer-type application \
    --query SslPolicies[*].Name
```
Output:  

```
[
    "ELBSecurityPolicy-2016-08",
    "ELBSecurityPolicy-TLS13-1-2-2021-06",
    "ELBSecurityPolicy-TLS13-1-2-Res-2021-06",
    "ELBSecurityPolicy-TLS13-1-2-Ext1-2021-06",
    "ELBSecurityPolicy-TLS13-1-2-Ext2-2021-06",
    "ELBSecurityPolicy-TLS13-1-1-2021-06",
    "ELBSecurityPolicy-TLS13-1-0-2021-06",
    "ELBSecurityPolicy-TLS13-1-3-2021-06",
    "ELBSecurityPolicy-TLS-1-2-2017-01",
    "ELBSecurityPolicy-TLS-1-1-2017-01",
    "ELBSecurityPolicy-TLS-1-2-Ext-2018-06",
    "ELBSecurityPolicy-FS-2018-06",
    "ELBSecurityPolicy-2015-05",
    "ELBSecurityPolicy-TLS-1-0-2015-04",
    "ELBSecurityPolicy-FS-1-2-Res-2019-08",
    "ELBSecurityPolicy-FS-1-1-2019-08",
    "ELBSecurityPolicy-FS-1-2-2019-08",
    "ELBSecurityPolicy-FS-1-2-Res-2020-10"
]
```
**Contoh 2: Untuk membuat daftar kebijakan yang mendukung protokol tertentu**  
`describe-ssl-policies`Contoh berikut menampilkan nama-nama kebijakan yang mendukung protokol TLS 1.3. Contoh menggunakan `--query` parameter untuk menampilkan hanya nama-nama kebijakan.  

```
aws elbv2 describe-ssl-policies \
    --load-balancer-type application \
    --query SslPolicies[?contains(SslProtocols,'TLSv1.3')].Name
```
Output:  

```
[
    "ELBSecurityPolicy-TLS13-1-2-2021-06",
    "ELBSecurityPolicy-TLS13-1-2-Res-2021-06",
    "ELBSecurityPolicy-TLS13-1-2-Ext1-2021-06",
    "ELBSecurityPolicy-TLS13-1-2-Ext2-2021-06",
    "ELBSecurityPolicy-TLS13-1-1-2021-06",
    "ELBSecurityPolicy-TLS13-1-0-2021-06",
    "ELBSecurityPolicy-TLS13-1-3-2021-06"
]
```
**Contoh 3: Untuk menampilkan cipher untuk kebijakan**  
`describe-ssl-policies`Contoh berikut menampilkan nama-nama cipher untuk kebijakan yang ditentukan. Contoh menggunakan `--query` parameter untuk menampilkan hanya nama cipher. Cipher pertama dalam daftar memiliki prioritas 1, dan cipher yang tersisa berada dalam urutan prioritas.  

```
aws elbv2 describe-ssl-policies \
    --names ELBSecurityPolicy-TLS13-1-2-2021-06 \
    --query SslPolicies[*].Ciphers[*].Name
```
Output:  

```
[
    "TLS_AES_128_GCM_SHA256",
    "TLS_AES_256_GCM_SHA384",
    "TLS_CHACHA20_POLY1305_SHA256",
    "ECDHE-ECDSA-AES128-GCM-SHA256",
    "ECDHE-RSA-AES128-GCM-SHA256",
    "ECDHE-ECDSA-AES128-SHA256",
    "ECDHE-RSA-AES128-SHA256",
    "ECDHE-ECDSA-AES256-GCM-SHA384",
    "ECDHE-RSA-AES256-GCM-SHA384",
    "ECDHE-ECDSA-AES256-SHA384",
    "ECDHE-RSA-AES256-SHA384"
]
```
Untuk informasi selengkapnya, lihat [Kebijakan keamanan](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html#describe-ssl-policies) di *Panduan Pengguna untuk Penyeimbang Beban Aplikasi*.  
+  Untuk detail API, lihat [DescribeSslPolicies](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/describe-ssl-policies.html)di *Referensi AWS CLI Perintah*. 

### `describe-tags`
<a name="elastic-load-balancing-v2_DescribeTags_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`describe-tags`.

**AWS CLI**  
**Untuk mendeskripsikan tag yang ditetapkan ke penyeimbang beban**  
Contoh ini menjelaskan tag yang ditetapkan untuk penyeimbang beban yang ditentukan.  
Perintah:  

```
aws elbv2 describe-tags --resource-arns arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188
```
Output:  

```
{
  "TagDescriptions": [
      {
          "ResourceArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188",
          "Tags": [
              {
                  "Value": "lima",
                  "Key": "project"
              },
              {
                  "Value": "digital-media",
                  "Key": "department"
              }
          ]
      }
  ]
}
```
+  Untuk detail API, lihat [DescribeTags](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/describe-tags.html)di *Referensi AWS CLI Perintah*. 

### `describe-target-group-attributes`
<a name="elastic-load-balancing-v2_DescribeTargetGroupAttributes_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`describe-target-group-attributes`.

**AWS CLI**  
**Untuk menggambarkan atribut kelompok sasaran**  
`describe-target-group-attributes`Contoh berikut menampilkan atribut dari kelompok target yang ditentukan.  

```
aws elbv2 describe-target-group-attributes \
    --target-group-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067
```
Output mencakup atribut jika protokolnya HTTP atau HTTPS dan tipe targetnya adalah `instance` atau`ip`.  

```
{
    "Attributes": [
        {
            "Value": "false",
            "Key": "stickiness.enabled"
        },
        {
            "Value": "300",
            "Key": "deregistration_delay.timeout_seconds"
        },
        {
            "Value": "lb_cookie",
            "Key": "stickiness.type"
        },
        {
            "Value": "86400",
            "Key": "stickiness.lb_cookie.duration_seconds"
        },
        {
            "Value": "0",
            "Key": "slow_start.duration_seconds"
        }
    ]
}
```
Output berikut mencakup atribut jika protokolnya HTTP atau HTTPS dan tipe targetnya adalah`lambda`.  

```
{
    "Attributes": [
        {
            "Value": "false",
            "Key": "lambda.multi_value_headers.enabled"
        }
    ]
}
```
Output berikut mencakup atribut jika protokolnya adalah TCP, TLS, UDP, atau TCP\$1UDP.  

```
{
    "Attributes": [
        {
            "Value": "false",
            "Key": "proxy_protocol_v2.enabled"
        },
        {
            "Value": "300",
            "Key": "deregistration_delay.timeout_seconds"
        }
    ]
}
```
+  Untuk detail API, lihat [DescribeTargetGroupAttributes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/describe-target-group-attributes.html)di *Referensi AWS CLI Perintah*. 

### `describe-target-groups`
<a name="elastic-load-balancing-v2_DescribeTargetGroups_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`describe-target-groups`.

**AWS CLI**  
**Contoh 1: Untuk mendeskripsikan kelompok sasaran**  
`describe-target-groups`Contoh berikut menampilkan rincian untuk kelompok target yang ditentukan.  

```
aws elbv2 describe-target-groups \
    --target-group-arns arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067
```
Output:  

```
{
    "TargetGroups": [
        {
            "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067",
            "TargetGroupName": "my-targets",
            "Protocol": "HTTP",
            "Port": 80,
            "VpcId": "vpc-3ac0fb5f",
            "HealthCheckProtocol": "HTTP",
            "HealthCheckPort": "traffic-port",
            "HealthCheckEnabled": true,
            "HealthCheckIntervalSeconds": 30,
            "HealthCheckTimeoutSeconds": 5,
            "HealthyThresholdCount": 5,
            "UnhealthyThresholdCount": 2,
            "HealthCheckPath": "/",
            "Matcher": {
                "HttpCode": "200"
            },
            "LoadBalancerArns": [
                "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"
            ],
            "TargetType": "instance",
            "ProtocolVersion": "HTTP1",
            "IpAddressType": "ipv4"
        }
    ]
}
```
**Contoh 2: Untuk mendeskripsikan semua kelompok target untuk penyeimbang beban**  
`describe-target-groups`Contoh berikut menampilkan rincian untuk semua kelompok target untuk penyeimbang beban tertentu. Contoh menggunakan `--query` parameter untuk menampilkan hanya nama grup target.  

```
aws elbv2 describe-target-groups \
    --load-balancer-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188 \
    --query TargetGroups[*].TargetGroupName
```
Output:  

```
[
    "my-instance-targets",
    "my-ip-targets",
    "my-lambda-target"
]
```
Untuk informasi selengkapnya, lihat [Grup sasaran](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html) dalam Panduan *Penyeimbang Beban Aplikasi*.  
+  Untuk detail API, lihat [DescribeTargetGroups](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/describe-target-groups.html)di *Referensi AWS CLI Perintah*. 

### `describe-target-health`
<a name="elastic-load-balancing-v2_DescribeTargetHealth_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`describe-target-health`.

**AWS CLI**  
**Contoh 1: Untuk menggambarkan kesehatan target untuk kelompok sasaran**  
`describe-target-health`Contoh berikut menampilkan rincian kesehatan untuk target kelompok target yang ditentukan. Target ini sehat.  

```
aws elbv2 describe-target-health \
    --target-group-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067
```
Output:  

```
{
    "TargetHealthDescriptions": [
        {
            "HealthCheckPort": "80",
            "Target": {
                "Id": "i-ceddcd4d",
                "Port": 80
            },
            "TargetHealth": {
                "State": "healthy"
            }
        },
        {
            "HealthCheckPort": "80",
            "Target": {
                "Id": "i-0f76fade",
                "Port": 80
            },
            "TargetHealth": {
                "State": "healthy"
            }
        }
    ]
}
```
**Contoh 2: Untuk menggambarkan kesehatan target**  
`describe-target-health`Contoh berikut menampilkan rincian kesehatan untuk target yang ditentukan. Target ini sehat.  

```
aws elbv2 describe-target-health \
    --targets Id=i-0f76fade,Port=80 \
    --target-group-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067
```
Output:  

```
{
    "TargetHealthDescriptions": [
        {
            "HealthCheckPort": "80",
            "Target": {
                "Id": "i-0f76fade",
                "Port": 80
            },
            "TargetHealth": {
                "State": "healthy"
            }
        }
    ]
}
```
Contoh output berikut adalah untuk target yang kelompok targetnya tidak ditentukan dalam tindakan untuk pendengar. Target ini tidak dapat menerima lalu lintas dari penyeimbang beban.  

```
{
    "TargetHealthDescriptions": [
    {
        "HealthCheckPort": "80",
        "Target": {
            "Id": "i-0f76fade",
            "Port": 80
        },
            "TargetHealth": {
                "State": "unused",
                "Reason": "Target.NotInUse",
                "Description": "Target group is not configured to receive traffic from the load balancer"
            }
        }
    ]
}
```
Contoh output berikut adalah untuk target yang kelompok targetnya hanya ditentukan dalam tindakan untuk pendengar. Targetnya masih didaftarkan.  

```
{
    "TargetHealthDescriptions": [
        {
            "HealthCheckPort": "80",
            "Target": {
                "Id": "i-0f76fade",
                "Port": 80
            },
            "TargetHealth": {
                "State": "initial",
                "Reason": "Elb.RegistrationInProgress",
                "Description": "Target registration is in progress"
            }
        }
    ]
}
```
Contoh output berikut adalah untuk target yang tidak sehat.  

```
{
    "TargetHealthDescriptions": [
        {
            "HealthCheckPort": "80",
            "Target": {
                "Id": "i-0f76fade",
                "Port": 80
            },
            "TargetHealth": {
                "State": "unhealthy",
                "Reason": "Target.Timeout",
                "Description": "Connection to target timed out"
            }
        }
    ]
}
```
Contoh output berikut adalah untuk target yang merupakan fungsi Lambda dan pemeriksaan kesehatan dinonaktifkan.  

```
{
    "TargetHealthDescriptions": [
        {
            "Target": {
                "Id": "arn:aws:lambda:us-west-2:123456789012:function:my-function",
                "AvailabilityZone": "all",
            },
            "TargetHealth": {
                "State": "unavailable",
                "Reason": "Target.HealthCheckDisabled",
                "Description": "Health checks are not enabled for this target"
            }
        }
    ]
}
```
+  Untuk detail API, lihat [DescribeTargetHealth](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/describe-target-health.html)di *Referensi AWS CLI Perintah*. 

### `modify-listener`
<a name="elastic-load-balancing-v2_ModifyListener_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`modify-listener`.

**AWS CLI**  
**Contoh 1: Untuk mengubah tindakan default menjadi tindakan maju**  
`modify-listener`Contoh berikut mengubah tindakan default menjadi `forward` tindakan untuk listener tertentu.  

```
aws elbv2 modify-listener \
    --listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2 \
    --default-actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/2453ed029918f21f
```
Output:  

```
{
    "Listeners": [
        {
            "ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2",
            "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188",
            "Protocol": "HTTP",
            "Port": 80,
            "DefaultActions": [
                {
                    "Type": "forward",
                    "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/2453ed029918f21f"
                }
            ]
        }
    ]
}
```
**Contoh 2: Untuk mengubah tindakan default menjadi tindakan pengalihan**  
`modify-listener`Contoh berikut mengubah tindakan default menjadi `redirect` tindakan untuk listener tertentu.  

```
aws elbv2 modify-listener \
    --listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2 \
    --default-actions Type=redirect, RedirectConfig='{Protocol=HTTPS,StatusCode=HTTP_302}'
```
Output:  

```
{
    "Listeners": [
        {
            "ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2",
            "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188",
            "Protocol": "HTTP",
            "Port": 80,
            "DefaultActions": [
                {
                    "Type": "redirect",
                    "RedirectConfig": {
                        "Protocol": "HTTPS",
                        "Port": "#{port}",
                        "Host": "#{host}",
                        "Path": "/#{path}",
                        "Query": "#{query}",
                        "StatusCode": "HTTP_302",
                    }
                }
            ]
        }
    ]
}
```
**Contoh 3: Untuk mengubah sertifikat server**  
`modify-listener`Contoh berikut mengubah sertifikat server untuk listener HTTPS yang ditentukan.  

```
aws elbv2 modify-listener \
    --listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/0467ef3c8400ae65 \
    --certificates CertificateArn=arn:aws:iam::123456789012:server-certificate/my-new-server-cert
```
Output:  

```
{
    "Listeners": [
        {
            "ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/0467ef3c8400ae65",
            "LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188",
            "Protocol": "HTTPS",
            "Port": 443,
            "DefaultActions": [
                {
                    "Type": "forward",
                    "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"
                }
            ],
            "SslPolicy": "ELBSecurityPolicy-2015-05",
            "Certificates": [
                {
                    "CertificateArn": "arn:aws:iam::123456789012:server-certificate/my-new-server-cert"
                }
            ],
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Aturan Listener di Panduan](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html#listener-rules) Pengguna *Application Load Balancers.*  
+  Untuk detail API, lihat [ModifyListener](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/modify-listener.html)di *Referensi AWS CLI Perintah*. 

### `modify-load-balancer-attributes`
<a name="elastic-load-balancing-v2_ModifyLoadBalancerAttributes_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`modify-load-balancer-attributes`.

**AWS CLI**  
**Untuk mengaktifkan perlindungan penghapusan**  
Contoh ini memungkinkan perlindungan penghapusan untuk penyeimbang beban yang ditentukan.  
Perintah:  

```
aws elbv2 modify-load-balancer-attributes --load-balancer-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188 --attributes Key=deletion_protection.enabled,Value=true
```
Output:  

```
{
  "Attributes": [
      {
          "Value": "true",
          "Key": "deletion_protection.enabled"
      },
      {
          "Value": "false",
          "Key": "access_logs.s3.enabled"
      },
      {
          "Value": "60",
          "Key": "idle_timeout.timeout_seconds"
      },
      {
          "Value": "",
          "Key": "access_logs.s3.prefix"
      },
      {
          "Value": "",
          "Key": "access_logs.s3.bucket"
      }
  ]
}
```
**Untuk mengubah batas waktu idle**  
Contoh ini mengubah nilai batas waktu idle untuk penyeimbang beban yang ditentukan.  
Perintah:  

```
aws elbv2 modify-load-balancer-attributes --load-balancer-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188 --attributes Key=idle_timeout.timeout_seconds,Value=30
```
Output:  

```
{
  "Attributes": [
      {
          "Value": "30",
          "Key": "idle_timeout.timeout_seconds"
      },
      {
          "Value": "false",
          "Key": "access_logs.s3.enabled"
      },
      {
          "Value": "",
          "Key": "access_logs.s3.prefix"
      },
      {
          "Value": "true",
          "Key": "deletion_protection.enabled"
      },
      {
          "Value": "",
          "Key": "access_logs.s3.bucket"
      }
  ]
}
```
**Untuk mengaktifkan log akses**  
Contoh ini memungkinkan log akses untuk penyeimbang beban yang ditentukan. Perhatikan bahwa bucket S3 harus berada di wilayah yang sama dengan penyeimbang beban dan harus memiliki kebijakan yang dilampirkan yang memberikan akses ke layanan Elastic Load Balancing.  
Perintah:  

```
aws elbv2 modify-load-balancer-attributes --load-balancer-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188 --attributes Key=access_logs.s3.enabled,Value=true Key=access_logs.s3.bucket,Value=my-loadbalancer-logs Key=access_logs.s3.prefix,Value=myapp
```
Output:  

```
{
  "Attributes": [
      {
          "Value": "true",
          "Key": "access_logs.s3.enabled"
      },
      {
          "Value": "my-load-balancer-logs",
          "Key": "access_logs.s3.bucket"
      },
      {
          "Value": "myapp",
          "Key": "access_logs.s3.prefix"
      },
      {
          "Value": "60",
          "Key": "idle_timeout.timeout_seconds"
      },
      {
          "Value": "false",
          "Key": "deletion_protection.enabled"
      }
  ]
}
```
+  Untuk detail API, lihat [ModifyLoadBalancerAttributes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/modify-load-balancer-attributes.html)di *Referensi AWS CLI Perintah*. 

### `modify-rule`
<a name="elastic-load-balancing-v2_ModifyRule_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`modify-rule`.

**AWS CLI**  
**Untuk memodifikasi aturan**  
`modify-rule`Contoh berikut memperbarui tindakan dan kondisi untuk aturan yang ditentukan.  

```
aws elbv2 modify-rule \
  --actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067 \
  --conditions Field=path-pattern,Values='/images/*'
  --rule-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/9683b2d02a6cabee
```
Output:  

```
{
    "Rules": [
        {
            "Priority": "10",
            "Conditions": [
                {
                    "Field": "path-pattern",
                    "Values": [
                        "/images/*"
                    ]
                }
            ],
            "RuleArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/9683b2d02a6cabee",
            "IsDefault": false,
            "Actions": [
                {
                    "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067",
                    "Type": "forward"
                }
            ]
        }
    ]
}
```
+  Untuk detail API, lihat [ModifyRule](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/modify-rule.html)di *Referensi AWS CLI Perintah*. 

### `modify-target-group-attributes`
<a name="elastic-load-balancing-v2_ModifyTargetGroupAttributes_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`modify-target-group-attributes`.

**AWS CLI**  
**Untuk mengubah batas waktu tunda deregistrasi**  
Contoh ini menetapkan batas waktu tunda deregistrasi ke nilai yang ditentukan untuk kelompok target yang ditentukan.  
Perintah:  

```
aws elbv2 modify-target-group-attributes --target-group-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067 --attributes Key=deregistration_delay.timeout_seconds,Value=600
```
Output:  

```
{
  "Attributes": [
      {
          "Value": "false",
          "Key": "stickiness.enabled"
      },
      {
          "Value": "600",
          "Key": "deregistration_delay.timeout_seconds"
      },
      {
          "Value": "lb_cookie",
          "Key": "stickiness.type"
      },
      {
          "Value": "86400",
          "Key": "stickiness.lb_cookie.duration_seconds"
      }
  ]
}
```
+  Untuk detail API, lihat [ModifyTargetGroupAttributes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/modify-target-group-attributes.html)di *Referensi AWS CLI Perintah*. 

### `modify-target-group`
<a name="elastic-load-balancing-v2_ModifyTargetGroup_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`modify-target-group`.

**AWS CLI**  
**Untuk memodifikasi konfigurasi pemeriksaan kesehatan untuk grup target**  
`modify-target-group`Contoh berikut mengubah konfigurasi pemeriksaan kesehatan yang digunakan untuk mengevaluasi kesehatan target untuk kelompok sasaran yang ditentukan. Perhatikan bahwa karena cara CLI mem-parsing koma, Anda harus mengelilingi rentang `--matcher` opsi dengan tanda kutip tunggal alih-alih tanda kutip ganda.  

```
aws elbv2 modify-target-group \
    --target-group-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-https-targets/2453ed029918f21f \
    --health-check-protocol HTTPS \
    --health-check-port 443 \
    --matcher HttpCode='200,299'
```
Output:  

```
{
    "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"
        }
    ]
}
```
Untuk informasi selengkapnya, lihat [Grup sasaran](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html) dalam Panduan *Penyeimbang Beban Aplikasi*.  
+  Untuk detail API, lihat [ModifyTargetGroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/modify-target-group.html)di *Referensi AWS CLI Perintah*. 

### `register-targets`
<a name="elastic-load-balancing-v2_RegisterTargets_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`register-targets`.

**AWS CLI**  
**Contoh 1: Untuk mendaftarkan target dengan grup target dengan ID instance**  
`register-targets`Contoh berikut mendaftarkan instance tertentu dengan kelompok target. Kelompok sasaran harus memiliki jenis target`instance`.  

```
aws elbv2 register-targets \
    --target-group-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067 \
    --targets Id=i-1234567890abcdef0 Id=i-0abcdef1234567890
```
**Contoh 2: Untuk mendaftarkan target dengan grup target menggunakan penggantian port**  
`register-targets`Contoh berikut mendaftarkan instance tertentu dengan kelompok target menggunakan beberapa port. Ini memungkinkan Anda untuk mendaftarkan kontainer pada instance yang sama dengan target dalam grup target.  

```
aws elbv2 register-targets \
    --target-group-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-internal-targets/3bb63f11dfb0faf9 \
    --targets Id=i-0598c7d356eba48d7,Port=80 Id=i-0598c7d356eba48d7,Port=766
```
**Contoh 3: Untuk mendaftarkan target dengan grup target berdasarkan alamat IP**  
`register-targets`Contoh berikut mendaftarkan alamat IP yang ditentukan dengan kelompok target. Kelompok sasaran harus memiliki jenis target`ip`.  

```
aws elbv2 register-targets \
    --target-group-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-tcp-ip-targets/8518e899d173178f \
    --targets Id=10.0.1.15 Id=10.0.1.23
```
**Contoh 4: Untuk mendaftarkan fungsi Lambda sebagai target**  
`register-targets`Contoh berikut mendaftarkan alamat IP yang ditentukan dengan kelompok target. Kelompok sasaran harus memiliki jenis target`lambda`. Anda harus memberikan izin Elastic Load Balancing untuk menjalankan fungsi Lambda.  

```
aws elbv2 register-targets \
    --target-group-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-tcp-ip-targets/8518e899d173178f \
    --targets Id=arn:aws:lambda:us-west-2:123456789012:function:my-function
```
+  Untuk detail API, lihat [RegisterTargets](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/register-targets.html)di *Referensi AWS CLI Perintah*. 

### `remove-listener-certificates`
<a name="elastic-load-balancing-v2_RemoveListenerCertificates_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`remove-listener-certificates`.

**AWS CLI**  
**Untuk menghapus sertifikat dari pendengar yang aman**  
Contoh ini menghapus sertifikat yang ditentukan dari pendengar aman yang ditentukan.  
Perintah:  

```
aws elbv2 remove-listener-certificates --listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2 --certificates CertificateArn=arn:aws:acm:us-west-2:123456789012:certificate/5cc54884-f4a3-4072-80be-05b9ba72f705
```
+  Untuk detail API, lihat [RemoveListenerCertificates](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/remove-listener-certificates.html)di *Referensi AWS CLI Perintah*. 

### `remove-tags`
<a name="elastic-load-balancing-v2_RemoveTags_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`remove-tags`.

**AWS CLI**  
**Untuk menghapus tag dari penyeimbang beban**  
`remove-tags`Contoh berikut menghapus `project` dan `department` tag dari penyeimbang beban yang ditentukan.  

```
aws elbv2 remove-tags \
    --resource-arns arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188 \
    --tag-keys project department
```
+  Untuk detail API, lihat [RemoveTags](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/remove-tags.html)di *Referensi AWS CLI Perintah*. 

### `set-ip-address-type`
<a name="elastic-load-balancing-v2_SetIpAddressType_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`set-ip-address-type`.

**AWS CLI**  
**Untuk mengatur jenis alamat penyeimbang beban**  
Contoh ini menetapkan jenis alamat penyeimbang beban yang ditentukan ke`dualstack`. Subnet penyeimbang beban harus memiliki blok IPv6 CIDR yang terkait.  
Perintah:  

```
aws elbv2 set-ip-address-type --load-balancer-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188 --ip-address-type dualstack
```
Output:  

```
{
    "IpAddressType": "dualstack"
}
```
+  Untuk detail API, lihat [SetIpAddressType](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/set-ip-address-type.html)di *Referensi AWS CLI Perintah*. 

### `set-rule-priorities`
<a name="elastic-load-balancing-v2_SetRulePriorities_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`set-rule-priorities`.

**AWS CLI**  
**Untuk menetapkan prioritas aturan**  
Contoh ini menetapkan prioritas aturan yang ditentukan.  
Perintah:  

```
aws elbv2 set-rule-priorities --rule-priorities RuleArn=arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/1291d13826f405c3,Priority=5
```
Output:  

```
{
  "Rules": [
      {
          "Priority": "5",
          "Conditions": [
              {
                  "Field": "path-pattern",
                  "Values": [
                      "/img/*"
                  ]
              }
          ],
          "RuleArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/1291d13826f405c3",
          "IsDefault": false,
          "Actions": [
              {
                  "TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067",
                  "Type": "forward"
              }
          ]
      }
  ]
}
```
+  Untuk detail API, lihat [SetRulePriorities](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/set-rule-priorities.html)di *Referensi AWS CLI Perintah*. 

### `set-security-groups`
<a name="elastic-load-balancing-v2_SetSecurityGroups_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`set-security-groups`.

**AWS CLI**  
**Untuk mengaitkan grup keamanan dengan penyeimbang beban**  
Contoh ini mengaitkan grup keamanan yang ditentukan dengan penyeimbang beban yang ditentukan.  
Perintah:  

```
aws elbv2 set-security-groups --load-balancer-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188 --security-groups sg-5943793c
```
Output:  

```
{
  "SecurityGroupIds": [
      "sg-5943793c"
  ]
}
```
+  Untuk detail API, lihat [SetSecurityGroups](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/set-security-groups.html)di *Referensi AWS CLI Perintah*. 

### `set-subnets`
<a name="elastic-load-balancing-v2_SetSubnets_cli_topic"></a>

Contoh kode berikut menunjukkan cara menggunakan`set-subnets`.

**AWS CLI**  
**Untuk mengaktifkan Availability Zones untuk load balancer**  
Contoh ini memungkinkan Availability Zone untuk subnet yang ditentukan untuk load balancer yang ditentukan.  
Perintah:  

```
aws elbv2 set-subnets --load-balancer-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188 --subnets subnet-8360a9e7 subnet-b7d581c0
```
Output:  

```
{
  "AvailabilityZones": [
      {
          "SubnetId": "subnet-8360a9e7",
          "ZoneName": "us-west-2a"
      },
      {
          "SubnetId": "subnet-b7d581c0",
          "ZoneName": "us-west-2b"
      }
  ]
}
```
+  Untuk detail API, lihat [SetSubnets](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/set-subnets.html)di *Referensi AWS CLI Perintah*. 