Gunakan DescribeScalingActivities dengan CLI - AWS SDKContoh Kode

Ada lebih banyak AWS SDK contoh yang tersedia di GitHub repo SDKContoh AWS Dokumen.

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

Gunakan DescribeScalingActivities dengan CLI

Contoh kode berikut menunjukkan cara menggunakanDescribeScalingActivities.

CLI
AWS CLI

Contoh 1: Untuk menjelaskan aktivitas penskalaan untuk layanan Amazon ECS yang ditentukan

describe-scaling-activitiesContoh berikut menjelaskan aktivitas penskalaan untuk ECS layanan Amazon yang disebut web-app yang berjalan di default cluster. Output menunjukkan aktivitas penskalaan yang diprakarsai oleh kebijakan penskalaan.

aws application-autoscaling describe-scaling-activities \ --service-namespace ecs \ --resource-id service/default/web-app

Output:

{ "ScalingActivities": [ { "ScalableDimension": "ecs:service:DesiredCount", "Description": "Setting desired count to 1.", "ResourceId": "service/default/web-app", "ActivityId": "e6c5f7d1-dbbb-4a3f-89b2-51f33e766399", "StartTime": 1462575838.171, "ServiceNamespace": "ecs", "EndTime": 1462575872.111, "Cause": "monitor alarm web-app-cpu-lt-25 in state ALARM triggered policy web-app-cpu-lt-25", "StatusMessage": "Successfully set desired count to 1. Change successfully fulfilled by ecs.", "StatusCode": "Successful" } ] }

Untuk informasi selengkapnya, lihat Aktivitas penskalaan untuk Application Auto Scaling di Panduan Pengguna Application Auto Scaling.

Contoh 2: Untuk menggambarkan aktivitas penskalaan untuk tabel DynamoDB yang ditentukan

describe-scaling-activitiesContoh berikut menjelaskan aktivitas penskalaan untuk tabel DynamoDB yang disebut. TestTable Output menunjukkan aktivitas penskalaan yang diprakarsai oleh dua tindakan terjadwal yang berbeda.

aws application-autoscaling describe-scaling-activities \ --service-namespace dynamodb \ --resource-id table/TestTable

Output:

{ "ScalingActivities": [ { "ScalableDimension": "dynamodb:table:WriteCapacityUnits", "Description": "Setting write capacity units to 10.", "ResourceId": "table/my-table", "ActivityId": "4d1308c0-bbcf-4514-a673-b0220ae38547", "StartTime": 1561574415.086, "ServiceNamespace": "dynamodb", "EndTime": 1561574449.51, "Cause": "maximum capacity was set to 10", "StatusMessage": "Successfully set write capacity units to 10. Change successfully fulfilled by dynamodb.", "StatusCode": "Successful" }, { "ScalableDimension": "dynamodb:table:WriteCapacityUnits", "Description": "Setting min capacity to 5 and max capacity to 10", "ResourceId": "table/my-table", "ActivityId": "f2b7847b-721d-4e01-8ef0-0c8d3bacc1c7", "StartTime": 1561574414.644, "ServiceNamespace": "dynamodb", "Cause": "scheduled action name my-second-scheduled-action was triggered", "StatusMessage": "Successfully set min capacity to 5 and max capacity to 10", "StatusCode": "Successful" }, { "ScalableDimension": "dynamodb:table:WriteCapacityUnits", "Description": "Setting write capacity units to 15.", "ResourceId": "table/my-table", "ActivityId": "d8ea4de6-9eaa-499f-b466-2cc5e681ba8b", "StartTime": 1561574108.904, "ServiceNamespace": "dynamodb", "EndTime": 1561574140.255, "Cause": "minimum capacity was set to 15", "StatusMessage": "Successfully set write capacity units to 15. Change successfully fulfilled by dynamodb.", "StatusCode": "Successful" }, { "ScalableDimension": "dynamodb:table:WriteCapacityUnits", "Description": "Setting min capacity to 15 and max capacity to 20", "ResourceId": "table/my-table", "ActivityId": "3250fd06-6940-4e8e-bb1f-d494db7554d2", "StartTime": 1561574108.512, "ServiceNamespace": "dynamodb", "Cause": "scheduled action name my-first-scheduled-action was triggered", "StatusMessage": "Successfully set min capacity to 15 and max capacity to 20", "StatusCode": "Successful" } ] }

Untuk informasi selengkapnya, lihat Aktivitas penskalaan untuk Application Auto Scaling di Panduan Pengguna Application Auto Scaling.

PowerShell
Alat untuk PowerShell

Contoh 1: Memberikan informasi deskriptif tentang aktivitas penskalaan di namespace yang ditentukan dari enam minggu sebelumnya.

Get-AASScalingActivity -ServiceNamespace AppStream

Output:

ActivityId : 2827409f-b639-4cdb-a957-8055d5d07434 Cause : monitor alarm Appstream2-MyFleet-default-scale-in-Alarm in state ALARM triggered policy default-scale-in Description : Setting desired capacity to 2. Details : EndTime : 12/14/2019 11:32:49 AM ResourceId : fleet/MyFleet ScalableDimension : appstream:fleet:DesiredCapacity ServiceNamespace : appstream StartTime : 12/14/2019 11:32:14 AM StatusCode : Successful StatusMessage : Successfully set desired capacity to 2. Change successfully fulfilled by appstream.