View a markdown version of this page

Contoh Manajer Sistem menggunakan AWS CLI - AWS Command Line Interface

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

Contoh Manajer Sistem menggunakan AWS CLI

Contoh kode berikut menunjukkan cara melakukan tindakan dan menerapkan skenario umum dengan menggunakan AWS Command Line Interface with Systems Manager.

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.

Tindakan

Contoh kode berikut menunjukkan cara menggunakanadd-tags-to-resource.

AWS CLI

Contoh 1: Untuk menambahkan tag ke jendela pemeliharaan

add-tags-to-resourceContoh berikut menambahkan tag ke jendela pemeliharaan yang ditentukan.

aws ssm add-tags-to-resource \ --resource-type "MaintenanceWindow" \ --resource-id "mw-03eb9db428EXAMPLE" \ --tags "Key=Stack,Value=Production"

Perintah ini tidak menghasilkan output.

Contoh 2: Untuk menambahkan tag ke parameter

add-tags-to-resourceContoh berikut menambahkan dua tag ke parameter yang ditentukan.

aws ssm add-tags-to-resource \ --resource-type "Parameter" \ --resource-id "My-Parameter" \ --tags '[{"Key":"Region","Value":"East"},{"Key":"Environment", "Value":"Production"}]'

Perintah ini tidak menghasilkan output.

Contoh 3: Untuk menambahkan tag ke dokumen SSM

add-tags-to-resourceContoh berikut menambahkan tag ke dokumen yang ditentukan.

aws ssm add-tags-to-resource \ --resource-type "Document" \ --resource-id "My-Document" \ --tags "Key=Quarter,Value=Q322"

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Menandai sumber daya Manajer Sistem di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanassociate-ops-item-related-item.

AWS CLI

Untuk mengaitkan item terkait

associate-ops-item-related-itemContoh berikut mengaitkan item terkait dengan OpsItem.

aws ssm associate-ops-item-related-item \ --ops-item-id "oi-649fExample" \ --association-type "RelatesTo" \ --resource-type "AWS::SSMIncidents::IncidentRecord" \ --resource-uri "arn:aws:ssm-incidents::111122223333:incident-record/Example-Response-Plan/c2bde883-f7d5-343a-b13a-bf5fe9ea689f"

Output:

{ "AssociationId": "61d7178d-a30d-4bc5-9b4e-a9e74EXAMPLE" }

Untuk informasi selengkapnya, lihat Bekerja dengan insiden Manajer Insiden OpsCenter di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakancancel-command.

AWS CLI

Contoh 1: Untuk membatalkan perintah untuk semua instance

cancel-commandContoh berikut mencoba untuk membatalkan perintah yang ditentukan yang sudah berjalan untuk semua instance.

aws ssm cancel-command \ --command-id "662add3d-5831-4a10-b64a-f2ff3EXAMPLE"

Perintah ini tidak menghasilkan output.

Contoh 2: Untuk membatalkan perintah untuk contoh tertentu

cancel-commandContoh berikut mencoba membatalkan perintah untuk instance yang ditentukan saja.

aws ssm cancel-command \ --command-id "662add3d-5831-4a10-b64a-f2ff3EXAMPLE" --instance-ids "i-02573cafcfEXAMPLE"

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Menandai Parameter Manajer Sistem di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakancancel-maintenance-window-execution.

AWS CLI

Untuk membatalkan eksekusi jendela pemeliharaan

cancel-maintenance-window-executionContoh ini menghentikan eksekusi jendela pemeliharaan yang ditentukan yang sudah berlangsung.

aws ssm cancel-maintenance-window-execution \ --window-execution-id j2l8d5b5c-mw66-tk4d-r3g9-1d4d1EXAMPLE

Output:

{ "WindowExecutionId": "j2l8d5b5c-mw66-tk4d-r3g9-1d4d1EXAMPLE" }

Untuk informasi selengkapnya, lihat Tutorial Windows Pemeliharaan Manajer AWS Sistem (CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakancreate-activation.

AWS CLI

Untuk membuat aktivasi instans terkelola

create-activationContoh berikut membuat aktivasi instance terkelola.

aws ssm create-activation \ --default-instance-name "HybridWebServers" \ --iam-role "HybridWebServersRole" \ --registration-limit 5

Output:

{ "ActivationId": "5743558d-563b-4457-8682-d16c3EXAMPLE", "ActivationCode": "dRmgnYaFv567vEXAMPLE" }

Untuk informasi selengkapnya, lihat Langkah 4: Membuat Managed-Instance Aktivasi untuk Lingkungan Hibrid di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakancreate-association-batch.

AWS CLI

Untuk membuat beberapa asosiasi

Contoh ini mengaitkan dokumen konfigurasi dengan beberapa instance. Output mengembalikan daftar operasi yang berhasil dan gagal, jika berlaku.

Perintah:

aws ssm create-association-batch --entries "Name=AWS-UpdateSSMAgent,InstanceId=i-1234567890abcdef0" "Name=AWS-UpdateSSMAgent,InstanceId=i-9876543210abcdef0"

Output:

{ "Successful": [ { "Name": "AWS-UpdateSSMAgent", "InstanceId": "i-1234567890abcdef0", "AssociationVersion": "1", "Date": 1550504725.007, "LastUpdateAssociationDate": 1550504725.007, "Status": { "Date": 1550504725.007, "Name": "Associated", "Message": "Associated with AWS-UpdateSSMAgent" }, "Overview": { "Status": "Pending", "DetailedStatus": "Creating" }, "DocumentVersion": "$DEFAULT", "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "Targets": [ { "Key": "InstanceIds", "Values": [ "i-1234567890abcdef0" ] } ] }, { "Name": "AWS-UpdateSSMAgent", "InstanceId": "i-9876543210abcdef0", "AssociationVersion": "1", "Date": 1550504725.057, "LastUpdateAssociationDate": 1550504725.057, "Status": { "Date": 1550504725.057, "Name": "Associated", "Message": "Associated with AWS-UpdateSSMAgent" }, "Overview": { "Status": "Pending", "DetailedStatus": "Creating" }, "DocumentVersion": "$DEFAULT", "AssociationId": "9c9f7f20-5154-4fed-a83e-0123456789ab", "Targets": [ { "Key": "InstanceIds", "Values": [ "i-9876543210abcdef0" ] } ] } ], "Failed": [] }

Contoh kode berikut menunjukkan cara menggunakancreate-association.

AWS CLI

Contoh 1: Untuk mengaitkan dokumen menggunakan ID instance

Contoh ini mengaitkan dokumen konfigurasi dengan instance, menggunakan ID instance.

aws ssm create-association \ --instance-id "i-0cb2b964d3e14fd9f" \ --name "AWS-UpdateSSMAgent"

Output:

{ "AssociationDescription": { "Status": { "Date": 1487875500.33, "Message": "Associated with AWS-UpdateSSMAgent", "Name": "Associated" }, "Name": "AWS-UpdateSSMAgent", "InstanceId": "i-0cb2b964d3e14fd9f", "Overview": { "Status": "Pending", "DetailedStatus": "Creating" }, "AssociationId": "b7c3266e-a544-44db-877e-b20d3a108189", "DocumentVersion": "$DEFAULT", "LastUpdateAssociationDate": 1487875500.33, "Date": 1487875500.33, "Targets": [ { "Values": [ "i-0cb2b964d3e14fd9f" ], "Key": "InstanceIds" } ] } }

Untuk informasi selengkapnya, lihat CreateAssociation Referensi API Manajer AWS Sistem.

Contoh 2: Untuk mengaitkan dokumen menggunakan target

Contoh ini mengaitkan dokumen konfigurasi dengan instance, menggunakan target.

aws ssm create-association \ --name "AWS-UpdateSSMAgent" \ --targets "Key=instanceids,Values=i-0cb2b964d3e14fd9f"

Output:

{ "AssociationDescription": { "Status": { "Date": 1487875500.33, "Message": "Associated with AWS-UpdateSSMAgent", "Name": "Associated" }, "Name": "AWS-UpdateSSMAgent", "InstanceId": "i-0cb2b964d3e14fd9f", "Overview": { "Status": "Pending", "DetailedStatus": "Creating" }, "AssociationId": "b7c3266e-a544-44db-877e-b20d3a108189", "DocumentVersion": "$DEFAULT", "LastUpdateAssociationDate": 1487875500.33, "Date": 1487875500.33, "Targets": [ { "Values": [ "i-0cb2b964d3e14fd9f" ], "Key": "InstanceIds" } ] } }

Untuk informasi selengkapnya, lihat CreateAssociation Referensi API Manajer AWS Sistem.

Contoh 3: Untuk membuat asosiasi yang berjalan hanya sekali

Contoh ini membuat asosiasi baru yang hanya berjalan sekali pada tanggal dan waktu yang ditentukan. Asosiasi yang dibuat dengan tanggal di masa lalu atau sekarang (pada saat diproses tanggal sudah di masa lalu) berjalan segera.

aws ssm create-association \ --name "AWS-UpdateSSMAgent" \ --targets "Key=instanceids,Values=i-0cb2b964d3e14fd9f" \ --schedule-expression "at(2020-05-14T15:55:00)" \ --apply-only-at-cron-interval

Output:

{ "AssociationDescription": { "Status": { "Date": 1487875500.33, "Message": "Associated with AWS-UpdateSSMAgent", "Name": "Associated" }, "Name": "AWS-UpdateSSMAgent", "InstanceId": "i-0cb2b964d3e14fd9f", "Overview": { "Status": "Pending", "DetailedStatus": "Creating" }, "AssociationId": "b7c3266e-a544-44db-877e-b20d3a108189", "DocumentVersion": "$DEFAULT", "LastUpdateAssociationDate": 1487875500.33, "Date": 1487875500.33, "Targets": [ { "Values": [ "i-0cb2b964d3e14fd9f" ], "Key": "InstanceIds" } ] } }

Untuk informasi selengkapnya, lihat CreateAssociation Referensi atau Referensi API Manajer AWS Sistem: ekspresi Cron dan tarif untuk Manajer Sistem di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakancreate-document.

AWS CLI

Untuk membuat dokumen

create-documentContoh berikut membuat dokumen Manajer Sistem.

aws ssm create-document \ --content file://exampleDocument.yml \ --name "Example" \ --document-type "Automation" \ --document-format YAML

Output:

{ "DocumentDescription": { "Hash": "fc2410281f40779e694a8b95975d0f9f316da8a153daa94e3d9921102EXAMPLE", "HashType": "Sha256", "Name": "Example", "Owner": "29884EXAMPLE", "CreatedDate": 1583256349.452, "Status": "Creating", "DocumentVersion": "1", "Description": "Document Example", "Parameters": [ { "Name": "AutomationAssumeRole", "Type": "String", "Description": "(Required) The ARN of the role that allows Automation to perform the actions on your behalf. If no role is specified, Systems Manager Automation uses your IAM permissions to execute this document.", "DefaultValue": "" }, { "Name": "InstanceId", "Type": "String", "Description": "(Required) The ID of the Amazon EC2 instance.", "DefaultValue": "" } ], "PlatformTypes": [ "Windows", "Linux" ], "DocumentType": "Automation", "SchemaVersion": "0.3", "LatestVersion": "1", "DefaultVersion": "1", "DocumentFormat": "YAML", "Tags": [] } }

Untuk informasi selengkapnya, lihat Membuat Dokumen Manajer AWS Sistem di Panduan Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakancreate-maintenance-window.

AWS CLI

Contoh 1: Untuk membuat jendela pemeliharaan

create-maintenance-windowContoh berikut membuat jendela pemeliharaan baru yang setiap lima menit hingga dua jam (sesuai kebutuhan), mencegah tugas baru dimulai dalam waktu satu jam setelah akhir eksekusi jendela pemeliharaan, memungkinkan target yang tidak terkait (contoh yang belum Anda daftarkan dengan jendela pemeliharaan), dan menunjukkan melalui penggunaan tag khusus bahwa pembuatnya bermaksud menggunakannya dalam tutorial.

aws ssm create-maintenance-window \ --name "My-Tutorial-Maintenance-Window" \ --schedule "rate(5 minutes)" \ --duration 2 --cutoff 1 \ --allow-unassociated-targets \ --tags "Key=Purpose,Value=Tutorial"

Output:

{ "WindowId": "mw-0c50858d01EXAMPLE" }

Contoh 2: Untuk membuat jendela pemeliharaan yang hanya berjalan sekali

create-maintenance-windowContoh berikut membuat jendela pemeliharaan baru yang hanya berjalan satu kali pada tanggal dan waktu yang ditentukan.

aws ssm create-maintenance-window \ --name My-One-Time-Maintenance-Window \ --schedule "at(2020-05-14T15:55:00)" \ --duration 5 \ --cutoff 2 \ --allow-unassociated-targets \ --tags "Key=Environment,Value=Production"

Output:

{ "WindowId": "mw-01234567890abcdef" }

Untuk informasi selengkapnya, lihat Pem eliharaan Windows di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakancreate-ops-item.

AWS CLI

Untuk membuat OpsItems

create-ops-itemContoh berikut menggunakan aws/resources kunci/ OperationalData untuk membuat sumber daya OpsItem terkait Amazon DynamoDB.

aws ssm create-ops-item \ --title "EC2 instance disk full" \ --description "Log clean up may have failed which caused the disk to be full" \ --priority 2 \ --source ec2 \ --operational-data '{"/aws/resources":{"Value":"[{\"arn\": \"arn:aws:dynamodb:us-west-2:12345678:table/OpsItems\"}]","Type":"SearchableString"}}' \ --notifications Arn="arn:aws:sns:us-west-2:12345678:TestUser"

Output:

{ "OpsItemId": "oi-1a2b3c4d5e6f" }

Untuk informasi selengkapnya, lihat Membuat OpsItems di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakancreate-patch-baseline.

AWS CLI

Contoh 1: Untuk membuat baseline patch dengan persetujuan otomatis

create-patch-baselineContoh berikut membuat baseline patch untuk Windows Server yang menyetujui patch untuk lingkungan produksi tujuh hari setelah dirilis oleh Microsoft.

aws ssm create-patch-baseline \ --name "Windows-Production-Baseline-AutoApproval" \ --operating-system "WINDOWS" \ --approval-rules "PatchRules=[{PatchFilterGroup={PatchFilters=[{Key=MSRC_SEVERITY,Values=[Critical,Important,Moderate]},{Key=CLASSIFICATION,Values=[SecurityUpdates,Updates,UpdateRollups,CriticalUpdates]}]},ApproveAfterDays=7}]" \ --description "Baseline containing all updates approved for Windows Server production systems"

Output:

{ "BaselineId": "pb-045f10b4f3EXAMPLE" }

Contoh 2: Untuk membuat garis dasar patch dengan tanggal batas persetujuan

create-patch-baselineContoh berikut membuat baseline patch untuk Windows Server yang menyetujui semua patch untuk lingkungan produksi yang dirilis pada atau sebelum 7 Juli 2020.

aws ssm create-patch-baseline \ --name "Windows-Production-Baseline-AutoApproval" \ --operating-system "WINDOWS" \ --approval-rules "PatchRules=[{PatchFilterGroup={PatchFilters=[{Key=MSRC_SEVERITY,Values=[Critical,Important,Moderate]},{Key=CLASSIFICATION,Values=[SecurityUpdates,Updates,UpdateRollups,CriticalUpdates]}]},ApproveUntilDate=2020-07-07}]" \ --description "Baseline containing all updates approved for Windows Server production systems"

Output:

{ "BaselineId": "pb-045f10b4f3EXAMPLE" }

Contoh 3: Untuk membuat baseline patch dengan aturan persetujuan yang disimpan dalam file JSON

create-patch-baselineContoh berikut membuat baseline patch untuk Amazon Linux 2017.09 yang menyetujui patch untuk lingkungan produksi tujuh hari setelah dirilis, menentukan aturan persetujuan untuk baseline patch, dan menentukan repositori khusus untuk patch.

aws ssm create-patch-baseline \ --cli-input-json file://my-amazon-linux-approval-rules-and-repo.json

Isi dari my-amazon-linux-approval-rules-and-repo.json:

{ "Name": "Amazon-Linux-2017.09-Production-Baseline", "Description": "My approval rules patch baseline for Amazon Linux 2017.09 instances", "OperatingSystem": "AMAZON_LINUX", "Tags": [ { "Key": "Environment", "Value": "Production" } ], "ApprovalRules": { "PatchRules": [ { "ApproveAfterDays": 7, "EnableNonSecurity": true, "PatchFilterGroup": { "PatchFilters": [ { "Key": "SEVERITY", "Values": [ "Important", "Critical" ] }, { "Key": "CLASSIFICATION", "Values": [ "Security", "Bugfix" ] }, { "Key": "PRODUCT", "Values": [ "AmazonLinux2017.09" ] } ] } } ] }, "Sources": [ { "Name": "My-AL2017.09", "Products": [ "AmazonLinux2017.09" ], "Configuration": "[amzn-main] \nname=amzn-main-Base\nmirrorlist=http://repo./$awsregion./$awsdomain//$releasever/main/mirror.list //nmirrorlist_expire=300//nmetadata_expire=300 \npriority=10 \nfailovermethod=priority \nfastestmirror_enabled=0 \ngpgcheck=1 \ngpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-ga \nenabled=1 \nretries=3 \ntimeout=5\nreport_instanceid=yes" } ] }

Contoh 4: Untuk membuat baseline patch yang menentukan patch yang disetujui dan ditolak

create-patch-baselineContoh berikut secara eksplisit menentukan patch untuk disetujui dan ditolak sebagai pengecualian terhadap aturan persetujuan default.

aws ssm create-patch-baseline \ --name "Amazon-Linux-2017.09-Alpha-Baseline" \ --description "My custom approve/reject patch baseline for Amazon Linux 2017.09 instances" \ --operating-system "AMAZON_LINUX" \ --approved-patches "CVE-2018-1234567,example-pkg-EE-2018*.amzn1.noarch" \ --approved-patches-compliance-level "HIGH" \ --approved-patches-enable-non-security \ --tags "Key=Environment,Value=Alpha"

Untuk informasi selengkapnya, lihat Membuat Baseline Patch Kustom di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakancreate-resource-data-sync.

AWS CLI

Untuk membuat sinkronisasi data sumber daya

Contoh ini membuat sinkronisasi data sumber daya. Tidak ada output jika perintah berhasil.

Perintah:

aws ssm create-resource-data-sync --sync-name "ssm-resource-data-sync" --s3-destination "BucketName=ssm-bucket,Prefix=inventory,SyncFormat=JsonSerDe,Region=us-east-1"

Contoh kode berikut menunjukkan cara menggunakandelete-activation.

AWS CLI

Untuk menghapus aktivasi instans terkelola

delete-activationContoh berikut menghapus aktivasi instance terkelola.

aws ssm delete-activation \ --activation-id "aa673477-d926-42c1-8757-1358cEXAMPLE"

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Menyi AWS apkan Manajer Sistem untuk Lingkungan Hibrid di AWS Panduan Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandelete-association.

AWS CLI

Contoh 1: Untuk menghapus asosiasi menggunakan ID asosiasi

delete-associationContoh berikut menghapus asosiasi untuk ID asosiasi yang ditentukan. Tidak ada output jika perintah berhasil.

aws ssm delete-association \ --association-id "8dfe3659-4309-493a-8755-0123456789ab"

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Meng edit dan membuat versi baru asosiasi di Panduan AWS Pengguna Manajer Sistem.

Contoh 2: Untuk menghapus asosiasi

delete-associationContoh berikut menghapus asosiasi antara instance dan dokumen. Tidak ada output jika perintah berhasil.

aws ssm delete-association \ --instance-id "i-1234567890abcdef0" \ --name "AWS-UpdateSSMAgent"

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Bekerja dengan asosiasi di Manajer Sistem di AWS Panduan Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandelete-document.

AWS CLI

Untuk menghapus dokumen

delete-documentContoh berikut menghapus dokumen Manajer Sistem.

aws ssm delete-document \ --name "Example"

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Membuat Dokumen Manajer AWS Sistem di Panduan Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandelete-inventory.

AWS CLI

Untuk menghapus jenis inventaris kustom

Contoh ini menghapus skema inventaris kustom.

Perintah:

aws ssm delete-inventory --type-name "Custom:RackInfo" --schema-delete-option "DeleteSchema"

Output:

{ "DeletionId": "d72ac9e8-1f60-4d40-b1c6-bf8c78c68c4d", "TypeName": "Custom:RackInfo", "DeletionSummary": { "TotalCount": 1, "RemainingCount": 1, "SummaryItems": [ { "Version": "1.0", "Count": 1, "RemainingCount": 1 } ] } }

Untuk menonaktifkan jenis inventaris kustom

Contoh ini menonaktifkan skema inventaris kustom.

Perintah:

aws ssm delete-inventory --type-name "Custom:RackInfo" --schema-delete-option "DisableSchema"

Output:

{ "DeletionId": "6961492a-8163-44ec-aa1e-923364dd0850", "TypeName": "Custom:RackInformation", "DeletionSummary": { "TotalCount": 0, "RemainingCount": 0, "SummaryItems": [] } }

Contoh kode berikut menunjukkan cara menggunakandelete-maintenance-window.

AWS CLI

Untuk menghapus jendela pemeliharaan

delete-maintenance-windowContoh ini menghapus jendela pemeliharaan yang ditentukan.

aws ssm delete-maintenance-window \ --window-id "mw-1a2b3c4d5e6f7g8h9"

Output:

{ "WindowId":"mw-1a2b3c4d5e6f7g8h9" }

Untuk informasi selengkapnya, lihat Menghapus Jendela Pemeliharaan (AWS CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandelete-parameter.

AWS CLI

Untuk menghapus parameter

delete-parameterContoh berikut menghapus parameter tunggal yang ditentukan.

aws ssm delete-parameter \ --name "MyParameter"

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Bekerja dengan Penyimpanan Parameter di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakandelete-parameters.

AWS CLI

Untuk menghapus daftar parameter

delete-parametersContoh berikut menghapus parameter yang ditentukan.

aws ssm delete-parameters \ --names "MyFirstParameter" "MySecondParameter" "MyInvalidParameterName"

Output:

{ "DeletedParameters": [ "MyFirstParameter", "MySecondParameter" ], "InvalidParameters": [ "MyInvalidParameterName" ] }

Untuk informasi selengkapnya, lihat Bekerja dengan Penyimpanan Parameter di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakandelete-patch-baseline.

AWS CLI

Untuk menghapus garis dasar patch

delete-patch-baselineContoh berikut menghapus baseline patch yang ditentukan.

aws ssm delete-patch-baseline \ --baseline-id "pb-045f10b4f382baeda"

Output:

{ "BaselineId": "pb-045f10b4f382baeda" }

Untuk informasi selengkapnya, lihat Memperbarui atau Menghapus Patch Baseline (Konsol) di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakandelete-resource-data-sync.

AWS CLI

Untuk menghapus sinkronisasi data sumber daya

Contoh ini menghapus sinkronisasi data sumber daya. Tidak ada output jika perintah berhasil.

Perintah:

aws ssm delete-resource-data-sync --sync-name "ssm-resource-data-sync"

Contoh kode berikut menunjukkan cara menggunakanderegister-managed-instance.

AWS CLI

Untuk membatalkan pendaftaran instans terkelola

deregister-managed-instanceContoh berikut membatalkan pendaftaran instance terkelola yang ditentukan.

aws ssm deregister-managed-instance \ --instance-id 'mi-08ab247cdfEXAMPLE'

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Menghapus pendaftaran node terkelola di lingkungan hybrid dan multicloud di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanderegister-patch-baseline-for-patch-group.

AWS CLI

Untuk membatalkan pendaftaran grup patch dari baseline patch

deregister-patch-baseline-for-patch-groupContoh berikut membatalkan pendaftaran grup patch yang ditentukan dari baseline patch yang ditentukan.

aws ssm deregister-patch-baseline-for-patch-group \ --patch-group "Production" \ --baseline-id "pb-0ca44a362fEXAMPLE"

Output:

{ "PatchGroup":"Production", "BaselineId":"pb-0ca44a362fEXAMPLE" }

Untuk informasi selengkapnya, lihat Men ambahkan Grup Patch ke Baseline Patch di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanderegister-target-from-maintenance-window.

AWS CLI

Untuk menghapus target dari jendela pemeliharaan

deregister-target-from-maintenance-windowContoh berikut menghapus target yang ditentukan dari jendela pemeliharaan yang ditentukan.

aws ssm deregister-target-from-maintenance-window \ --window-id "mw-ab12cd34ef56gh78" \ --window-target-id "1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d-1a2"

Output:

{ "WindowId":"mw-ab12cd34ef56gh78", "WindowTargetId":"1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d-1a2" }

Untuk informasi selengkapnya, lihat Memperbarui Jendela Pemeliharaan (AWS CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanderegister-task-from-maintenance-window.

AWS CLI

Untuk menghapus tugas dari jendela pemeliharaan

deregister-task-from-maintenance-windowContoh berikut menghapus tugas yang ditentukan dari jendela pemeliharaan yang ditentukan.

aws ssm deregister-task-from-maintenance-window \ --window-id "mw-ab12cd34ef56gh78" \ --window-task-id "1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6c"

Output:

{ "WindowTaskId":"1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6c", "WindowId":"mw-ab12cd34ef56gh78" }

Untuk informasi selengkapnya, lihat Tutorial Windows Pemeliharaan Manajer AWS Sistem (CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-activations.

AWS CLI

Untuk menggambarkan aktivasi

describe-activationsContoh berikut mencantumkan detail tentang aktivasi di AWS akun Anda.

aws ssm describe-activations

Output:

{ "ActivationList": [ { "ActivationId": "5743558d-563b-4457-8682-d16c3EXAMPLE", "Description": "Example1", "IamRole": "HybridWebServersRole, "RegistrationLimit": 5, "RegistrationsCount": 5, "ExpirationDate": 1584316800.0, "Expired": false, "CreatedDate": 1581954699.792 }, { "ActivationId": "3ee0322b-f62d-40eb-b672-13ebfEXAMPLE", "Description": "Example2", "IamRole": "HybridDatabaseServersRole", "RegistrationLimit": 5, "RegistrationsCount": 5, "ExpirationDate": 1580515200.0, "Expired": true, "CreatedDate": 1578064132.002 }, ] }

Untuk informasi selengkapnya, lihat Langkah 4: Membuat Managed-Instance Aktivasi untuk Lingkungan Hibrid di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-association-execution-targets.

AWS CLI

Untuk mendapatkan rincian eksekusi asosiasi

describe-association-execution-targetsContoh berikut menjelaskan eksekusi asosiasi yang ditentukan.

aws ssm describe-association-execution-targets \ --association-id "8dfe3659-4309-493a-8755-0123456789ab" \ --execution-id "7abb6378-a4a5-4f10-8312-0123456789ab"

Output:

{ "AssociationExecutionTargets": [ { "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "AssociationVersion": "1", "ExecutionId": "7abb6378-a4a5-4f10-8312-0123456789ab", "ResourceId": "i-1234567890abcdef0", "ResourceType": "ManagedInstance", "Status": "Success", "DetailedStatus": "Success", "LastExecutionDate": 1550505538.497, "OutputSource": { "OutputSourceId": "97fff367-fc5a-4299-aed8-0123456789ab", "OutputSourceType": "RunCommand" } } ] }

Untuk informasi selengkapnya, lihat Melihat riwayat asosiasi di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-association-executions.

AWS CLI

Contoh 1: Untuk mendapatkan rincian semua eksekusi untuk asosiasi

describe-association-executionsContoh berikut menjelaskan semua eksekusi dari asosiasi yang ditentukan.

aws ssm describe-association-executions \ --association-id "8dfe3659-4309-493a-8755-0123456789ab"

Output:

{ "AssociationExecutions": [ { "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "AssociationVersion": "1", "ExecutionId": "474925ef-1249-45a2-b93d-0123456789ab", "Status": "Success", "DetailedStatus": "Success", "CreatedTime": 1550505827.119, "ResourceCountByStatus": "{Success=1}" }, { "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "AssociationVersion": "1", "ExecutionId": "7abb6378-a4a5-4f10-8312-0123456789ab", "Status": "Success", "DetailedStatus": "Success", "CreatedTime": 1550505536.843, "ResourceCountByStatus": "{Success=1}" }, ... ] }

Untuk informasi selengkapnya, lihat Melihat riwayat asosiasi di Panduan AWS Pengguna Manajer Sistem.

Contoh 2: Untuk mendapatkan rincian semua eksekusi untuk asosiasi setelah tanggal dan waktu tertentu

describe-association-executionsContoh berikut menjelaskan semua eksekusi asosiasi setelah tanggal dan waktu yang ditentukan.

aws ssm describe-association-executions \ --association-id "8dfe3659-4309-493a-8755-0123456789ab" \ --filters "Key=CreatedTime,Value=2019-02-18T16:00:00Z,Type=GREATER_THAN"

Output:

{ "AssociationExecutions": [ { "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "AssociationVersion": "1", "ExecutionId": "474925ef-1249-45a2-b93d-0123456789ab", "Status": "Success", "DetailedStatus": "Success", "CreatedTime": 1550505827.119, "ResourceCountByStatus": "{Success=1}" }, { "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "AssociationVersion": "1", "ExecutionId": "7abb6378-a4a5-4f10-8312-0123456789ab", "Status": "Success", "DetailedStatus": "Success", "CreatedTime": 1550505536.843, "ResourceCountByStatus": "{Success=1}" }, ... ] }

Untuk informasi selengkapnya, lihat Melihat riwayat asosiasi di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-association.

AWS CLI

Contoh 1: Untuk mendapatkan detail asosiasi

describe-associationContoh berikut menjelaskan asosiasi untuk ID asosiasi yang ditentukan.

aws ssm describe-association \ --association-id "8dfe3659-4309-493a-8755-0123456789ab"

Output:

{ "AssociationDescription": { "Name": "AWS-GatherSoftwareInventory", "AssociationVersion": "1", "Date": 1534864780.995, "LastUpdateAssociationDate": 1543235759.81, "Overview": { "Status": "Success", "AssociationStatusAggregatedCount": { "Success": 2 } }, "DocumentVersion": "$DEFAULT", "Parameters": { "applications": [ "Enabled" ], "awsComponents": [ "Enabled" ], "customInventory": [ "Enabled" ], "files": [ "" ], "instanceDetailedInformation": [ "Enabled" ], "networkConfig": [ "Enabled" ], "services": [ "Enabled" ], "windowsRegistry": [ "" ], "windowsRoles": [ "Enabled" ], "windowsUpdates": [ "Enabled" ] }, "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "Targets": [ { "Key": "InstanceIds", "Values": [ "*" ] } ], "ScheduleExpression": "rate(24 hours)", "LastExecutionDate": 1550501886.0, "LastSuccessfulExecutionDate": 1550501886.0, "AssociationName": "Inventory-Association" } }

Untuk informasi selengkapnya, lihat Meng edit dan membuat versi baru asosiasi di Panduan AWS Pengguna Manajer Sistem.

Contoh 2: Untuk mendapatkan rincian asosiasi untuk contoh dan dokumen tertentu

describe-associationContoh berikut menjelaskan hubungan antara instance dan dokumen.

aws ssm describe-association \ --instance-id "i-1234567890abcdef0" \ --name "AWS-UpdateSSMAgent"

Output:

{ "AssociationDescription": { "Status": { "Date": 1487876122.564, "Message": "Associated with AWS-UpdateSSMAgent", "Name": "Associated" }, "Name": "AWS-UpdateSSMAgent", "InstanceId": "i-1234567890abcdef0", "Overview": { "Status": "Pending", "DetailedStatus": "Associated", "AssociationStatusAggregatedCount": { "Pending": 1 } }, "AssociationId": "d8617c07-2079-4c18-9847-1234567890ab", "DocumentVersion": "$DEFAULT", "LastUpdateAssociationDate": 1487876122.564, "Date": 1487876122.564, "Targets": [ { "Values": [ "i-1234567890abcdef0" ], "Key": "InstanceIds" } ] } }

Untuk informasi selengkapnya, lihat Meng edit dan membuat versi baru asosiasi di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-automation-executions.

AWS CLI

Untuk menggambarkan eksekusi otomatisasi

describe-automation-executionsContoh berikut menampilkan detail tentang eksekusi Otomasi.

aws ssm describe-automation-executions \ --filters Key=ExecutionId,Values=73c8eef8-f4ee-4a05-820c-e354fEXAMPLE

Output:

{ "AutomationExecutionMetadataList": [ { "AutomationExecutionId": "73c8eef8-f4ee-4a05-820c-e354fEXAMPLE", "DocumentName": "AWS-StartEC2Instance", "DocumentVersion": "1", "AutomationExecutionStatus": "Success", "ExecutionStartTime": 1583737233.748, "ExecutionEndTime": 1583737234.719, "ExecutedBy": "arn:aws:sts::29884EXAMPLE:assumed-role/mw_service_role/OrchestrationService", "LogFile": "", "Outputs": {}, "Mode": "Auto", "Targets": [], "ResolvedTargets": { "ParameterValues": [], "Truncated": false }, "AutomationType": "Local" } ] }

Untuk informasi selengkapnya, lihat Menjalankan Alur Kerja Otomasi Sederhana di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-automation-step-executions.

AWS CLI

Contoh 1: Untuk menjelaskan semua langkah untuk eksekusi otomatisasi

describe-automation-step-executionsContoh berikut menampilkan detail tentang langkah-langkah eksekusi Otomasi.

aws ssm describe-automation-step-executions \ --automation-execution-id 73c8eef8-f4ee-4a05-820c-e354fEXAMPLE

Output:

{ "StepExecutions": [ { "StepName": "startInstances", "Action": "aws:changeInstanceState", "ExecutionStartTime": 1583737234.134, "ExecutionEndTime": 1583737234.672, "StepStatus": "Success", "Inputs": { "DesiredState": "\"running\"", "InstanceIds": "[\"i-0cb99161f6EXAMPLE\"]" }, "Outputs": { "InstanceStates": [ "running" ] }, "StepExecutionId": "95e70479-cf20-4d80-8018-7e4e2EXAMPLE", "OverriddenParameters": {} } ] }

Contoh 2: Untuk menggambarkan langkah tertentu untuk eksekusi otomatisasi

describe-automation-step-executionsContoh berikut menampilkan detail tentang langkah tertentu dari eksekusi Otomasi.

aws ssm describe-automation-step-executions \ --automation-execution-id 73c8eef8-f4ee-4a05-820c-e354fEXAMPLE \ --filters Key=StepExecutionId,Values=95e70479-cf20-4d80-8018-7e4e2EXAMPLE

Untuk informasi selengkapnya, lihat Menjalankan Alur Kerja Otomasi Langkah demi Langkah (Baris Per intah) di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-available-patches.

AWS CLI

Untuk mendapatkan patch yang tersedia

describe-available-patchesContoh berikut mengambil detail tentang semua patch yang tersedia untuk Windows Server 2019 yang memiliki tingkat keparahan MSRC Kritis.

aws ssm describe-available-patches \ --filters "Key=PRODUCT,Values=WindowsServer2019" "Key=MSRC_SEVERITY,Values=Critical"

Output:

{ "Patches": [ { "Id": "fe6bd8c2-3752-4c8b-ab3e-1a7ed08767ba", "ReleaseDate": 1544047205.0, "Title": "2018-11 Update for Windows Server 2019 for x64-based Systems (KB4470788)", "Description": "Install this update to resolve issues in Windows. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article for more information. After you install this item, you may have to restart your computer.", "ContentUrl": "https://support.microsoft.com/en-us/kb/4470788", "Vendor": "Microsoft", "ProductFamily": "Windows", "Product": "WindowsServer2019", "Classification": "SecurityUpdates", "MsrcSeverity": "Critical", "KbNumber": "KB4470788", "MsrcNumber": "", "Language": "All" }, { "Id": "c96115e1-5587-4115-b851-22baa46a3f11", "ReleaseDate": 1549994410.0, "Title": "2019-02 Security Update for Adobe Flash Player for Windows Server 2019 for x64-based Systems (KB4487038)", "Description": "A security issue has been identified in a Microsoft software product that could affect your system. You can help protect your system by installing this update from Microsoft. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article. After you install this update, you may have to restart your system.", "ContentUrl": "https://support.microsoft.com/en-us/kb/4487038", "Vendor": "Microsoft", "ProductFamily": "Windows", "Product": "WindowsServer2019", "Classification": "SecurityUpdates", "MsrcSeverity": "Critical", "KbNumber": "KB4487038", "MsrcNumber": "", "Language": "All" }, ... ] }

Untuk mendapatkan detail patch tertentu

describe-available-patchesContoh berikut mengambil detail tentang patch yang ditentukan.

aws ssm describe-available-patches \ --filters "Key=PATCH_ID,Values=KB4480979"

Output:

{ "Patches": [ { "Id": "680861e3-fb75-432e-818e-d72e5f2be719", "ReleaseDate": 1546970408.0, "Title": "2019-01 Security Update for Adobe Flash Player for Windows Server 2016 for x64-based Systems (KB4480979)", "Description": "A security issue has been identified in a Microsoft software product that could affect your system. You can help protect your system by installing this update from Microsoft. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article. After you install this update, you may have to restart your system.", "ContentUrl": "https://support.microsoft.com/en-us/kb/4480979", "Vendor": "Microsoft", "ProductFamily": "Windows", "Product": "WindowsServer2016", "Classification": "SecurityUpdates", "MsrcSeverity": "Critical", "KbNumber": "KB4480979", "MsrcNumber": "", "Language": "All" } ] }

Untuk informasi selengkapnya, lihat Cara Kerja Operasi Patch Manager di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-document-permission.

AWS CLI

Untuk menjelaskan izin dokumen

describe-document-permissionContoh berikut menampilkan detail izin tentang dokumen Manajer Sistem yang dibagikan secara publik.

aws ssm describe-document-permission \ --name "Example" \ --permission-type "Share"

Output:

{ "AccountIds": [ "all" ], "AccountSharingInfoList": [ { "AccountId": "all", "SharedDocumentVersion": "$DEFAULT" } ] }

Untuk informasi selengkapnya, lihat Berbagi Dokumen Manajer AWS Sistem di Panduan Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-document.

AWS CLI

Untuk menampilkan detail dokumen

describe-documentContoh berikut menampilkan detail tentang dokumen Manajer Sistem di AWS akun Anda.

aws ssm describe-document \ --name "Example"

Output:

{ "Document": { "Hash": "fc2410281f40779e694a8b95975d0f9f316da8a153daa94e3d9921102EXAMPLE", "HashType": "Sha256", "Name": "Example", "Owner": "29884EXAMPLE", "CreatedDate": 1583257938.266, "Status": "Active", "DocumentVersion": "1", "Description": "Document Example", "Parameters": [ { "Name": "AutomationAssumeRole", "Type": "String", "Description": "(Required) The ARN of the role that allows Automation to perform the actions on your behalf. If no role is specified, Systems Manager Automation uses your IAM permissions to execute this document.", "DefaultValue": "" }, { "Name": "InstanceId", "Type": "String", "Description": "(Required) The ID of the Amazon EC2 instance.", "DefaultValue": "" } ], "PlatformTypes": [ "Windows", "Linux" ], "DocumentType": "Automation", "SchemaVersion": "0.3", "LatestVersion": "1", "DefaultVersion": "1", "DocumentFormat": "YAML", "Tags": [] } }

Untuk informasi selengkapnya, lihat Membuat Dokumen Manajer AWS Sistem di Panduan Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-effective-instance-associations.

AWS CLI

Untuk mendapatkan rincian asosiasi yang efektif untuk suatu contoh

describe-effective-instance-associationsContoh berikut mengambil detail tentang asosiasi efektif untuk sebuah contoh.

Perintah:

aws ssm describe-effective-instance-associations --instance-id "i-1234567890abcdef0"

Output:

{ "Associations": [ { "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "InstanceId": "i-1234567890abcdef0", "Content": "{\n \"schemaVersion\": \"1.2\",\n \"description\": \"Update the Amazon SSM Agent to the latest version or specified version.\",\n \"parameters\": {\n \"version\": {\n \"default\": \"\",\n \"description\": \"(Optional) A specific version of the Amazon SSM Agent to install. If not specified, the agent will be updated to the latest version.\",\n \"type\": \"String\"\n },\n \"allowDowngrade\": {\n \"default\": \"false\",\n \"description\": \"(Optional) Allow the Amazon SSM Agent service to be downgraded to an earlier version. If set to false, the service can be upgraded to newer versions only (default). If set to true, specify the earlier version.\",\n \"type\": \"String\",\n \"allowedValues\": [\n \"true\",\n \"false\"\n ]\n }\n },\n \"runtimeConfig\": {\n \"aws:updateSsmAgent\": {\n \"properties\": [\n {\n \"agentName\": \"amazon-ssm-agent\",\n \"source\": \"https://s3.{Region}.amazonaws.com/amazon-ssm-{Region}/ssm-agent-manifest.json\",\n \"allowDowngrade\": \"{{ allowDowngrade }}\",\n \"targetVersion\": \"{{ version }}\"\n }\n ]\n }\n }\n}\n", "AssociationVersion": "1" } ] }

Contoh kode berikut menunjukkan cara menggunakandescribe-effective-patches-for-patch-baseline.

AWS CLI

Contoh 1: Untuk mendapatkan semua patch yang ditentukan oleh baseline patch khusus

describe-effective-patches-for-patch-baselineContoh berikut mengembalikan patch yang ditentukan oleh baseline patch kustom di AWS akun saat ini. Perhatikan bahwa untuk baseline khusus, hanya ID yang diperlukan untuk--baseline-id.

aws ssm describe-effective-patches-for-patch-baseline \ --baseline-id "pb-08b654cf9b9681f04"

Output:

{ "EffectivePatches": [ { "Patch": { "Id": "fe6bd8c2-3752-4c8b-ab3e-1a7ed08767ba", "ReleaseDate": 1544047205.0, "Title": "2018-11 Update for Windows Server 2019 for x64-based Systems (KB4470788)", "Description": "Install this update to resolve issues in Windows. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article for more information. After you install this item, you may have to restart your computer.", "ContentUrl": "https://support.microsoft.com/en-us/kb/4470788", "Vendor": "Microsoft", "ProductFamily": "Windows", "Product": "WindowsServer2019", "Classification": "SecurityUpdates", "MsrcSeverity": "Critical", "KbNumber": "KB4470788", "MsrcNumber": "", "Language": "All" }, "PatchStatus": { "DeploymentStatus": "APPROVED", "ComplianceLevel": "CRITICAL", "ApprovalDate": 1544047205.0 } }, { "Patch": { "Id": "915a6b1a-f556-4d83-8f50-b2e75a9a7e58", "ReleaseDate": 1549994400.0, "Title": "2019-02 Cumulative Update for .NET Framework 3.5 and 4.7.2 for Windows Server 2019 for x64 (KB4483452)", "Description": "A security issue has been identified in a Microsoft software product that could affect your system. You can help protect your system by installing this update from Microsoft. For a complete listing of the issues that are included in this update, see the associated Microsoft Knowledge Base article. After you install this update, you may have to restart your system.", "ContentUrl": "https://support.microsoft.com/en-us/kb/4483452", "Vendor": "Microsoft", "ProductFamily": "Windows", "Product": "WindowsServer2019", "Classification": "SecurityUpdates", "MsrcSeverity": "Important", "KbNumber": "KB4483452", "MsrcNumber": "", "Language": "All" }, "PatchStatus": { "DeploymentStatus": "APPROVED", "ComplianceLevel": "CRITICAL", "ApprovalDate": 1549994400.0 } }, ... ], "NextToken": "--token string truncated--" }

Contoh 2: Untuk mendapatkan semua patch yang ditentukan oleh baseline patch AWS terkelola

describe-effective-patches-for-patch-baselineContoh berikut mengembalikan patch yang ditentukan oleh baseline patch AWS terkelola. Perhatikan bahwa untuk baseline AWS terkelola, ARN baseline lengkap diperlukan untuk --baseline-id

aws ssm describe-effective-patches-for-patch-baseline \ --baseline-id "arn:aws:ssm:us-east-2:733109147000:patchbaseline/pb-020d361a05defe4ed"

Lihat contoh 1 untuk keluaran sampel.

Untuk informasi selengkapnya, lihat Bagaimana Patch Keamanan D ipilih di AWS Panduan Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-instance-associations-status.

AWS CLI

Untuk menggambarkan status asosiasi instance

Contoh ini menunjukkan rincian asosiasi untuk sebuah contoh.

Perintah:

aws ssm describe-instance-associations-status --instance-id "i-1234567890abcdef0"

Output:

{ "InstanceAssociationStatusInfos": [ { "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "Name": "AWS-GatherSoftwareInventory", "DocumentVersion": "1", "AssociationVersion": "1", "InstanceId": "i-1234567890abcdef0", "ExecutionDate": 1550501886.0, "Status": "Success", "ExecutionSummary": "1 out of 1 plugin processed, 1 success, 0 failed, 0 timedout, 0 skipped. ", "AssociationName": "Inventory-Association" }, { "AssociationId": "5c5a31f6-6dae-46f9-944c-0123456789ab", "Name": "AWS-UpdateSSMAgent", "DocumentVersion": "1", "AssociationVersion": "1", "InstanceId": "i-1234567890abcdef0", "ExecutionDate": 1550505828.548, "Status": "Success", "DetailedStatus": "Success", "AssociationName": "UpdateSSMAgent" } ] }

Contoh kode berikut menunjukkan cara menggunakandescribe-instance-information.

AWS CLI

Contoh 1: Untuk menjelaskan informasi instance terkelola

describe-instance-informationContoh berikut mengambil detail dari setiap instans terkelola Anda.

aws ssm describe-instance-information

Contoh 2: Untuk menjelaskan informasi tentang instance terkelola tertentu

describe-instance-informationContoh berikut menunjukkan detail dari instance yang dikelolai-028ea792daEXAMPLE.

aws ssm describe-instance-information \ --filters "Key=InstanceIds,Values=i-028ea792daEXAMPLE"

Contoh 3: Untuk menjelaskan informasi tentang instance terkelola dengan kunci tag tertentu

describe-instance-informationContoh berikut menunjukkan detail untuk instance terkelola yang memiliki kunci tagDEV.

aws ssm describe-instance-information \ --filters "Key=tag-key,Values=DEV"

Output:

{ "InstanceInformationList": [ { "InstanceId": "i-028ea792daEXAMPLE", "PingStatus": "Online", "LastPingDateTime": 1582221233.421, "AgentVersion": "2.3.842.0", "IsLatestVersion": true, "PlatformType": "Linux", "PlatformName": "SLES", "PlatformVersion": "15.1", "ResourceType": "EC2Instance", "IPAddress": "192.0.2.0", "ComputerName": "ip-198.51.100.0.us-east-2.compute.internal", "AssociationStatus": "Success", "LastAssociationExecutionDate": 1582220806.0, "LastSuccessfulAssociationExecutionDate": 1582220806.0, "AssociationOverview": { "DetailedStatus": "Success", "InstanceAssociationStatusAggregatedCount": { "Success": 2 } } } ] }

Untuk informasi selengkapnya, lihat Instans Ter kelola di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-instance-patch-states-for-patch-group.

AWS CLI

Contoh 1: Untuk mendapatkan status instance untuk grup patch

describe-instance-patch-states-for-patch-groupContoh berikut mengambil detail tentang status ringkasan patch per instans untuk grup patch yang ditentukan.

aws ssm describe-instance-patch-states-for-patch-group \ --patch-group "Production"

Output:

{ "InstancePatchStates": [ { "InstanceId": "i-02573cafcfEXAMPLE", "PatchGroup": "Production", "BaselineId": "pb-0c10e65780EXAMPLE", "SnapshotId": "a3f5ff34-9bc4-4d2c-a665-4d1c1EXAMPLE", "OwnerInformation": "", "InstalledCount": 32, "InstalledOtherCount": 1, "InstalledPendingRebootCount": 0, "InstalledRejectedCount": 0, "MissingCount": 2, "FailedCount": 0, "UnreportedNotApplicableCount": 2671, "NotApplicableCount": 400, "OperationStartTime": "2021-08-04T11:03:50.590000-07:00", "OperationEndTime": "2021-08-04T11:04:21.555000-07:00", "Operation": "Scan", "RebootOption": "NoReboot", "CriticalNonCompliantCount": 0, "SecurityNonCompliantCount": 1, "OtherNonCompliantCount": 0 }, { "InstanceId": "i-0471e04240EXAMPLE", "PatchGroup": "Production", "BaselineId": "pb-09ca3fb51fEXAMPLE", "SnapshotId": "05d8ffb0-1bbe-4812-ba2d-d9b7bEXAMPLE", "OwnerInformation": "", "InstalledCount": 32, "InstalledOtherCount": 1, "InstalledPendingRebootCount": 0, "InstalledRejectedCount": 0, "MissingCount": 2, "FailedCount": 0, "UnreportedNotApplicableCount": 2671, "NotApplicableCount": 400, "OperationStartTime": "2021-08-04T22:06:20.340000-07:00", "OperationEndTime": "2021-08-04T22:07:11.220000-07:00", "Operation": "Scan", "RebootOption": "NoReboot", "CriticalNonCompliantCount": 0, "SecurityNonCompliantCount": 1, "OtherNonCompliantCount": 0 } ] }

Contoh 2: Untuk mendapatkan status instance untuk grup patch dengan lebih dari lima patch yang hilang

describe-instance-patch-states-for-patch-groupContoh berikut mengambil detail tentang status ringkasan patch untuk grup patch yang ditentukan untuk instance dengan lebih dari lima patch yang hilang.

aws ssm describe-instance-patch-states-for-patch-group \ --filters Key=MissingCount,Type=GreaterThan,Values=5 \ --patch-group "Production"

Output:

{ "InstancePatchStates": [ { "InstanceId": "i-02573cafcfEXAMPLE", "PatchGroup": "Production", "BaselineId": "pb-0c10e65780EXAMPLE", "SnapshotId": "a3f5ff34-9bc4-4d2c-a665-4d1c1EXAMPLE", "OwnerInformation": "", "InstalledCount": 46, "InstalledOtherCount": 4, "InstalledPendingRebootCount": 1, "InstalledRejectedCount": 1, "MissingCount": 7, "FailedCount": 0, "UnreportedNotApplicableCount": 232, "NotApplicableCount": 654, "OperationStartTime": "2021-08-04T11:03:50.590000-07:00", "OperationEndTime": "2021-08-04T11:04:21.555000-07:00", "Operation": "Scan", "RebootOption": "NoReboot", "CriticalNonCompliantCount": 0, "SecurityNonCompliantCount": 1, "OtherNonCompliantCount": 1 } ] }

Contoh 3: Untuk mendapatkan status instance untuk grup patch dengan kurang dari sepuluh instans yang memerlukan reboot

describe-instance-patch-states-for-patch-groupContoh berikut mengambil detail tentang status ringkasan patch untuk grup patch yang ditentukan untuk instance dengan kurang dari sepuluh instans yang memerlukan reboot.

aws ssm describe-instance-patch-states-for-patch-group \ --filters Key=InstalledPendingRebootCount,Type=LessThan,Values=10 \ --patch-group "Production"

Output:

{ "InstancePatchStates": [ { "InstanceId": "i-02573cafcfEXAMPLE", "BaselineId": "pb-0c10e65780EXAMPLE", "SnapshotId": "a3f5ff34-9bc4-4d2c-a665-4d1c1EXAMPLE", "PatchGroup": "Production", "OwnerInformation": "", "InstalledCount": 32, "InstalledOtherCount": 1, "InstalledPendingRebootCount": 4, "InstalledRejectedCount": 0, "MissingCount": 2, "FailedCount": 0, "UnreportedNotApplicableCount": 846, "NotApplicableCount": 212, "OperationStartTime": "2021-08-046T11:03:50.590000-07:00", "OperationEndTime": "2021-08-06T11:04:21.555000-07:00", "Operation": "Scan", "RebootOption": "NoReboot", "CriticalNonCompliantCount": 0, "SecurityNonCompliantCount": 1, "OtherNonCompliantCount": 0 } ] }

Untuk informasi selengkapnya, lihat Memahami nilai status kepatuhan patch di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-instance-patch-states.

AWS CLI

Untuk mendapatkan status ringkasan patch untuk instance

describe-instance-patch-statesContoh ini mendapatkan status ringkasan patch untuk sebuah instance.

aws ssm describe-instance-patch-states \ --instance-ids "i-1234567890abcdef0"

Output:

{ "InstancePatchStates": [ { "InstanceId": "i-1234567890abcdef0", "PatchGroup": "my-patch-group", "BaselineId": "pb-0713accee01234567", "SnapshotId": "521c3536-930c-4aa9-950e-01234567abcd", "CriticalNonCompliantCount": 2, "SecurityNonCompliantCount": 2, "OtherNonCompliantCount": 1, "InstalledCount": 123, "InstalledOtherCount": 334, "InstalledPendingRebootCount": 0, "InstalledRejectedCount": 0, "MissingCount": 1, "FailedCount": 2, "UnreportedNotApplicableCount": 11, "NotApplicableCount": 2063, "OperationStartTime": "2021-05-03T11:00:56-07:00", "OperationEndTime": "2021-05-03T11:01:09-07:00", "Operation": "Scan", "LastNoRebootInstallOperationTime": "2020-06-14T12:17:41-07:00", "RebootOption": "RebootIfNeeded" } ] }

Untuk informasi selengkapnya, lihat Tentang Kepatuhan Patch di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-instance-patches.

AWS CLI

Contoh 1: Untuk mendapatkan detail status patch untuk sebuah instance

describe-instance-patchesContoh berikut mengambil detail tentang patch untuk instance yang ditentukan.

aws ssm describe-instance-patches \ --instance-id "i-1234567890abcdef0"

Output:

{ "Patches": [ { "Title": "2019-01 Security Update for Adobe Flash Player for Windows Server 2016 for x64-based Systems (KB4480979)", "KBId": "KB4480979", "Classification": "SecurityUpdates", "Severity": "Critical", "State": "Installed", "InstalledTime": "2019-01-09T00:00:00+00:00" }, { "Title": "", "KBId": "KB4481031", "Classification": "", "Severity": "", "State": "InstalledOther", "InstalledTime": "2019-02-08T00:00:00+00:00" }, ... ], "NextToken": "--token string truncated--" }

Contoh 2: Untuk mendapatkan daftar patch dalam status Hilang untuk sebuah instance

describe-instance-patchesContoh berikut mengambil informasi tentang patch yang berada dalam status Hilang untuk instance yang ditentukan.

aws ssm describe-instance-patches \ --instance-id "i-1234567890abcdef0" \ --filters Key=State,Values=Missing

Output:

{ "Patches": [ { "Title": "Windows Malicious Software Removal Tool x64 - February 2019 (KB890830)", "KBId": "KB890830", "Classification": "UpdateRollups", "Severity": "Unspecified", "State": "Missing", "InstalledTime": "1970-01-01T00:00:00+00:00" }, ... ], "NextToken": "--token string truncated--" }

Untuk informasi selengkapnya, lihat Tentang Status Kepatuhan Patch di Panduan Pengguna Manajer AWS Sistem.

Contoh 3: Untuk mendapatkan daftar patch yang diinstal sejak ditentukan InstalledTime untuk sebuah instance

describe-instance-patchesContoh berikut mengambil informasi tentang patch yang diinstal sejak waktu tertentu untuk instance yang ditentukan dengan menggabungkan penggunaan --filters dan--query.

aws ssm describe-instance-patches \ --instance-id "i-1234567890abcdef0" \ --filters Key=State,Values=Installed \ --query "Patches[?InstalledTime >= `2023-01-01T16:00:00`]"

Output:

{ "Patches": [ { "Title": "2023-03 Cumulative Update for Windows Server 2019 (1809) for x64-based Systems (KB5023702)", "KBId": "KB5023702", "Classification": "SecurityUpdates", "Severity": "Critical", "State": "Installed", "InstalledTime": "2023-03-16T11:00:00+00:00" }, ... ], "NextToken": "--token string truncated--" }

Contoh kode berikut menunjukkan cara menggunakandescribe-inventory-deletions.

AWS CLI

Untuk mendapatkan penghapusan inventaris

Contoh ini mengambil detail untuk operasi penghapusan inventaris.

Perintah:

aws ssm describe-inventory-deletions

Output:

{ "InventoryDeletions": [ { "DeletionId": "6961492a-8163-44ec-aa1e-01234567850", "TypeName": "Custom:RackInformation", "DeletionStartTime": 1550254911.0, "LastStatus": "InProgress", "LastStatusMessage": "The Delete is in progress", "DeletionSummary": { "TotalCount": 0, "RemainingCount": 0, "SummaryItems": [] }, "LastStatusUpdateTime": 1550254911.0 }, { "DeletionId": "d72ac9e8-1f60-4d40-b1c6-987654321c4d", "TypeName": "Custom:RackInfo", "DeletionStartTime": 1550254859.0, "LastStatus": "InProgress", "LastStatusMessage": "The Delete is in progress", "DeletionSummary": { "TotalCount": 1, "RemainingCount": 1, "SummaryItems": [ { "Version": "1.0", "Count": 1, "RemainingCount": 1 } ] }, "LastStatusUpdateTime": 1550254859.0 } ] }

Untuk mendapatkan detail penghapusan inventaris tertentu

Contoh ini mengambil detail untuk operasi penghapusan inventaris tertentu.

Perintah:

aws ssm describe-inventory-deletions --deletion-id "d72ac9e8-1f60-4d40-b1c6-987654321c4d"

Output:

{ "InventoryDeletions": [ { "DeletionId": "d72ac9e8-1f60-4d40-b1c6-987654321c4d", "TypeName": "Custom:RackInfo", "DeletionStartTime": 1550254859.0, "LastStatus": "InProgress", "LastStatusMessage": "The Delete is in progress", "DeletionSummary": { "TotalCount": 1, "RemainingCount": 1, "SummaryItems": [ { "Version": "1.0", "Count": 1, "RemainingCount": 1 } ] }, "LastStatusUpdateTime": 1550254859.0 } ] }

Contoh kode berikut menunjukkan cara menggunakandescribe-maintenance-window-execution-task-invocations.

AWS CLI

Untuk mendapatkan pemanggilan tugas tertentu yang dilakukan untuk eksekusi tugas jendela pemeliharaan

describe-maintenance-window-execution-task-invocationsContoh berikut mencantumkan pemanggilan untuk tugas tertentu yang dijalankan sebagai bagian dari eksekusi jendela pemeliharaan yang ditentukan.

aws ssm describe-maintenance-window-execution-task-invocations \ --window-execution-id "518d5565-5969-4cca-8f0e-da3b2a638355" \ --task-id "ac0c6ae1-daa3-4a89-832e-d384503b6586"

Output:

{ "WindowExecutionTaskInvocationIdentities": [ { "Status": "SUCCESS", "Parameters": "{\"documentName\":\"AWS-RunShellScript\",\"instanceIds\":[\"i-0000293ffd8c57862\"],\"parameters\":{\"commands\":[\"df\"]},\"maxConcurrency\":\"1\",\"maxErrors\":\"1\"}", "InvocationId": "e274b6e1-fe56-4e32-bd2a-8073c6381d8b", "StartTime": 1487692834.723, "EndTime": 1487692834.871, "WindowExecutionId": "518d5565-5969-4cca-8f0e-da3b2a638355", "TaskExecutionId": "ac0c6ae1-daa3-4a89-832e-d384503b6586" } ] }

Untuk informasi selengkapnya, lihat Melihat Informasi Tentang Tugas dan Eksekusi Tugas (AWS CLI) di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-maintenance-window-execution-tasks.

AWS CLI

Untuk membuat daftar semua tugas yang terkait dengan eksekusi jendela pemeliharaan

ssm describe-maintenance-window-execution-tasksContoh berikut mencantumkan tugas yang terkait dengan eksekusi jendela pemeliharaan yang ditentukan.

aws ssm describe-maintenance-window-execution-tasks \ --window-execution-id "518d5565-5969-4cca-8f0e-da3b2EXAMPLE"

Output:

{ "WindowExecutionTaskIdentities": [ { "Status": "SUCCESS", "TaskArn": "AWS-RunShellScript", "StartTime": 1487692834.684, "TaskType": "RUN_COMMAND", "EndTime": 1487692835.005, "WindowExecutionId": "518d5565-5969-4cca-8f0e-da3b2EXAMPLE", "TaskExecutionId": "ac0c6ae1-daa3-4a89-832e-d3845EXAMPLE" } ] }

Untuk informasi selengkapnya, lihat Melihat Informasi Tentang Tugas dan Eksekusi Tugas (AWS CLI) di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-maintenance-window-executions.

AWS CLI

Contoh 1: Untuk membuat daftar semua eksekusi untuk jendela pemeliharaan

describe-maintenance-window-executionsContoh berikut mencantumkan semua eksekusi untuk jendela pemeliharaan yang ditentukan.

aws ssm describe-maintenance-window-executions \ --window-id "mw-ab12cd34eEXAMPLE"

Output:

{ "WindowExecutions": [ { "WindowId": "mw-ab12cd34eEXAMPLE", "WindowExecutionId": "6027b513-64fe-4cf0-be7d-1191aEXAMPLE", "Status": "IN_PROGRESS", "StartTime": "2021-08-04T11:00:00.000000-07:00" }, { "WindowId": "mw-ab12cd34eEXAMPLE", "WindowExecutionId": "ff75b750-4834-4377-8f61-b3cadEXAMPLE", "Status": "SUCCESS", "StartTime": "2021-08-03T11:00:00.000000-07:00", "EndTime": "2021-08-03T11:37:21.450000-07:00" }, { "WindowId": "mw-ab12cd34eEXAMPLE", "WindowExecutionId": "9fac7dd9-ff21-42a5-96ad-bbc4bEXAMPLE", "Status": "FAILED", "StatusDetails": "One or more tasks in the orchestration failed.", "StartTime": "2021-08-02T11:00:00.000000-07:00", "EndTime": "2021-08-02T11:22:36.190000-07:00" } ] }

Contoh 2: Untuk membuat daftar semua eksekusi untuk jendela pemeliharaan sebelum tanggal yang ditentukan

describe-maintenance-window-executionsContoh berikut mencantumkan semua eksekusi untuk jendela pemeliharaan yang ditentukan sebelum tanggal yang ditentukan.

aws ssm describe-maintenance-window-executions \ --window-id "mw-ab12cd34eEXAMPLE" \ --filters "Key=ExecutedBefore,Values=2021-08-03T00:00:00Z"

Output:

{ "WindowExecutions": [ { "WindowId": "mw-ab12cd34eEXAMPLE", "WindowExecutionId": "9fac7dd9-ff21-42a5-96ad-bbc4bEXAMPLE", "Status": "FAILED", "StatusDetails": "One or more tasks in the orchestration failed.", "StartTime": "2021-08-02T11:00:00.000000-07:00", "EndTime": "2021-08-02T11:22:36.190000-07:00" } ] }

Contoh 3: Untuk membuat daftar semua eksekusi untuk jendela pemeliharaan setelah tanggal yang ditentukan

describe-maintenance-window-executionsContoh berikut mencantumkan semua eksekusi untuk jendela pemeliharaan yang ditentukan setelah tanggal yang ditentukan.

aws ssm describe-maintenance-window-executions \ --window-id "mw-ab12cd34eEXAMPLE" \ --filters "Key=ExecutedAfter,Values=2021-08-04T00:00:00Z"

Output:

{ "WindowExecutions": [ { "WindowId": "mw-ab12cd34eEXAMPLE", "WindowExecutionId": "6027b513-64fe-4cf0-be7d-1191aEXAMPLE", "Status": "IN_PROGRESS", "StartTime": "2021-08-04T11:00:00.000000-07:00" } ] }

Untuk informasi selengkapnya, lihat Melihat informasi tentang tugas dan eksekusi tugas (AWS CLI) di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-maintenance-window-schedule.

AWS CLI

Contoh 1: Untuk membuat daftar eksekusi yang akan datang untuk jendela pemeliharaan

describe-maintenance-window-scheduleContoh berikut mencantumkan semua eksekusi yang akan datang untuk jendela pemeliharaan yang ditentukan.

aws ssm describe-maintenance-window-schedule \ --window-id mw-ab12cd34eEXAMPLE

Output:

{ "ScheduledWindowExecutions": [ { "WindowId": "mw-ab12cd34eEXAMPLE", "Name": "My-First-Maintenance-Window", "ExecutionTime": "2020-02-19T16:00Z" }, { "WindowId": "mw-ab12cd34eEXAMPLE", "Name": "My-First-Maintenance-Window", "ExecutionTime": "2020-02-26T16:00Z" }, ... ] }

Contoh 2: Untuk membuat daftar semua eksekusi yang akan datang untuk jendela pemeliharaan sebelum tanggal yang ditentukan

describe-maintenance-window-scheduleContoh berikut mencantumkan semua eksekusi yang akan datang untuk jendela pemeliharaan yang ditentukan yang terjadi sebelum tanggal yang ditentukan.

aws ssm describe-maintenance-window-schedule \ --window-id mw-0ecb1226dd7b2e9a6 \ --filters "Key=ScheduledBefore,Values=2020-02-15T06:00:00Z"

Contoh 3: Untuk membuat daftar semua eksekusi yang akan datang untuk jendela pemeliharaan setelah tanggal yang ditentukan

describe-maintenance-window-scheduleContoh berikut mencantumkan semua eksekusi yang akan datang untuk jendela pemeliharaan yang ditentukan yang terjadi setelah tanggal yang ditentukan.

aws ssm describe-maintenance-window-schedule \ --window-id mw-0ecb1226dd7b2e9a6 \ --filters "Key=ScheduledAfter,Values=2020-02-15T06:00:00Z"

Untuk informasi selengkapnya, lihat Melihat Informasi Tentang Pemeliharaan Windows (AWS CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-maintenance-window-targets.

AWS CLI

Contoh 1: Untuk membuat daftar semua target untuk Jendela Pemeliharaan

describe-maintenance-window-targetsContoh berikut mencantumkan semua target untuk jendela pemeliharaan.

aws ssm describe-maintenance-window-targets \ --window-id "mw-06cf17cbefEXAMPLE"

Output:

{ "Targets": [ { "ResourceType": "INSTANCE", "OwnerInformation": "Single instance", "WindowId": "mw-06cf17cbefEXAMPLE", "Targets": [ { "Values": [ "i-0000293ffdEXAMPLE" ], "Key": "InstanceIds" } ], "WindowTargetId": "350d44e6-28cc-44e2-951f-4b2c9EXAMPLE" }, { "ResourceType": "INSTANCE", "OwnerInformation": "Two instances in a list", "WindowId": "mw-06cf17cbefEXAMPLE", "Targets": [ { "Values": [ "i-0000293ffdEXAMPLE", "i-0cb2b964d3EXAMPLE" ], "Key": "InstanceIds" } ], "WindowTargetId": "e078a987-2866-47be-bedd-d9cf4EXAMPLE" } ] }

Contoh 2: Untuk membuat daftar semua target untuk jendela pemeliharaan yang cocok dengan nilai informasi pemilik tertentu

describe-maintenance-window-targetsContoh ini mencantumkan semua target untuk jendela pemeliharaan dengan nilai tertentu.

aws ssm describe-maintenance-window-targets \ --window-id "mw-0ecb1226ddEXAMPLE" \ --filters "Key=OwnerInformation,Values=CostCenter1"

Output:

{ "Targets": [ { "WindowId": "mw-0ecb1226ddEXAMPLE", "WindowTargetId": "da89dcc3-7f9c-481d-ba2b-edcb7d0057f9", "ResourceType": "INSTANCE", "Targets": [ { "Key": "tag:Environment", "Values": [ "Prod" ] } ], "OwnerInformation": "CostCenter1", "Name": "ProdTarget1" } ] }

Untuk informasi selengkapnya, lihat Melihat Informasi Tentang Pemeliharaan Windows (AWS CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-maintenance-window-tasks.

AWS CLI

Contoh 1: Untuk membuat daftar semua tugas untuk jendela pemeliharaan

describe-maintenance-window-tasksContoh berikut mencantumkan semua tugas untuk jendela pemeliharaan yang ditentukan.

aws ssm describe-maintenance-window-tasks \ --window-id "mw-06cf17cbefEXAMPLE"

Output:

{ "Tasks": [ { "WindowId": "mw-06cf17cbefEXAMPLE", "WindowTaskId": "018b31c3-2d77-4b9e-bd48-c91edEXAMPLE", "TaskArn": "AWS-RestartEC2Instance", "TaskParameters": {}, "Type": "AUTOMATION", "Description": "Restarting EC2 Instance for maintenance", "MaxConcurrency": "1", "MaxErrors": "1", "Name": "My-Automation-Example-Task", "Priority": 0, "ServiceRoleArn": "arn:aws:iam::111222333444:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM", "Targets": [ { "Key": "WindowTargetIds", "Values": [ "da89dcc3-7f9c-481d-ba2b-edcb7EXAMPLE" ] } ] }, { "WindowId": "mw-06cf17cbefEXAMPLE", "WindowTaskId": "1943dee0-0a17-4978-9bf4-3cc2fEXAMPLE", "TaskArn": "AWS-DisableS3BucketPublicReadWrite", "TaskParameters": {}, "Type": "AUTOMATION", "Description": "Automation task to disable read/write access on public S3 buckets", "MaxConcurrency": "10", "MaxErrors": "5", "Name": "My-Disable-S3-Public-Read-Write-Access-Automation-Task", "Priority": 0, "ServiceRoleArn": "arn:aws:iam::111222333444:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM", "Targets": [ { "Key": "WindowTargetIds", "Values": [ "da89dcc3-7f9c-481d-ba2b-edcb7EXAMPLE" ] } ] } ] }

Contoh 2: Untuk membuat daftar semua tugas untuk jendela pemeliharaan yang memanggil dokumen perintah AWS- RunPowerShellScript

describe-maintenance-window-tasksContoh berikut mencantumkan semua tugas untuk jendela pemeliharaan yang ditentukan yang memanggil dokumen AWS-RunPowerShellScript perintah.

aws ssm describe-maintenance-window-tasks \ --window-id "mw-ab12cd34eEXAMPLE" \ --filters "Key=TaskArn,Values=AWS-RunPowerShellScript"

Output:

{ "Tasks": [ { "WindowId": "mw-ab12cd34eEXAMPLE", "WindowTaskId": "0d36e6b4-3a4f-411e-adcb-3558eEXAMPLE", "TaskArn": "AWS-RunPowerShellScript", "Type": "RUN_COMMAND", "Targets": [ { "Key": "WindowTargetIds", "Values": [ "da89dcc3-7f9c-481d-ba2b-edcb7EXAMPLE" ] } ], "TaskParameters": {}, "Priority": 1, "ServiceRoleArn": "arn:aws:iam::111222333444:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM", "MaxConcurrency": "1", "MaxErrors": "1", "Name": "MyTask" } ] }

Contoh 3: Untuk membuat daftar semua tugas untuk jendela pemeliharaan yang memiliki Prioritas 3

describe-maintenance-window-tasksContoh berikut mencantumkan semua tugas untuk jendela pemeliharaan yang ditentukan yang memiliki a Priority of3.

aws ssm describe-maintenance-window-tasks \ --window-id "mw-ab12cd34eEXAMPLE" \ --filters "Key=Priority,Values=3"

Output:

{ "Tasks": [ { "WindowId": "mw-ab12cd34eEXAMPLE", "WindowTaskId": "0d36e6b4-3a4f-411e-adcb-3558eEXAMPLE", "TaskArn": "AWS-RunPowerShellScript", "Type": "RUN_COMMAND", "Targets": [ { "Key": "WindowTargetIds", "Values": [ "da89dcc3-7f9c-481d-ba2b-edcb7EXAMPLE" ] } ], "TaskParameters": {}, "Priority": 3, "ServiceRoleArn": "arn:aws:iam::111222333444:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM", "MaxConcurrency": "1", "MaxErrors": "1", "Name": "MyRunCommandTask" }, { "WindowId": "mw-ab12cd34eEXAMPLE", "WindowTaskId": "ee45feff-ad65-4a6c-b478-5cab8EXAMPLE", "TaskArn": "AWS-RestartEC2Instance", "Type": "AUTOMATION", "Targets": [ { "Key": "WindowTargetIds", "Values": [ "da89dcc3-7f9c-481d-ba2b-edcb7EXAMPLE" ] } ], "TaskParameters": {}, "Priority": 3, "ServiceRoleArn": "arn:aws:iam::111222333444:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM", "MaxConcurrency": "10", "MaxErrors": "5", "Name": "My-Automation-Task", "Description": "A description for my Automation task" } ] }

Contoh 4: Untuk membuat daftar semua tugas untuk jendela pemeliharaan yang memiliki Prioritas 1 dan menggunakan Run Command

describe-maintenance-window-tasksContoh ini mencantumkan semua tugas untuk jendela pemeliharaan yang ditentukan yang memiliki 1 dan Priority penggunaanRun Command.

aws ssm describe-maintenance-window-tasks \ --window-id "mw-ab12cd34eEXAMPLE" \ --filters "Key=Priority,Values=1" "Key=TaskType,Values=RUN_COMMAND"

Output:

{ "Tasks": [ { "WindowId": "mw-ab12cd34eEXAMPLE", "WindowTaskId": "0d36e6b4-3a4f-411e-adcb-3558eEXAMPLE", "TaskArn": "AWS-RunPowerShellScript", "Type": "RUN_COMMAND", "Targets": [ { "Key": "WindowTargetIds", "Values": [ "da89dcc3-7f9c-481d-ba2b-edcb7EXAMPLE" ] } ], "TaskParameters": {}, "Priority": 1, "ServiceRoleArn": "arn:aws:iam::111222333444:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM", "MaxConcurrency": "1", "MaxErrors": "1", "Name": "MyRunCommandTask" } ] }

Untuk informasi selengkapnya, lihat Melihat informasi tentang jendela pemeliharaan (AWS CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-maintenance-windows-for-target.

AWS CLI

Untuk membuat daftar semua jendela pemeliharaan yang terkait dengan instance tertentu

describe-maintenance-windows-for-targetContoh berikut mencantumkan jendela pemeliharaan yang memiliki target atau tugas yang terkait dengan instance yang ditentukan.

aws ssm describe-maintenance-windows-for-target \ --targets Key=InstanceIds,Values=i-1234567890EXAMPLE \ --resource-type INSTANCE

Output:

{ "WindowIdentities": [ { "WindowId": "mw-0c5ed765acEXAMPLE", "Name": "My-First-Maintenance-Window" } ] }

Untuk informasi selengkapnya, lihat Melihat Informasi Tentang Pemeliharaan Windows (AWS CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-maintenance-windows.

AWS CLI

Contoh 1: Untuk membuat daftar semua jendela pemeliharaan

describe-maintenance-windowsContoh berikut mencantumkan semua jendela pemeliharaan di AWS akun Anda di Wilayah saat ini.

aws ssm describe-maintenance-windows

Output:

{ "WindowIdentities": [ { "WindowId": "mw-0ecb1226ddEXAMPLE", "Name": "MyMaintenanceWindow-1", "Enabled": true, "Duration": 2, "Cutoff": 1, "Schedule": "rate(180 minutes)", "NextExecutionTime": "2020-02-12T23:19:20.596Z" }, { "WindowId": "mw-03eb9db428EXAMPLE", "Name": "MyMaintenanceWindow-2", "Enabled": true, "Duration": 3, "Cutoff": 1, "Schedule": "rate(7 days)", "NextExecutionTime": "2020-02-17T23:22:00.956Z" }, ] }

Contoh 2: Untuk membuat daftar semua jendela pemeliharaan yang diaktifkan

describe-maintenance-windowsContoh berikut mencantumkan semua jendela pemeliharaan yang diaktifkan.

aws ssm describe-maintenance-windows \ --filters "Key=Enabled,Values=true"

Contoh 3: Untuk membuat daftar jendela pemeliharaan yang cocok dengan nama tertentu

describe-maintenance-windowsContoh ini mencantumkan semua jendela pemeliharaan dengan nama yang ditentukan.

aws ssm describe-maintenance-windows \ --filters "Key=Name,Values=MyMaintenanceWindow"

Untuk informasi selengkapnya, lihat Melihat Informasi Tentang Pemeliharaan Windows (AWS CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-ops-items.

AWS CLI

Untuk membuat daftar satu set OpsItems

describe-ops-itemsContoh berikut menampilkan daftar semua yang terbuka OpsItems di AWS akun Anda.

aws ssm describe-ops-items \ --ops-item-filters "Key=Status,Values=Open,Operator=Equal"

Output:

{ "OpsItemSummaries": [ { "CreatedBy": "arn:aws:sts::111222333444:assumed-role/OpsItem-CWE-Role/fbf77cbe264a33509569f23e4EXAMPLE", "CreatedTime": "2020-03-14T17:02:46.375000-07:00", "LastModifiedBy": "arn:aws:sts::111222333444:assumed-role/OpsItem-CWE-Role/fbf77cbe264a33509569f23e4EXAMPLE", "LastModifiedTime": "2020-03-14T17:02:46.375000-07:00", "Source": "SSM", "Status": "Open", "OpsItemId": "oi-7cfc5EXAMPLE", "Title": "SSM Maintenance Window execution failed", "OperationalData": { "/aws/dedup": { "Value": "{\"dedupString\":\"SSMOpsItems-SSM-maintenance-window-execution-failed\"}", "Type": "SearchableString" }, "/aws/resources": { "Value": "[{\"arn\":\"arn:aws:ssm:us-east-2:111222333444:maintenancewindow/mw-034093d322EXAMPLE\"}]", "Type": "SearchableString" } }, "Category": "Availability", "Severity": "3" }, { "CreatedBy": "arn:aws:sts::1112223233444:assumed-role/OpsItem-CWE-Role/fbf77cbe264a33509569f23e4EXAMPLE", "CreatedTime": "2020-02-26T11:43:15.426000-08:00", "LastModifiedBy": "arn:aws:sts::111222333444:assumed-role/OpsItem-CWE-Role/fbf77cbe264a33509569f23e4EXAMPLE", "LastModifiedTime": "2020-02-26T11:43:15.426000-08:00", "Source": "EC2", "Status": "Open", "OpsItemId": "oi-6f966EXAMPLE", "Title": "EC2 instance stopped", "OperationalData": { "/aws/automations": { "Value": "[ { \"automationType\": \"AWS:SSM:Automation\", \"automationId\": \"AWS-RestartEC2Instance\" } ]", "Type": "SearchableString" }, "/aws/dedup": { "Value": "{\"dedupString\":\"SSMOpsItems-EC2-instance-stopped\"}", "Type": "SearchableString" }, "/aws/resources": { "Value": "[{\"arn\":\"arn:aws:ec2:us-east-2:111222333444:instance/i-0beccfbc02EXAMPLE\"}]", "Type": "SearchableString" } }, "Category": "Availability", "Severity": "3" } ] }

Untuk informasi selengkapnya, lihat Bek erja dengan OpsItems di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-parameters.

AWS CLI

Contoh 1: Untuk membuat daftar semua parameter

describe-parametersContoh berikut mencantumkan semua parameter di AWS akun saat ini dan Wilayah.

aws ssm describe-parameters

Output:

{ "Parameters": [ { "Name": "MySecureStringParameter", "Type": "SecureString", "KeyId": "alias/aws/ssm", "LastModifiedDate": 1582155479.205, "LastModifiedUser": "arn:aws:sts::111222333444:assumed-role/Admin/Richard-Roe-Managed", "Description": "This is a SecureString parameter", "Version": 2, "Tier": "Advanced", "Policies": [ { "PolicyText": "{\"Type\":\"Expiration\",\"Version\":\"1.0\",\"Attributes\":{\"Timestamp\":\"2020-07-07T22:30:00Z\"}}", "PolicyType": "Expiration", "PolicyStatus": "Pending" }, { "PolicyText": "{\"Type\":\"ExpirationNotification\",\"Version\":\"1.0\",\"Attributes\":{\"Before\":\"12\",\"Unit\":\"Hours\"}}", "PolicyType": "ExpirationNotification", "PolicyStatus": "Pending" } ] }, { "Name": "MyStringListParameter", "Type": "StringList", "LastModifiedDate": 1582154764.222, "LastModifiedUser": "arn:aws:iam::111222333444:user/Mary-Major", "Description": "This is a StringList parameter", "Version": 1, "Tier": "Standard", "Policies": [] }, { "Name": "MyStringParameter", "Type": "String", "LastModifiedDate": 1582154711.976, "LastModifiedUser": "arn:aws:iam::111222333444:user/Alejandro-Rosalez", "Description": "This is a String parameter", "Version": 1, "Tier": "Standard", "Policies": [] }, { "Name": "latestAmi", "Type": "String", "LastModifiedDate": 1580862415.521, "LastModifiedUser": "arn:aws:sts::111222333444:assumed-role/lambda-ssm-role/Automation-UpdateSSM-Param", "Version": 3, "Tier": "Standard", "Policies": [] } ] }

Contoh 2: Untuk membuat daftar semua parameter yang cocok dengan metadata tertentu

describe-parametersContoh ini mencantumkan semua parameter yang cocok dengan filter.

aws ssm describe-parameter --filter “Kunci = Jenis, Nilai =” StringList

Output:

{ "Parameters": [ { "Name": "MyStringListParameter", "Type": "StringList", "LastModifiedDate": 1582154764.222, "LastModifiedUser": "arn:aws:iam::111222333444:user/Mary-Major", "Description": "This is a StringList parameter", "Version": 1, "Tier": "Standard", "Policies": [] } ] }

Untuk informasi selengkapnya, lihat Mencari Parameter Manajer AWS Sistem di Panduan Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-patch-baselines.

AWS CLI

Contoh 1: Untuk membuat daftar semua garis dasar patch

describe-patch-baselinesContoh berikut mengambil detail untuk semua garis dasar patch di akun Anda di Wilayah saat ini.

aws ssm describe-patch-baselines

Output:

{ "BaselineIdentities": [ { "BaselineName": "AWS-SuseDefaultPatchBaseline", "DefaultBaseline": true, "BaselineDescription": "Default Patch Baseline for Suse Provided by AWS.", "BaselineId": "arn:aws:ssm:us-east-2:733109147000:patchbaseline/pb-0123fdb36e334a3b2", "OperatingSystem": "SUSE" }, { "BaselineName": "AWS-DefaultPatchBaseline", "DefaultBaseline": false, "BaselineDescription": "Default Patch Baseline Provided by AWS.", "BaselineId": "arn:aws:ssm:us-east-2:733109147000:patchbaseline/pb-020d361a05defe4ed", "OperatingSystem": "WINDOWS" }, ... { "BaselineName": "MyWindowsPatchBaseline", "DefaultBaseline": true, "BaselineDescription": "My patch baseline for EC2 instances for Windows Server", "BaselineId": "pb-0ad00e0dd7EXAMPLE", "OperatingSystem": "WINDOWS" } ] }

Contoh 2: Untuk membuat daftar semua garis dasar patch yang disediakan oleh AWS

describe-patch-baselinesContoh berikut mencantumkan semua garis dasar patch yang disediakan oleh. AWS

aws ssm describe-patch-baselines \ --filters "Key=OWNER,Values=[AWS]"

Contoh 3: Untuk membuat daftar semua garis dasar patch yang Anda miliki

describe-patch-baselinesContoh berikut mencantumkan semua garis dasar patch kustom yang dibuat di akun Anda di Wilayah saat ini.

aws ssm describe-patch-baselines \ --filters "Key=OWNER,Values=[Self]"

Untuk informasi selengkapnya, lihat Tentang Garis Dasar Patch Standar dan Kustom di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-patch-group-state.

AWS CLI

Untuk mendapatkan status grup patch

describe-patch-group-stateContoh berikut mengambil ringkasan kepatuhan patch tingkat tinggi untuk grup patch.

aws ssm describe-patch-group-state \ --patch-group "Production"

Output:

{ "Instances": 21, "InstancesWithCriticalNonCompliantPatches": 1, "InstancesWithFailedPatches": 2, "InstancesWithInstalledOtherPatches": 3, "InstancesWithInstalledPatches": 21, "InstancesWithInstalledPendingRebootPatches": 2, "InstancesWithInstalledRejectedPatches": 1, "InstancesWithMissingPatches": 3, "InstancesWithNotApplicablePatches": 4, "InstancesWithOtherNonCompliantPatches": 1, "InstancesWithSecurityNonCompliantPatches": 1, "InstancesWithUnreportedNotApplicablePatches": 2 }

Untuk informasi selengkapnya, lihat Tentang grup patch < https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-patch-patchgroups.html >__ dan Mem ahami nilai status kepatuhan patch di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-patch-groups.

AWS CLI

Untuk menampilkan pendaftaran grup patch

describe-patch-groupsContoh berikut mencantumkan pendaftaran grup patch.

aws ssm describe-patch-groups

Output:

{ "Mappings": [ { "PatchGroup": "Production", "BaselineIdentity": { "BaselineId": "pb-0123456789abcdef0", "BaselineName": "ProdPatching", "OperatingSystem": "WINDOWS", "BaselineDescription": "Patches for Production", "DefaultBaseline": false } }, { "PatchGroup": "Development", "BaselineIdentity": { "BaselineId": "pb-0713accee01234567", "BaselineName": "DevPatching", "OperatingSystem": "WINDOWS", "BaselineDescription": "Patches for Development", "DefaultBaseline": true } }, ... ] }

Untuk informasi selengkapnya, lihat Membuat Grup Patch < https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-patch-group-tagging.html >__ dan Menambahkan Grup Patch ke Dasar Patch di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-patch-properties.

AWS CLI

Untuk mencantumkan ketersediaan patch Amazon Linux

describe-patch-propertiesContoh berikut menampilkan daftar produk Amazon Linux yang tambalannya tersedia di AWS akun Anda.

aws ssm describe-patch-properties \ --operating-system AMAZON_LINUX \ --property PRODUCT

Output:

{ "Properties": [ { "Name": "AmazonLinux2012.03" }, { "Name": "AmazonLinux2012.09" }, { "Name": "AmazonLinux2013.03" }, { "Name": "AmazonLinux2013.09" }, { "Name": "AmazonLinux2014.03" }, { "Name": "AmazonLinux2014.09" }, { "Name": "AmazonLinux2015.03" }, { "Name": "AmazonLinux2015.09" }, { "Name": "AmazonLinux2016.03" }, { "Name": "AmazonLinux2016.09" }, { "Name": "AmazonLinux2017.03" }, { "Name": "AmazonLinux2017.09" }, { "Name": "AmazonLinux2018.03" } ] }

Untuk informasi selengkapnya, lihat Tentang Garis Dasar Patch di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakandescribe-sessions.

AWS CLI

Contoh 1: Untuk membuat daftar semua sesi Manajer Sesi yang aktif

describe-sessionsContoh ini mengambil daftar sesi aktif yang dibuat terbaru (baik sesi terhubung maupun terputus) selama 30 hari terakhir yang dimulai oleh pengguna yang ditentukan. Perintah ini hanya mengembalikan hasil untuk koneksi ke target yang dimulai menggunakan Session Manager. Itu tidak mencantumkan koneksi yang dibuat melalui cara lain, seperti Koneksi Desktop Jarak Jauh atau SSH.

aws ssm describe-sessions \ --state "Active" \ --filters "key=Owner,value=arn:aws:sts::123456789012:assumed-role/Administrator/Shirley-Rodriguez"

Output:

{ "Sessions": [ { "SessionId": "John-07a16060613c408b5", "Target": "i-1234567890abcdef0", "Status": "Connected", "StartDate": 1550676938.352, "Owner": "arn:aws:sts::123456789012:assumed-role/Administrator/Shirley-Rodriguez", "OutputUrl": {} }, { "SessionId": "John-01edf534b8b56e8eb", "Target": "i-9876543210abcdef0", "Status": "Connected", "StartDate": 1550676842.194, "Owner": "arn:aws:sts::123456789012:assumed-role/Administrator/Shirley-Rodriguez", "OutputUrl": {} } ] }

Contoh 2: Untuk membuat daftar semua sesi Manajer Sesi yang dihentikan

describe-sessionsContoh ini mengambil daftar sesi yang terakhir dihentikan dari 30 hari terakhir untuk semua pengguna.

aws ssm describe-sessions \ --state "History"

Output:

{ "Sessions": [ { "SessionId": "Mary-Major-0022b1eb2b0d9e3bd", "Target": "i-1234567890abcdef0", "Status": "Terminated", "StartDate": 1550520701.256, "EndDate": 1550521931.563, "Owner": "arn:aws:sts::123456789012:assumed-role/Administrator/Mary-Major" }, { "SessionId": "Jane-Roe-0db53f487931ed9d4", "Target": "i-9876543210abcdef0", "Status": "Terminated", "StartDate": 1550161369.149, "EndDate": 1550162580.329, "Owner": "arn:aws:sts::123456789012:assumed-role/Administrator/Jane-Roe" }, ... ], "NextToken": "--token string truncated--" }

Untuk informasi selengkapnya, lihat Melihat Riwayat Sesi di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakandisassociate-ops-item-related-item.

AWS CLI

Untuk menghapus asosiasi item terkait

disassociate-ops-item-related-itemContoh berikut menghapus hubungan antara OpsItem dan item terkait.

aws ssm disassociate-ops-item-related-item \ --ops-item-id "oi-f99f2EXAMPLE" \ --association-id "e2036148-cccb-490e-ac2a-390e5EXAMPLE"

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Bekerja dengan insiden Manajer Insiden OpsCenter di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanget-automation-execution.

AWS CLI

Untuk menampilkan detail tentang eksekusi otomatisasi

get-automation-executionContoh berikut menampilkan informasi terperinci tentang eksekusi Otomasi.

aws ssm get-automation-execution \ --automation-execution-id 73c8eef8-f4ee-4a05-820c-e354fEXAMPLE

Output:

{ "AutomationExecution": { "AutomationExecutionId": "73c8eef8-f4ee-4a05-820c-e354fEXAMPLE", "DocumentName": "AWS-StartEC2Instance", "DocumentVersion": "1", "ExecutionStartTime": 1583737233.748, "ExecutionEndTime": 1583737234.719, "AutomationExecutionStatus": "Success", "StepExecutions": [ { "StepName": "startInstances", "Action": "aws:changeInstanceState", "ExecutionStartTime": 1583737234.134, "ExecutionEndTime": 1583737234.672, "StepStatus": "Success", "Inputs": { "DesiredState": "\"running\"", "InstanceIds": "[\"i-0cb99161f6EXAMPLE\"]" }, "Outputs": { "InstanceStates": [ "running" ] }, "StepExecutionId": "95e70479-cf20-4d80-8018-7e4e2EXAMPLE", "OverriddenParameters": {} } ], "StepExecutionsTruncated": false, "Parameters": { "AutomationAssumeRole": [ "" ], "InstanceId": [ "i-0cb99161f6EXAMPLE" ] }, "Outputs": {}, "Mode": "Auto", "ExecutedBy": "arn:aws:sts::29884EXAMPLE:assumed-role/mw_service_role/OrchestrationService", "Targets": [], "ResolvedTargets": { "ParameterValues": [], "Truncated": false } } }

Untuk informasi selengkapnya, lihat Walkthrough: Patch a Linux AMI (AWS CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanget-calendar-state.

AWS CLI

Contoh 1: Untuk mendapatkan status kalender perubahan saat ini

get-calendar-stateContoh ini mengembalikan status kalender pada waktu saat ini. Karena contoh tidak menentukan waktu, status kalender saat ini dilaporkan.

aws ssm get-calendar-state \ --calendar-names "MyCalendar"

Output:

{ "State": "OPEN", "AtTime": "2020-02-19T22:28:51Z", "NextTransitionTime": "2020-02-24T21:15:19Z" }

Contoh 2: Untuk mendapatkan status kalender perubahan pada waktu tertentu

get-calendar-stateContoh ini mengembalikan status kalender pada waktu yang ditentukan.

aws ssm get-calendar-state \ --calendar-names "MyCalendar" \ --at-time "2020-07-19T21:15:19Z"

Output:

{ "State": "CLOSED", "AtTime": "2020-07-19T21:15:19Z" }

Untuk informasi selengkapnya, lihat Mendapatkan Status Kalender Perubahan di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanget-command-invocation.

AWS CLI

Untuk menampilkan rincian pemanggilan perintah

get-command-invocationContoh berikut mencantumkan semua pemanggilan perintah yang ditentukan pada instance yang ditentukan.

aws ssm get-command-invocation \ --command-id "ef7fdfd8-9b57-4151-a15c-db9a12345678" \ --instance-id "i-1234567890abcdef0"

Output:

{ "CommandId": "ef7fdfd8-9b57-4151-a15c-db9a12345678", "InstanceId": "i-1234567890abcdef0", "Comment": "b48291dd-ba76-43e0-b9df-13e11ddaac26:6960febb-2907-4b59-8e1a-d6ce8EXAMPLE", "DocumentName": "AWS-UpdateSSMAgent", "DocumentVersion": "", "PluginName": "aws:updateSsmAgent", "ResponseCode": 0, "ExecutionStartDateTime": "2020-02-19T18:18:03.419Z", "ExecutionElapsedTime": "PT0.091S", "ExecutionEndDateTime": "2020-02-19T18:18:03.419Z", "Status": "Success", "StatusDetails": "Success", "StandardOutputContent": "Updating amazon-ssm-agent from 2.3.842.0 to latest\nSuccessfully downloaded https://s3.us-east-2.amazonaws.com/amazon-ssm-us-east-2/ssm-agent-manifest.json\namazon-ssm-agent 2.3.842.0 has already been installed, update skipped\n", "StandardOutputUrl": "", "StandardErrorContent": "", "StandardErrorUrl": "", "CloudWatchOutputConfig": { "CloudWatchLogGroupName": "", "CloudWatchOutputEnabled": false } }

Untuk informasi selengkapnya, lihat Memahami Status Perintah di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanget-connection-status.

AWS CLI

Untuk menampilkan status koneksi instans terkelola

get-connection-statusContoh ini mengembalikan status koneksi dari instance terkelola yang ditentukan.

aws ssm get-connection-status \ --target i-1234567890abcdef0

Output:

{ "Target": "i-1234567890abcdef0", "Status": "connected" }

Contoh kode berikut menunjukkan cara menggunakanget-default-patch-baseline.

AWS CLI

Contoh 1: Untuk menampilkan baseline patch Windows default

get-default-patch-baselineContoh berikut mengambil detail untuk baseline patch default untuk Windows Server.

aws ssm get-default-patch-baseline

Output:

{ "BaselineId": "pb-0713accee01612345", "OperatingSystem": "WINDOWS" }

Contoh 2: Untuk menampilkan baseline patch default untuk Amazon Linux

get-default-patch-baselineContoh berikut mengambil detail untuk baseline patch default untuk Amazon Linux.

aws ssm get-default-patch-baseline \ --operating-system AMAZON_LINUX

Output:

{ "BaselineId": "pb-047c6eb9c8fc12345", "OperatingSystem": "AMAZON_LINUX" }

Untuk informasi selengkapnya, lihat Tentang Garis Dasar Patch Standar dan Kustom < https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-patch-baselines.html >__ dan Meng atur Baseline Patch yang Ada sebagai Default di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanget-deployable-patch-snapshot-for-instance.

AWS CLI

Untuk mengambil snapshot saat ini untuk baseline patch, sebuah instance menggunakan

get-deployable-patch-snapshot-for-instanceContoh berikut mengambil detail untuk snapshot saat ini untuk baseline patch tertentu yang digunakan oleh instance. Perintah ini harus dijalankan dari instance menggunakan kredenSIAL instance. Untuk memastikannya menggunakan kredentif instans, jalankan aws configure dan tentukan hanya Wilayah instans Anda. Biarkan Secret Key bidang Access Key dan kosong.

Tip: Gunakan uuidgen untuk menghasilkan asnapshot-id.

aws ssm get-deployable-patch-snapshot-for-instance \ --instance-id "i-1234567890abcdef0" \ --snapshot-id "521c3536-930c-4aa9-950e-01234567abcd"

Output:

{ "InstanceId": "i-1234567890abcdef0", "SnapshotId": "521c3536-930c-4aa9-950e-01234567abcd", "Product": "AmazonLinux2018.03", "SnapshotDownloadUrl": "https://patch-baseline-snapshot-us-east-1.s3.amazonaws.com/ed85194ef27214f5984f28b4d664d14f7313568fea7d4b6ac6c10ad1f729d7e7-773304212436/AMAZON_LINUX-521c3536-930c-4aa9-950e-01234567abcd?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20190215T164031Z&X-Amz-SignedHeaders=host&X-Amz-Expires=86400&X-Amz-Credential=AKIAJ5C56P35AEBRX2QQ%2F20190215%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=efaaaf6e3878e77f48a6697e015efdbda9c426b09c5822055075c062f6ad2149" }

Untuk informasi selengkapnya, lihat Nama parameter: ID Snapshot di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanget-document.

AWS CLI

Untuk mendapatkan konten dokumen

get-documentContoh berikut menampilkan konten dokumen Manajer Sistem.

aws ssm get-document \ --name "AWS-RunShellScript"

Output:

{ "Name": "AWS-RunShellScript", "DocumentVersion": "1", "Status": "Active", "Content": "{\n \"schemaVersion\":\"1.2\",\n \"description\":\"Run a shell script or specify the commands to run.\",\n \"parameters\":{\n \"commands\":{\n \"type\":\"StringList\",\n \"description\":\"(Required) Specify a shell script or a command to run.\",\n \"minItems\":1,\n \"displayType\":\"textarea\"\n },\n \"workingDirectory\":{\n \"type\":\"String\",\n \"default\":\"\",\n \"description\":\"(Optional) The path to the working directory on your instance.\",\n \"maxChars\":4096\n },\n \"executionTimeout\":{\n \"type\":\"String\",\n \"default\":\"3600\",\n \"description\":\"(Optional) The time in seconds for a command to complete before it is considered to have failed. Default is 3600 (1 hour). Maximum is 172800 (48 hours).\",\n \"allowedPattern\":\"([1-9][0-9]{0,4})|(1[0-6][0-9]{4})|(17[0-1][0-9]{3})|(172[0-7][0-9]{2})|(172800)\"\n }\n },\n \"runtimeConfig\":{\n \"aws:runShellScript\":{\n \"properties\":[\n {\n \"id\":\"0.aws:runShellScript\",\n \"runCommand\":\"{{ commands }}\",\n \"workingDirectory\":\"{{ workingDirectory }}\",\n \"timeoutSeconds\":\"{{ executionTimeout }}\"\n }\n ]\n }\n }\n}\n", "DocumentType": "Command", "DocumentFormat": "JSON" }

Untuk informasi selengkapnya, lihat AWS Dokumen Manajer AWS Sistem di Panduan Pengguna Manajer Sistem.

  • Untuk detail API, lihat GetDocument di Refer AWS CLI ensi Perintah.

Contoh kode berikut menunjukkan cara menggunakanget-inventory-schema.

AWS CLI

Untuk melihat skema inventaris

Contoh ini mengembalikan daftar nama jenis inventaris untuk akun.

Perintah:

aws ssm get-inventory-schema

Output:

{ "Schemas": [ { "TypeName": "AWS:AWSComponent", "Version": "1.0", "Attributes": [ { "Name": "Name", "DataType": "STRING" }, { "Name": "ApplicationType", "DataType": "STRING" }, { "Name": "Publisher", "DataType": "STRING" }, { "Name": "Version", "DataType": "STRING" }, { "Name": "InstalledTime", "DataType": "STRING" }, { "Name": "Architecture", "DataType": "STRING" }, { "Name": "URL", "DataType": "STRING" } ] }, ... ], "NextToken": "--token string truncated--" }

Untuk melihat skema inventaris untuk jenis inventaris tertentu

Contoh ini mengembalikan skema inventaris untuk jenis inventaris AWS:AWS Komponen.

Perintah:

aws ssm get-inventory-schema --type-name "AWS:AWSComponent"

Contoh kode berikut menunjukkan cara menggunakanget-inventory.

AWS CLI

Untuk melihat inventaris Anda

Contoh ini mendapatkan metadata khusus untuk inventaris Anda.

Perintah:

aws ssm get-inventory

Output:

{ "Entities": [ { "Data": { "AWS:InstanceInformation": { "Content": [ { "ComputerName": "ip-172-31-44-222.us-west-2.compute.internal", "InstanceId": "i-0cb2b964d3e14fd9f", "IpAddress": "172.31.44.222", "AgentType": "amazon-ssm-agent", "ResourceType": "EC2Instance", "AgentVersion": "2.0.672.0", "PlatformVersion": "2016.09", "PlatformName": "Amazon Linux AMI", "PlatformType": "Linux" } ], "TypeName": "AWS:InstanceInformation", "SchemaVersion": "1.0", "CaptureTime": "2017-02-20T18:03:58Z" } }, "Id": "i-0cb2b964d3e14fd9f" } ] }
  • Untuk detail API, lihat GetInventory di Refer AWS CLI ensi Perintah.

Contoh kode berikut menunjukkan cara menggunakanget-maintenance-window-execution-task-invocation.

AWS CLI

Untuk mendapatkan informasi tentang pemanggilan tugas jendela pemeliharaan

get-maintenance-window-execution-task-invocationContoh berikut mencantumkan informasi tentang pemanggilan tugas tertentu yang merupakan bagian dari eksekusi jendela pemeliharaan yang ditentukan.

aws ssm get-maintenance-window-execution-task-invocation \ --window-execution-id "bc494bfa-e63b-49f6-8ad1-aa9f2EXAMPLE" \ --task-id "96f2ad59-97e3-461d-a63d-40c8aEXAMPLE" \ --invocation-id "a5273e2c-d2c6-4880-b3e1-5e550EXAMPLE"

Output:

{ "Status": "SUCCESS", "Parameters": "{\"comment\":\"\",\"documentName\":\"AWS-RunPowerShellScript\",\"instanceIds\":[\"i-1234567890EXAMPLE\"],\"maxConcurrency\":\"1\",\"maxErrors\":\"1\",\"parameters\":{\"executionTimeout\":[\"3600\"],\"workingDirectory\":[\"\"],\"commands\":[\"echo Hello\"]},\"timeoutSeconds\":600}", "ExecutionId": "03b6baa0-5460-4e15-83f2-ea685EXAMPLE", "InvocationId": "a5273e2c-d2c6-4880-b3e1-5e550EXAMPLE", "StartTime": 1549998326.421, "TaskType": "RUN_COMMAND", "EndTime": 1550001931.784, "WindowExecutionId": "bc494bfa-e63b-49f6-8ad1-aa9f2EXAMPLE", "StatusDetails": "Failed", "TaskExecutionId": "96f2ad59-97e3-461d-a63d-40c8aEXAMPLE" }

Untuk informasi selengkapnya, lihat Melihat Informasi Tentang Tugas dan Eksekusi Tugas (AWS CLI) di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanget-maintenance-window-execution-task.

AWS CLI

Untuk mendapatkan informasi tentang eksekusi tugas jendela pemeliharaan

get-maintenance-window-execution-taskContoh berikut mencantumkan informasi tentang tugas yang merupakan bagian dari eksekusi jendela pemeliharaan yang ditentukan.

aws ssm get-maintenance-window-execution-task \ --window-execution-id "518d5565-5969-4cca-8f0e-da3b2EXAMPLE" \ --task-id "ac0c6ae1-daa3-4a89-832e-d3845EXAMPLE"

Output:

{ "WindowExecutionId": "518d5565-5969-4cca-8f0e-da3b2EXAMPLE", "TaskExecutionId": "ac0c6ae1-daa3-4a89-832e-d3845EXAMPLE", "TaskArn": "AWS-RunPatchBaseline", "ServiceRole": "arn:aws:iam::111222333444:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM", "Type": "RUN_COMMAND", "TaskParameters": [ { "BaselineOverride": { "Values": [ "" ] }, "InstallOverrideList": { "Values": [ "" ] }, "Operation": { "Values": [ "Scan" ] }, "RebootOption": { "Values": [ "RebootIfNeeded" ] }, "SnapshotId": { "Values": [ "{{ aws:ORCHESTRATION_ID }}" ] }, "aws:InstanceId": { "Values": [ "i-02573cafcfEXAMPLE", "i-0471e04240EXAMPLE", "i-07782c72faEXAMPLE" ] } } ], "Priority": 1, "MaxConcurrency": "1", "MaxErrors": "3", "Status": "SUCCESS", "StartTime": "2021-08-04T11:45:35.088000-07:00", "EndTime": "2021-08-04T11:53:09.079000-07:00" }

Untuk informasi selengkapnya, lihat Melihat informasi tentang tugas dan eksekusi tugas (AWS CLI) di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanget-maintenance-window-execution.

AWS CLI

Untuk mendapatkan informasi tentang eksekusi tugas jendela pemeliharaan

get-maintenance-window-executionContoh berikut mencantumkan informasi tentang tugas yang dijalankan sebagai bagian dari eksekusi jendela pemeliharaan yang ditentukan.

aws ssm get-maintenance-window-execution \ --window-execution-id "518d5565-5969-4cca-8f0e-da3b2EXAMPLE"

Output:

{ "Status": "SUCCESS", "TaskIds": [ "ac0c6ae1-daa3-4a89-832e-d3845EXAMPLE" ], "StartTime": 1487692834.595, "EndTime": 1487692835.051, "WindowExecutionId": "518d5565-5969-4cca-8f0e-da3b2EXAMPLE", }

Untuk informasi selengkapnya, lihat Melihat Informasi Tentang Tugas dan Eksekusi Tugas (AWS CLI) di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanget-maintenance-window-task.

AWS CLI

Untuk mendapatkan informasi tentang tugas jendela pemeliharaan

get-maintenance-window-taskContoh berikut mengambil detail tentang tugas jendela pemeliharaan yang ditentukan.

aws ssm get-maintenance-window-task \ --window-id mw-0c5ed765acEXAMPLE \ --window-task-id 0e842a8d-2d44-4886-bb62-af8dcEXAMPLE

Output:

{ "ServiceRoleArn": "arn:aws:iam::111222333444:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM", "MaxErrors": "1", "TaskArn": "AWS-RunPowerShellScript", "MaxConcurrency": "1", "WindowTaskId": "0e842a8d-2d44-4886-bb62-af8dcEXAMPLE", "TaskParameters": {}, "Priority": 1, "TaskInvocationParameters": { "RunCommand": { "Comment": "", "TimeoutSeconds": 600, "Parameters": { "commands": [ "echo Hello" ], "executionTimeout": [ "3600" ], "workingDirectory": [ "" ] } } }, "WindowId": "mw-0c5ed765acEXAMPLE", "TaskType": "RUN_COMMAND", "Targets": [ { "Values": [ "84c818da-b619-4d3d-9651-946f3EXAMPLE" ], "Key": "WindowTargetIds" } ], "Name": "ExampleTask" }

Untuk informasi selengkapnya, lihat Melihat Informasi Tentang Pemeliharaan Windows (AWS CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanget-maintenance-window.

AWS CLI

Untuk mendapatkan informasi tentang jendela pemeliharaan

get-maintenance-windowContoh berikut mengambil detail tentang jendela pemeliharaan yang ditentukan.

aws ssm get-maintenance-window \ --window-id "mw-03eb9db428EXAMPLE"

Output:

{ "AllowUnassociatedTargets": true, "CreatedDate": 1515006912.957, "Cutoff": 1, "Duration": 6, "Enabled": true, "ModifiedDate": 2020-01-01T10:04:04.099Z, "Name": "My-Maintenance-Window", "Schedule": "rate(3 days)", "WindowId": "mw-03eb9db428EXAMPLE", "NextExecutionTime": "2020-02-25T00:08:15.099Z" }

Untuk informasi selengkapnya, lihat Melihat informasi tentang jendela pemeliharaan (AWS CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanget-ops-item.

AWS CLI

Untuk melihat informasi tentang OpsItem

get-ops-itemContoh berikut menampilkan detail tentang yang ditentukan OpsItem.

aws ssm get-ops-item \ --ops-item-id oi-0b725EXAMPLE

Output:

{ "OpsItem": { "CreatedBy": "arn:aws:sts::111222333444:assumed-role/OpsItem-CWE-Role/fbf77cbe264a33509569f23e4EXAMPLE", "CreatedTime": "2019-12-04T15:52:16.793000-08:00", "Description": "CloudWatch Event Rule SSMOpsItems-EC2-instance-terminated was triggered. Your EC2 instance has terminated. See below for more details.", "LastModifiedBy": "arn:aws:sts::111222333444:assumed-role/OpsItem-CWE-Role/fbf77cbe264a33509569f23e4EXAMPLE", "LastModifiedTime": "2019-12-04T15:52:16.793000-08:00", "Notifications": [], "RelatedOpsItems": [], "Status": "Open", "OpsItemId": "oi-0b725EXAMPLE", "Title": "EC2 instance terminated", "Source": "EC2", "OperationalData": { "/aws/automations": { "Value": "[ { \"automationType\": \"AWS:SSM:Automation\", \"automationId\": \"AWS-CreateManagedWindowsInstance\" }, { \"automationType\": \"AWS:SSM:Automation\", \"automationId\": \"AWS-CreateManagedLinuxInstance\" } ]", "Type": "SearchableString" }, "/aws/dedup": { "Value": "{\"dedupString\":\"SSMOpsItems-EC2-instance-terminated\"}", "Type": "SearchableString" }, "/aws/resources": { "Value": "[{\"arn\":\"arn:aws:ec2:us-east-2:111222333444:instance/i-05adec7e97EXAMPLE\"}]", "Type": "SearchableString" }, "event-time": { "Value": "2019-12-04T23:52:16Z", "Type": "String" }, "instance-state": { "Value": "terminated", "Type": "String" } }, "Category": "Availability", "Severity": "4" } }

Untuk informasi selengkapnya, lihat Bek erja dengan OpsItems di Panduan Pengguna Manajer AWS Sistem.

  • Untuk detail API, lihat GetOpsItem di Refer AWS CLI ensi Perintah.

Contoh kode berikut menunjukkan cara menggunakanget-ops-summary.

AWS CLI

Untuk melihat ringkasan semua OpsItems

get-ops-summaryContoh berikut menampilkan ringkasan semua OpsItems di AWS akun Anda.

aws ssm get-ops-summary

Output:

{ "Entities": [ { "Id": "oi-4309fEXAMPLE", "Data": { "AWS:OpsItem": { "CaptureTime": "2020-02-26T18:58:32.918Z", "Content": [ { "AccountId": "111222333444", "Category": "Availability", "CreatedBy": "arn:aws:sts::111222333444:assumed-role/OpsItem-CWE-Role/fbf77cbe264a33509569f23e4EXAMPLE", "CreatedTime": "2020-02-26T19:10:44.149Z", "Description": "CloudWatch Event Rule SSMOpsItems-EC2-instance-terminated was triggered. Your EC2 instance has terminated. See below for more details.", "LastModifiedBy": "arn:aws:sts::111222333444:assumed-role/OpsItem-CWE-Role/fbf77cbe264a33509569f23e4EXAMPLE", "LastModifiedTime": "2020-02-26T19:10:44.149Z", "Notifications": "", "OperationalData": "{\"/aws/automations\":{\"type\":\"SearchableString\",\"value\":\"[ { \\\"automationType\\\": \\\"AWS:SSM:Automation\\\", \\\"automationId\\\": \\\"AWS-CreateManagedWindowsInstance\\\" }, { \\\"automationType\\\": \\\"AWS:SSM:Automation\\\", \\\"automationId\\\": \\\"AWS-CreateManagedLinuxInstance\\\" } ]\"},\"/aws/resources\":{\"type\":\"SearchableString\",\"value\":\"[{\\\"arn\\\":\\\"arn:aws:ec2:us-east-2:111222333444:instance/i-0acbd0800fEXAMPLE\\\"}]\"},\"/aws/dedup\":{\"type\":\"SearchableString\",\"value\":\"{\\\"dedupString\\\":\\\"SSMOpsItems-EC2-instance-terminated\\\"}\"}}", "OpsItemId": "oi-4309fEXAMPLE", "RelatedItems": "", "Severity": "3", "Source": "EC2", "Status": "Open", "Title": "EC2 instance terminated" } ] } } }, { "Id": "oi-bb2a0e6a4541", "Data": { "AWS:OpsItem": { "CaptureTime": "2019-11-26T19:20:06.161Z", "Content": [ { "AccountId": "111222333444", "Category": "Availability", "CreatedBy": "arn:aws:sts::111222333444:assumed-role/OpsItem-CWE-Role/fbf77cbe264a33509569f23e4EXAMPLE", "CreatedTime": "2019-11-26T20:00:07.237Z", "Description": "CloudWatch Event Rule SSMOpsItems-SSM-maintenance-window-execution-failed was triggered. Your SSM Maintenance Window execution has failed. See below for more details.", "LastModifiedBy": "arn:aws:sts::111222333444:assumed-role/OpsItem-CWE-Role/fbf77cbe264a33509569f23e4EXAMPLE", "LastModifiedTime": "2019-11-26T20:00:07.237Z", "Notifications": "", "OperationalData": "{\"/aws/resources\":{\"type\":\"SearchableString\",\"value\":\"[{\\\"arn\\\":\\\"arn:aws:ssm:us-east-2:111222333444:maintenancewindow/mw-0e83ba440dEXAMPLE\\\"}]\"},\"/aws/dedup\":{\"type\":\"SearchableString\",\"value\":\"{\\\"dedupString\\\":\\\"SSMOpsItems-SSM-maintenance-window-execution-failed\\\"}\"}}", "OpsItemId": "oi-bb2a0EXAMPLE", "RelatedItems": "", "Severity": "3", "Source": "SSM", "Status": "Open", "Title": "SSM Maintenance Window execution failed" } ] } } } ] }

Untuk informasi selengkapnya, lihat Bek erja dengan OpsItems di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanget-parameter-history.

AWS CLI

Untuk mendapatkan riwayat nilai untuk parameter

get-parameter-historyContoh berikut mencantumkan riwayat perubahan untuk parameter yang ditentukan, termasuk nilainya.

aws ssm get-parameter-history \ --name "MyStringParameter"

Output:

{ "Parameters": [ { "Name": "MyStringParameter", "Type": "String", "LastModifiedDate": 1582154711.976, "LastModifiedUser": "arn:aws:iam::111222333444:user/Mary-Major", "Description": "This is the first version of my String parameter", "Value": "Veni", "Version": 1, "Labels": [], "Tier": "Standard", "Policies": [] }, { "Name": "MyStringParameter", "Type": "String", "LastModifiedDate": 1582156093.471, "LastModifiedUser": "arn:aws:iam::111222333444:user/Mary-Major", "Description": "This is the second version of my String parameter", "Value": "Vidi", "Version": 2, "Labels": [], "Tier": "Standard", "Policies": [] }, { "Name": "MyStringParameter", "Type": "String", "LastModifiedDate": 1582156117.545, "LastModifiedUser": "arn:aws:iam::111222333444:user/Mary-Major", "Description": "This is the third version of my String parameter", "Value": "Vici", "Version": 3, "Labels": [], "Tier": "Standard", "Policies": [] } ] }

Untuk informasi selengkapnya, lihat Bek erja dengan versi parameter di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanget-parameter.

AWS CLI

Contoh 1: Untuk menampilkan nilai parameter

get-parameterContoh berikut mencantumkan nilai untuk parameter tunggal yang ditentukan.

aws ssm get-parameter \ --name "MyStringParameter"

Output:

{ "Parameter": { "Name": "MyStringParameter", "Type": "String", "Value": "Veni", "Version": 1, "LastModifiedDate": 1530018761.888, "ARN": "arn:aws:ssm:us-east-2:111222333444:parameter/MyStringParameter" "DataType": "text" } }

Untuk informasi selengkapnya, lihat Bekerja dengan Penyimpanan Parameter di Panduan Pengguna Manajer AWS Sistem.

Contoh 2: Untuk mendekripsi nilai SecureString parameter

get-parameterContoh berikut mendekripsi nilai SecureString parameter yang ditentukan.

aws ssm get-parameter \ --name "MySecureStringParameter" \ --with-decryption

Output:

{ "Parameter": { "Name": "MySecureStringParameter", "Type": "SecureString", "Value": "16679b88-310b-4895-a943-e0764EXAMPLE", "Version": 2, "LastModifiedDate": 1582155479.205, "ARN": "arn:aws:ssm:us-east-2:111222333444:parameter/MySecureStringParameter" "DataType": "text" } }

Untuk informasi selengkapnya, lihat Bekerja dengan Penyimpanan Parameter di Panduan Pengguna Manajer AWS Sistem.

Contoh 3: Untuk menampilkan nilai parameter menggunakan label

get-parameterContoh berikut mencantumkan nilai untuk parameter tunggal yang ditentukan dengan label tertentu.

aws ssm get-parameter \ --name "MyParameter:label"

Output:

{ "Parameter": { "Name": "MyParameter", "Type": "String", "Value": "parameter version 2", "Version": 2, "Selector": ":label", "LastModifiedDate": "2021-07-12T09:49:15.865000-07:00", "ARN": "arn:aws:ssm:us-west-2:786973925828:parameter/MyParameter", "DataType": "text" } }

Untuk informasi selengkapnya, lihat Bek erja dengan label parameter di Panduan Pengguna Manajer AWS Sistem.

Contoh 4: Untuk menampilkan nilai parameter menggunakan versi

get-parameterContoh berikut mencantumkan nilai untuk versi parameter tunggal yang ditentukan.

aws ssm get-parameter \ --name "MyParameter:2"

Output:

{ "Parameter": { "Name": "MyParameter", "Type": "String", "Value": "parameter version 2", "Version": 2, "Selector": ":2", "LastModifiedDate": "2021-07-12T09:49:15.865000-07:00", "ARN": "arn:aws:ssm:us-west-2:786973925828:parameter/MyParameter", "DataType": "text" } }

Untuk informasi selengkapnya, lihat Bek erja dengan label parameter di Panduan Pengguna Manajer AWS Sistem.

  • Untuk detail API, lihat GetParameter di Refer AWS CLI ensi Perintah.

Contoh kode berikut menunjukkan cara menggunakanget-parameters-by-path.

AWS CLI

Untuk membuat daftar parameter di jalur tertentu

get-parameters-by-pathContoh berikut mencantumkan parameter dalam hierarki yang ditentukan.

aws ssm get-parameters-by-path \ --path "/site/newyork/department/"

Output:

{ "Parameters": [ { "Name": "/site/newyork/department/marketing", "Type": "String", "Value": "Floor 2", "Version": 1, "LastModifiedDate": 1530018761.888, "ARN": "arn:aws:ssm:us-east-1:111222333444:parameter/site/newyork/department/marketing" }, { "Name": "/site/newyork/department/infotech", "Type": "String", "Value": "Floor 3", "Version": 1, "LastModifiedDate": 1530018823.429, "ARN": "arn:aws:ssm:us-east-1:111222333444:parameter/site/newyork/department/infotech" }, ... ] }

Untuk informasi selengkapnya, lihat Bekerja dengan hierarki parameter di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanget-parameters.

AWS CLI

Contoh 1: Untuk membuat daftar nilai untuk parameter

get-parametersContoh berikut mencantumkan nilai untuk tiga parameter yang ditentukan.

aws ssm get-parameters \ --names "MyStringParameter" "MyStringListParameter" "MyInvalidParameterName"

Output:

{ "Parameters": [ { "Name": "MyStringListParameter", "Type": "StringList", "Value": "alpha,beta,gamma", "Version": 1, "LastModifiedDate": 1582154764.222, "ARN": "arn:aws:ssm:us-east-2:111222333444:parameter/MyStringListParameter" "DataType": "text" }, { "Name": "MyStringParameter", "Type": "String", "Value": "Vici", "Version": 3, "LastModifiedDate": 1582156117.545, "ARN": "arn:aws:ssm:us-east-2:111222333444:parameter/MyStringParameter" "DataType": "text" } ], "InvalidParameters": [ "MyInvalidParameterName" ] }

Untuk informasi selengkapnya, lihat Bekerja dengan Penyimpanan Parameter di Panduan Pengguna Manajer AWS Sistem.

Contoh 2: Untuk membuat daftar nama dan nilai beberapa parameter menggunakan opsi ``--query``

get-parametersContoh berikut mencantumkan nama dan nilai untuk parameter yang ditentukan.

aws ssm get-parameters \ --names MyStringParameter MyStringListParameter \ --query "Parameters[*].{Name:Name,Value:Value}"

Output:

[ { "Name": "MyStringListParameter", "Value": "alpha,beta,gamma" }, { "Name": "MyStringParameter", "Value": "Vidi" } ]

Untuk informasi selengkapnya, lihat Bekerja dengan Penyimpanan Parameter di Panduan Pengguna Manajer AWS Sistem.

Contoh 3: Untuk menampilkan nilai parameter menggunakan label

get-parameterContoh berikut mencantumkan nilai untuk parameter tunggal yang ditentukan dengan label tertentu.

aws ssm get-parameter \ --name "MyParameter:label"

Output:

{ "Parameters": [ { "Name": "MyLabelParameter", "Type": "String", "Value": "parameter by label", "Version": 1, "Selector": ":label", "LastModifiedDate": "2021-07-12T09:49:15.865000-07:00", "ARN": "arn:aws:ssm:us-west-2:786973925828:parameter/MyParameter", "DataType": "text" }, { "Name": "MyVersionParameter", "Type": "String", "Value": "parameter by version", "Version": 2, "Selector": ":2", "LastModifiedDate": "2021-03-24T16:20:28.236000-07:00", "ARN": "arn:aws:ssm:us-west-2:786973925828:parameter/unlabel-param", "DataType": "text" } ], "InvalidParameters": [] }

Untuk informasi selengkapnya, lihat Bek erja dengan label parameter di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanget-patch-baseline-for-patch-group.

AWS CLI

Untuk menampilkan baseline patch untuk grup patch

get-patch-baseline-for-patch-groupContoh berikut mengambil detail tentang baseline patch untuk grup patch yang ditentukan.

aws ssm get-patch-baseline-for-patch-group \ --patch-group "DEV"

Output:

{ "PatchGroup": "DEV", "BaselineId": "pb-0123456789abcdef0", "OperatingSystem": "WINDOWS" }

Untuk informasi selengkapnya, lihat Membuat Grup Patch < https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-patch-group-tagging.html >__ dan Menambahkan Grup Patch ke Dasar Patch di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanget-patch-baseline.

AWS CLI

Untuk menampilkan garis dasar patch

get-patch-baselineContoh berikut mengambil detail untuk baseline patch yang ditentukan.

aws ssm get-patch-baseline \ --baseline-id "pb-0123456789abcdef0"

Output:

{ "BaselineId": "pb-0123456789abcdef0", "Name": "WindowsPatching", "OperatingSystem": "WINDOWS", "GlobalFilters": { "PatchFilters": [] }, "ApprovalRules": { "PatchRules": [ { "PatchFilterGroup": { "PatchFilters": [ { "Key": "PRODUCT", "Values": [ "WindowsServer2016" ] } ] }, "ComplianceLevel": "CRITICAL", "ApproveAfterDays": 0, "EnableNonSecurity": false } ] }, "ApprovedPatches": [], "ApprovedPatchesComplianceLevel": "UNSPECIFIED", "ApprovedPatchesEnableNonSecurity": false, "RejectedPatches": [], "RejectedPatchesAction": "ALLOW_AS_DEPENDENCY", "PatchGroups": [ "QA", "DEV" ], "CreatedDate": 1550244180.465, "ModifiedDate": 1550244180.465, "Description": "Patches for Windows Servers", "Sources": [] }

Untuk informasi selengkapnya, lihat Tentang Garis Dasar Patch di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanget-service-setting.

AWS CLI

Untuk mengambil pengaturan layanan untuk throughput Penyimpanan Parameter

Berikut contoh get-service-setting ini mengambil pengaturan layanan saat ini untuk throughput Penyimpanan Parameter di wilayah yang ditentukan.

aws ssm get-service-setting \ --setting-id arn:aws:ssm:us-east-1:123456789012:servicesetting/ssm/parameter-store/high-throughput-enabled

Output:

{ "ServiceSetting": { "SettingId": "/ssm/parameter-store/high-throughput-enabled", "SettingValue": "false", "LastModifiedDate": 1555532818.578, "LastModifiedUser": "System", "ARN": "arn:aws:ssm:us-east-1:123456789012:servicesetting/ssm/parameter-store/high-throughput-enabled", "Status": "Default" } }

Untuk informasi selengkapnya, lihat Meningkatkan Throughput Peny impanan Parameter di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanlabel-parameter-version.

AWS CLI

Contoh 1: Untuk menambahkan label ke versi terbaru dari parameter

label-parameter-versionContoh berikut menambahkan label ke versi terbaru dari parameter yang ditentukan.

aws ssm label-parameter-version \ --name "MyStringParameter" \ --labels "ProductionReady"

Output:

{ "InvalidLabels": [], "ParameterVersion": 3 }

Untuk informasi selengkapnya, lihat Bek erja dengan label parameter di Panduan Pengguna Manajer AWS Sistem.

Contoh 2: Untuk menambahkan label ke versi parameter tertentu

label-parameter-versionContoh berikut menambahkan label ke versi parameter yang ditentukan.

aws ssm label-parameter-version \ --name "MyStringParameter" \ --labels "ProductionReady" \ --parameter-version "2" --labels "DevelopmentReady"

Untuk informasi selengkapnya, lihat Bek erja dengan label parameter di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanlist-association-versions.

AWS CLI

Untuk mencantumkan semua versi asosiasi untuk ID asosiasi tertentu

list-association-versionsContoh berikut mencantumkan semua versi asosiasi yang ditentukan.

aws ssm list-association-versions \ --association-id "8dfe3659-4309-493a-8755-0123456789ab"

Output:

{ "AssociationVersions": [ { "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "AssociationVersion": "1", "CreatedDate": 1550505536.726, "Name": "AWS-UpdateSSMAgent", "Parameters": { "allowDowngrade": [ "false" ], "version": [ "" ] }, "Targets": [ { "Key": "InstanceIds", "Values": [ "i-1234567890abcdef0" ] } ], "ScheduleExpression": "cron(0 00 12 ? * SUN *)", "AssociationName": "UpdateSSMAgent" } ] }

Untuk informasi selengkapnya, lihat Bekerja dengan asosiasi di Manajer Sistem di AWS Panduan Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanlist-associations.

AWS CLI

Contoh 1: Untuk membuat daftar asosiasi Anda untuk contoh tertentu

Contoh asosiasi daftar berikut mencantumkan semua asosiasi dengan AssociationName, UpdatesMagent.

aws ssm list-associations / --association-filter-list "key=AssociationName,value=UpdateSSMAgent"

Output:

{ "Associations": [ { "Name": "AWS-UpdateSSMAgent", "InstanceId": "i-1234567890abcdef0", "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "AssociationVersion": "1", "Targets": [ { "Key": "InstanceIds", "Values": [ "i-016648b75dd622dab" ] } ], "Overview": { "Status": "Pending", "DetailedStatus": "Associated", "AssociationStatusAggregatedCount": { "Pending": 1 } }, "ScheduleExpression": "cron(0 00 12 ? * SUN *)", "AssociationName": "UpdateSSMAgent" } ] }

Untuk informasi selengkapnya, lihat Bekerja dengan asosiasi di Manajer Sistem di Panduan Pengguna Manajer Sistem.

Contoh 2: Untuk membuat daftar asosiasi Anda untuk dokumen tertentu

Contoh asosiasi daftar berikut mencantumkan semua asosiasi untuk dokumen yang ditentukan.

aws ssm list-associations / --association-filter-list "key=Name,value=AWS-UpdateSSMAgent"

Output:

{ "Associations": [ { "Name": "AWS-UpdateSSMAgent", "InstanceId": "i-1234567890abcdef0", "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "AssociationVersion": "1", "Targets": [ { "Key": "InstanceIds", "Values": [ "i-1234567890abcdef0" ] } ], "LastExecutionDate": 1550505828.548, "Overview": { "Status": "Success", "DetailedStatus": "Success", "AssociationStatusAggregatedCount": { "Success": 1 } }, "ScheduleExpression": "cron(0 00 12 ? * SUN *)", "AssociationName": "UpdateSSMAgent" }, { "Name": "AWS-UpdateSSMAgent", "InstanceId": "i-9876543210abcdef0", "AssociationId": "fbc07ef7-b985-4684-b82b-0123456789ab", "AssociationVersion": "1", "Targets": [ { "Key": "InstanceIds", "Values": [ "i-9876543210abcdef0" ] } ], "LastExecutionDate": 1550507531.0, "Overview": { "Status": "Success", "AssociationStatusAggregatedCount": { "Success": 1 } } } ] }

Untuk informasi selengkapnya, lihat Bekerja dengan asosiasi di Manajer Sistem di Panduan Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanlist-command-invocations.

AWS CLI

Untuk membuat daftar pemanggilan perintah tertentu

list-command-invocationsContoh berikut mencantumkan semua pemanggilan perintah.

aws ssm list-command-invocations \ --command-id "ef7fdfd8-9b57-4151-a15c-db9a12345678" \ --details

Output:

{ "CommandInvocations": [ { "CommandId": "ef7fdfd8-9b57-4151-a15c-db9a12345678", "InstanceId": "i-02573cafcfEXAMPLE", "InstanceName": "", "Comment": "b48291dd-ba76-43e0-b9df-13e11ddaac26:6960febb-2907-4b59-8e1a-d6ce8EXAMPLE", "DocumentName": "AWS-UpdateSSMAgent", "DocumentVersion": "", "RequestedDateTime": 1582136283.089, "Status": "Success", "StatusDetails": "Success", "StandardOutputUrl": "", "StandardErrorUrl": "", "CommandPlugins": [ { "Name": "aws:updateSsmAgent", "Status": "Success", "StatusDetails": "Success", "ResponseCode": 0, "ResponseStartDateTime": 1582136283.419, "ResponseFinishDateTime": 1582136283.51, "Output": "Updating amazon-ssm-agent from 2.3.842.0 to latest\nSuccessfully downloaded https://s3.us-east-2.amazonaws.com/amazon-ssm-us-east-2/ssm-agent-manifest.json\namazon-ssm-agent 2.3.842.0 has already been installed, update skipped\n", "StandardOutputUrl": "", "StandardErrorUrl": "", "OutputS3Region": "us-east-2", "OutputS3BucketName": "", "OutputS3KeyPrefix": "" } ], "ServiceRole": "", "NotificationConfig": { "NotificationArn": "", "NotificationEvents": [], "NotificationType": "" }, "CloudWatchOutputConfig": { "CloudWatchLogGroupName": "", "CloudWatchOutputEnabled": false } }, { "CommandId": "ef7fdfd8-9b57-4151-a15c-db9a12345678", "InstanceId": "i-0471e04240EXAMPLE", "InstanceName": "", "Comment": "b48291dd-ba76-43e0-b9df-13e11ddaac26:6960febb-2907-4b59-8e1a-d6ce8EXAMPLE", "DocumentName": "AWS-UpdateSSMAgent", "DocumentVersion": "", "RequestedDateTime": 1582136283.02, "Status": "Success", "StatusDetails": "Success", "StandardOutputUrl": "", "StandardErrorUrl": "", "CommandPlugins": [ { "Name": "aws:updateSsmAgent", "Status": "Success", "StatusDetails": "Success", "ResponseCode": 0, "ResponseStartDateTime": 1582136283.812, "ResponseFinishDateTime": 1582136295.031, "Output": "Updating amazon-ssm-agent from 2.3.672.0 to latest\nSuccessfully downloaded https://s3.us-east-2.amazonaws.com/amazon-ssm-us-east-2/ssm-agent-manifest.json\nSuccessfully downloaded https://s3.us-east-2.amazonaws.com/amazon-ssm-us-east-2/amazon-ssm-agent-updater/2.3.842.0/amazon-ssm-agent-updater-snap-amd64.tar.gz\nSuccessfully downloaded https://s3.us-east-2.amazonaws.com/amazon-ssm-us-east-2/amazon-ssm-agent/2.3.672.0/amazon-ssm-agent-snap-amd64.tar.gz\nSuccessfully downloaded https://s3.us-east-2.amazonaws.com/amazon-ssm-us-east-2/amazon-ssm-agent/2.3.842.0/amazon-ssm-agent-snap-amd64.tar.gz\nInitiating amazon-ssm-agent update to 2.3.842.0\namazon-ssm-agent updated successfully to 2.3.842.0", "StandardOutputUrl": "", "StandardErrorUrl": "", "OutputS3Region": "us-east-2", "OutputS3BucketName": "", "OutputS3KeyPrefix": "8bee3135-398c-4d31-99b6-e42d2EXAMPLE/i-0471e04240EXAMPLE/awsupdateSsmAgent" } ], "ServiceRole": "", "NotificationConfig": { "NotificationArn": "", "NotificationEvents": [], "NotificationType": "" }, "CloudWatchOutputConfig": { "CloudWatchLogGroupName": "", "CloudWatchOutputEnabled": false } } ] }

Untuk informasi selengkapnya, lihat Memahami Status Perintah di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanlist-commands.

AWS CLI

Contoh 1: Untuk mendapatkan status perintah tertentu

list-commandsContoh berikut mengambil dan menampilkan status perintah yang ditentukan.

aws ssm list-commands \ --command-id "0831e1a8-a1ac-4257-a1fd-c831bEXAMPLE"

Contoh 2: Untuk mendapatkan status perintah yang diminta setelah tanggal tertentu

list-commandsContoh berikut mengambil rincian perintah yang diminta setelah tanggal yang ditentukan.

aws ssm list-commands \ --filter "key=InvokedAfter,value=2020-02-01T00:00:00Z"

Contoh 3: Untuk membuat daftar semua perintah yang diminta dalam AWS akun

list-commandsContoh berikut mencantumkan semua perintah yang diminta oleh pengguna di AWS akun saat ini dan Wilayah.

aws ssm list-commands

Output:

{ "Commands": [ { "CommandId": "8bee3135-398c-4d31-99b6-e42d2EXAMPLE", "DocumentName": "AWS-UpdateSSMAgent", "DocumentVersion": "", "Comment": "b48291dd-ba76-43e0-b9df-13e11ddaac26:6960febb-2907-4b59-8e1a-d6ce8EXAMPLE", "ExpiresAfter": "2020-02-19T11:28:02.500000-08:00", "Parameters": {}, "InstanceIds": [ "i-028ea792daEXAMPLE", "i-02feef8c46EXAMPLE", "i-038613f3f0EXAMPLE", "i-03a530a2d4EXAMPLE", "i-083b678d37EXAMPLE", "i-0dee81debaEXAMPLE" ], "Targets": [], "RequestedDateTime": "2020-02-19T10:18:02.500000-08:00", "Status": "Success", "StatusDetails": "Success", "OutputS3BucketName": "", "OutputS3KeyPrefix": "", "MaxConcurrency": "50", "MaxErrors": "100%", "TargetCount": 6, "CompletedCount": 6, "ErrorCount": 0, "DeliveryTimedOutCount": 0, "ServiceRole": "", "NotificationConfig": { "NotificationArn": "", "NotificationEvents": [], "NotificationType": "" }, "CloudWatchOutputConfig": { "CloudWatchLogGroupName": "", "CloudWatchOutputEnabled": false } } { "CommandId": "e9ade581-c03d-476b-9b07-26667EXAMPLE", "DocumentName": "AWS-FindWindowsUpdates", "DocumentVersion": "1", "Comment": "", "ExpiresAfter": "2020-01-24T12:37:31.874000-08:00", "Parameters": { "KbArticleIds": [ "" ], "UpdateLevel": [ "All" ] }, "InstanceIds": [], "Targets": [ { "Key": "InstanceIds", "Values": [ "i-00ec29b21eEXAMPLE", "i-09911ddd90EXAMPLE" ] } ], "RequestedDateTime": "2020-01-24T11:27:31.874000-08:00", "Status": "Success", "StatusDetails": "Success", "OutputS3BucketName": "my-us-east-2-bucket", "OutputS3KeyPrefix": "my-rc-output", "MaxConcurrency": "50", "MaxErrors": "0", "TargetCount": 2, "CompletedCount": 2, "ErrorCount": 0, "DeliveryTimedOutCount": 0, "ServiceRole": "arn:aws:iam::111222333444:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM", "NotificationConfig": { "NotificationArn": "arn:aws:sns:us-east-2:111222333444:my-us-east-2-notification-arn", "NotificationEvents": [ "All" ], "NotificationType": "Invocation" }, "CloudWatchOutputConfig": { "CloudWatchLogGroupName": "", "CloudWatchOutputEnabled": false } } { "CommandId": "d539b6c3-70e8-4853-80e5-0ce4fEXAMPLE", "DocumentName": "AWS-RunPatchBaseline", "DocumentVersion": "1", "Comment": "", "ExpiresAfter": "2020-01-24T12:21:04.350000-08:00", "Parameters": { "InstallOverrideList": [ "" ], "Operation": [ "Install" ], "RebootOption": [ "RebootIfNeeded" ], "SnapshotId": [ "" ] }, "InstanceIds": [], "Targets": [ { "Key": "InstanceIds", "Values": [ "i-00ec29b21eEXAMPLE", "i-09911ddd90EXAMPLE" ] } ], "RequestedDateTime": "2020-01-24T11:11:04.350000-08:00", "Status": "Success", "StatusDetails": "Success", "OutputS3BucketName": "my-us-east-2-bucket", "OutputS3KeyPrefix": "my-rc-output", "MaxConcurrency": "50", "MaxErrors": "0", "TargetCount": 2, "CompletedCount": 2, "ErrorCount": 0, "DeliveryTimedOutCount": 0, "ServiceRole": "arn:aws:iam::111222333444:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM", "NotificationConfig": { "NotificationArn": "arn:aws:sns:us-east-2:111222333444:my-us-east-2-notification-arn", "NotificationEvents": [ "All" ], "NotificationType": "Invocation" }, "CloudWatchOutputConfig": { "CloudWatchLogGroupName": "", "CloudWatchOutputEnabled": false } } ] }

Untuk informasi selengkapnya, lihat Menjalankan Perintah Menggunakan Perintah Jalankan Manajer AWS Sistem di Panduan Pengguna Manajer Sistem.

  • Untuk detail API, lihat ListCommands di Refer AWS CLI ensi Perintah.

Contoh kode berikut menunjukkan cara menggunakanlist-compliance-items.

AWS CLI

Untuk membuat daftar item kepatuhan untuk contoh tertentu

Contoh ini mencantumkan semua item kepatuhan untuk instance yang ditentukan.

Perintah:

aws ssm list-compliance-items --resource-ids "i-1234567890abcdef0" --resource-types "ManagedInstance"

Output:

{ "ComplianceItems": [ { "ComplianceType": "Association", "ResourceType": "ManagedInstance", "ResourceId": "i-1234567890abcdef0", "Id": "8dfe3659-4309-493a-8755-0123456789ab", "Title": "", "Status": "COMPLIANT", "Severity": "UNSPECIFIED", "ExecutionSummary": { "ExecutionTime": 1550408470.0 }, "Details": { "DocumentName": "AWS-GatherSoftwareInventory", "DocumentVersion": "1" } }, { "ComplianceType": "Association", "ResourceType": "ManagedInstance", "ResourceId": "i-1234567890abcdef0", "Id": "e4c2ed6d-516f-41aa-aa2a-0123456789ab", "Title": "", "Status": "COMPLIANT", "Severity": "UNSPECIFIED", "ExecutionSummary": { "ExecutionTime": 1550508475.0 }, "Details": { "DocumentName": "AWS-UpdateSSMAgent", "DocumentVersion": "1" } }, ... ], "NextToken": "--token string truncated--" }

Untuk membuat daftar item kepatuhan untuk instance tertentu dan ID asosiasi

Contoh ini mencantumkan semua item kepatuhan untuk instance dan ID asosiasi yang ditentukan.

Perintah:

aws ssm list-compliance-items --resource-ids "i-1234567890abcdef0" --resource-types "ManagedInstance" --filters "Key=ComplianceType,Values=Association,Type=EQUAL" "Key=Id,Values=e4c2ed6d-516f-41aa-aa2a-0123456789ab,Type=EQUAL"

Untuk membuat daftar item kepatuhan untuk instance setelah tanggal dan waktu tertentu

Contoh ini mencantumkan semua item kepatuhan untuk instance setelah tanggal dan waktu yang ditentukan.

Perintah:

aws ssm list-compliance-items --resource-ids "i-1234567890abcdef0" --resource-types "ManagedInstance" --filters "Key=ExecutionTime,Values=2019-02-18T16:00:00Z,Type=GREATER_THAN"

Contoh kode berikut menunjukkan cara menggunakanlist-compliance-summaries.

AWS CLI

Untuk membuat daftar ringkasan kepatuhan untuk semua jenis kepatuhan

Contoh ini mencantumkan ringkasan kepatuhan untuk semua jenis kepatuhan di akun Anda.

Perintah:

aws ssm list-compliance-summaries

Output:

{ "ComplianceSummaryItems": [ { "ComplianceType": "Association", "CompliantSummary": { "CompliantCount": 2, "SeveritySummary": { "CriticalCount": 0, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 2 } }, "NonCompliantSummary": { "NonCompliantCount": 0, "SeveritySummary": { "CriticalCount": 0, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 0 } } }, { "ComplianceType": "Patch", "CompliantSummary": { "CompliantCount": 1, "SeveritySummary": { "CriticalCount": 0, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 1 } }, "NonCompliantSummary": { "NonCompliantCount": 1, "SeveritySummary": { "CriticalCount": 1, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 0 } } }, ... ], "NextToken": "eyJOZXh0VG9rZW4iOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAyfQ==" }

Untuk membuat daftar ringkasan kepatuhan untuk jenis kepatuhan tertentu

Contoh ini mencantumkan ringkasan kepatuhan untuk jenis kepatuhan Patch.

Perintah:

aws ssm list-compliance-summaries --filters "Key=ComplianceType,Values=Patch,Type=EQUAL"

Contoh kode berikut menunjukkan cara menggunakanlist-document-metadata-history.

AWS CLI

Contoh: Untuk melihat riwayat persetujuan dan status untuk template perubahan

list-document-metadata-historyContoh berikut mengembalikan riwayat persetujuan untuk template perubahan Manajer Perubahan yang ditentukan.

aws ssm list-document-metadata-history \ --name MyChangeManageTemplate \ --metadata DocumentReviews

Output:

{ "Name": "MyChangeManagerTemplate", "DocumentVersion": "1", "Author": "arn:aws:iam::111222333444;:user/JohnDoe", "Metadata": { "ReviewerResponse": [ { "CreateTime": "2021-07-30T11:58:28.025000-07:00", "UpdatedTime": "2021-07-30T12:01:19.274000-07:00", "ReviewStatus": "APPROVED", "Comment": [ { "Type": "COMMENT", "Content": "I approve this template version" } ], "Reviewer": "arn:aws:iam::111222333444;:user/ShirleyRodriguez" }, { "CreateTime": "2021-07-30T11:58:28.025000-07:00", "UpdatedTime": "2021-07-30T11:58:28.025000-07:00", "ReviewStatus": "PENDING" } ] } }

Untuk informasi selengkapnya, lihat Meninjau dan menyetujui atau menolak templat perubahan di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanlist-document-versions.

AWS CLI

Untuk mencantumkan versi dokumen

list-document-versionsContoh berikut mencantumkan semua versi untuk dokumen Manajer Sistem.

aws ssm list-document-versions \ --name "Example"

Output:

{ "DocumentVersions": [ { "Name": "Example", "DocumentVersion": "1", "CreatedDate": 1583257938.266, "IsDefaultVersion": true, "DocumentFormat": "YAML", "Status": "Active" } ] }

Untuk informasi selengkapnya, lihat Mengirim Perintah yang Menggunakan Parameter Versi Dokumen di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanlist-documents.

AWS CLI

Contoh 1: Untuk membuat daftar dokumen

list-documentsContoh berikut mencantumkan dokumen yang dimiliki oleh akun yang meminta yang ditandai dengan tag kustom.

aws ssm list-documents \ --filters Key=Owner,Values=Self Key=tag:DocUse,Values=Testing

Output:

{ "DocumentIdentifiers": [ { "Name": "Example", "Owner": "29884EXAMPLE", "PlatformTypes": [ "Windows", "Linux" ], "DocumentVersion": "1", "DocumentType": "Automation", "SchemaVersion": "0.3", "DocumentFormat": "YAML", "Tags": [ { "Key": "DocUse", "Value": "Testing" } ] } ] }

Untuk informasi selengkapnya, lihat AWS Dokumen Manajer AWS Sistem di Panduan Pengguna Manajer Sistem.

Contoh 2: Untuk membuat daftar dokumen bersama

list-documentsContoh berikut mencantumkan dokumen bersama, termasuk dokumen bersama pribadi yang tidak dimiliki oleh AWS.

aws ssm list-documents \ --filters Key=Name,Values=sharedDocNamePrefix Key=Owner,Values=Private

Output:

{ "DocumentIdentifiers": [ { "Name": "Example", "Owner": "12345EXAMPLE", "PlatformTypes": [ "Windows", "Linux" ], "DocumentVersion": "1", "DocumentType": "Command", "SchemaVersion": "0.3", "DocumentFormat": "YAML", "Tags": [] } ] }

Untuk informasi selengkapnya, lihat AWS Dokumen Manajer AWS Sistem di Panduan Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanlist-inventory-entries.

AWS CLI

Contoh 1: Untuk melihat entri jenis inventaris tertentu untuk sebuah instance

list-inventory-entriesContoh berikut ini mencantumkan entri inventaris untuk tipe AWS inventaris aplikasi pada instance tertentu.

aws ssm list-inventory-entries \ --instance-id "i-1234567890abcdef0" \ --type-name "AWS:Application"

Output:

{ "TypeName": "AWS:Application", "InstanceId": "i-1234567890abcdef0", "SchemaVersion": "1.1", "CaptureTime": "2019-02-15T12:17:55Z", "Entries": [ { "Architecture": "i386", "Name": "Amazon SSM Agent", "PackageId": "{88a60be2-89a1-4df8-812a-80863c2a2b68}", "Publisher": "Amazon Web Services", "Version": "2.3.274.0" }, { "Architecture": "x86_64", "InstalledTime": "2018-05-03T13:42:34Z", "Name": "AmazonCloudWatchAgent", "Publisher": "", "Version": "1.200442.0" } ] }

Contoh 2: Untuk melihat entri inventaris kustom yang ditetapkan ke instance

list-inventory-entriesContoh berikut mencantumkan entri inventaris kustom yang ditetapkan ke instance.

aws ssm list-inventory-entries \ --instance-id "i-1234567890abcdef0" \ --type-name "Custom:RackInfo"

Output:

{ "TypeName": "Custom:RackInfo", "InstanceId": "i-1234567890abcdef0", "SchemaVersion": "1.0", "CaptureTime": "2021-05-22T10:01:01Z", "Entries": [ { "RackLocation": "Bay B/Row C/Rack D/Shelf E" } ] }

Contoh kode berikut menunjukkan cara menggunakanlist-ops-item-related-items.

AWS CLI

Untuk membuat daftar sumber daya item terkait dari OpsItem

list-ops-item-related-itemsContoh berikut mencantumkan sumber daya item terkait dari sebuah. OpsItem

aws ssm list-ops-item-related-items \ --ops-item-id "oi-f99f2EXAMPLE"

Output:

{ "Summaries": [ { "OpsItemId": "oi-f99f2EXAMPLE", "AssociationId": "e2036148-cccb-490e-ac2a-390e5EXAMPLE", "ResourceType": "AWS::SSMIncidents::IncidentRecord", "AssociationType": "IsParentOf", "ResourceUri": "arn:aws:ssm-incidents::111122223333:incident-record/example-response/64bd9b45-1d0e-2622-840d-03a87a1451fa", "CreatedBy": { "Arn": "arn:aws:sts::111122223333:assumed-role/AWSServiceRoleForIncidentManager/IncidentResponse" }, "CreatedTime": "2021-08-11T18:47:14.994000+00:00", "LastModifiedBy": { "Arn": "arn:aws:sts::111122223333:assumed-role/AWSServiceRoleForIncidentManager/IncidentResponse" }, "LastModifiedTime": "2021-08-11T18:47:14.994000+00:00" } ] }

Untuk informasi selengkapnya, lihat Bekerja dengan insiden Manajer Insiden OpsCenter di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanlist-resource-compliance-summaries.

AWS CLI

Untuk mencantumkan jumlah ringkasan kepatuhan tingkat sumber daya

Contoh ini mencantumkan jumlah ringkasan kepatuhan tingkat sumber daya.

Perintah:

aws ssm list-resource-compliance-summaries

Output:

{ "ResourceComplianceSummaryItems": [ { "ComplianceType": "Association", "ResourceType": "ManagedInstance", "ResourceId": "i-1234567890abcdef0", "Status": "COMPLIANT", "OverallSeverity": "UNSPECIFIED", "ExecutionSummary": { "ExecutionTime": 1550509273.0 }, "CompliantSummary": { "CompliantCount": 2, "SeveritySummary": { "CriticalCount": 0, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 2 } }, "NonCompliantSummary": { "NonCompliantCount": 0, "SeveritySummary": { "CriticalCount": 0, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 0 } } }, { "ComplianceType": "Patch", "ResourceType": "ManagedInstance", "ResourceId": "i-9876543210abcdef0", "Status": "COMPLIANT", "OverallSeverity": "UNSPECIFIED", "ExecutionSummary": { "ExecutionTime": 1550248550.0, "ExecutionId": "7abb6378-a4a5-4f10-8312-0123456789ab", "ExecutionType": "Command" }, "CompliantSummary": { "CompliantCount": 397, "SeveritySummary": { "CriticalCount": 0, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 397 } }, "NonCompliantSummary": { "NonCompliantCount": 0, "SeveritySummary": { "CriticalCount": 0, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 0 } } } ], "NextToken": "--token string truncated--" }

Untuk membuat daftar ringkasan kepatuhan tingkat sumber daya untuk jenis kepatuhan tertentu

Contoh ini mencantumkan ringkasan kepatuhan tingkat sumber daya untuk jenis kepatuhan Patch.

Perintah:

aws ssm list-resource-compliance-summaries --filters "Key=ComplianceType,Values=Patch,Type=EQUAL"

Contoh kode berikut menunjukkan cara menggunakanlist-resource-data-sync.

AWS CLI

Untuk membuat daftar konfigurasi sinkronisasi data sumber daya Anda

Contoh ini mengambil informasi tentang konfigurasi sinkronisasi data sumber daya Anda.

aws ssm list-resource-data-sync

Output:

{ "ResourceDataSyncItems": [ { "SyncName": "MyResourceDataSync", "S3Destination": { "BucketName": "ssm-resource-data-sync", "SyncFormat": "JsonSerDe", "Region": "us-east-1" }, "LastSyncTime": 1550261472.003, "LastSuccessfulSyncTime": 1550261472.003, "LastStatus": "Successful", "SyncCreatedTime": 1543235736.72, "LastSyncStatusMessage": "The sync was successfully completed" } ] }

Contoh kode berikut menunjukkan cara menggunakanlist-tags-for-resource.

AWS CLI

Untuk membuat daftar tag yang diterapkan pada baseline patch

list-tags-for-resourceContoh berikut mencantumkan tag untuk baseline patch.

aws ssm list-tags-for-resource \ --resource-type "PatchBaseline" \ --resource-id "pb-0123456789abcdef0"

Output:

{ "TagList": [ { "Key": "Environment", "Value": "Production" }, { "Key": "Region", "Value": "EMEA" } ] }

Untuk informasi selengkapnya, lihat Menandai Sumber AWS Daya di Refer ensi AWS Umum.

Contoh kode berikut menunjukkan cara menggunakanmodify-document-permission.

AWS CLI

Untuk mengubah izin dokumen

modify-document-permissionContoh berikut membagikan dokumen Manajer Sistem secara publik.

aws ssm modify-document-permission \ --name "Example" \ --permission-type "Share" \ --account-ids-to-add "All"

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Berbagi Dokumen Manajer AWS Sistem di Panduan Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanput-compliance-items.

AWS CLI

Untuk mendaftarkan jenis kepatuhan dan detail kepatuhan ke instans yang ditunjuk

Contoh ini mendaftarkan jenis kepatuhan Custom:AVCheck ke instance terkelola yang ditentukan. Tidak ada output jika perintah berhasil.

Perintah:

aws ssm put-compliance-items --resource-id "i-1234567890abcdef0" --resource-type "ManagedInstance" --compliance-type "Custom:AVCheck" --execution-summary "ExecutionTime=2019-02-18T16:00:00Z" --items "Id=Version2.0,Title=ScanHost,Severity=CRITICAL,Status=COMPLIANT"

Contoh kode berikut menunjukkan cara menggunakanput-inventory.

AWS CLI

Untuk menetapkan metadata pelanggan ke instans

Contoh ini menetapkan informasi lokasi rak ke instans. Tidak ada output jika perintah berhasil.

Perintah (Linux):

aws ssm put-inventory --instance-id "i-016648b75dd622dab" --items '[{"TypeName": "Custom:RackInfo","SchemaVersion": "1.0","CaptureTime": "2019-01-22T10:01:01Z","Content":[{"RackLocation": "Bay B/Row C/Rack D/Shelf E"}]}]'

Perintah (Windows):

aws ssm put-inventory --instance-id "i-016648b75dd622dab" --items "TypeName=Custom:RackInfo,SchemaVersion=1.0,CaptureTime=2019-01-22T10:01:01Z,Content=[{RackLocation='Bay B/Row C/Rack D/Shelf F'}]"
  • Untuk detail API, lihat PutInventory di Refer AWS CLI ensi Perintah.

Contoh kode berikut menunjukkan cara menggunakanput-parameter.

AWS CLI

Contoh 1: Untuk mengubah nilai parameter

put-parameterContoh berikut mengubah nilai parameter yang ditentukan.

aws ssm put-parameter \ --name "MyStringParameter" \ --type "String" \ --value "Vici" \ --overwrite

Output:

{ "Version": 2, "Tier": "Standard" }

Untuk informasi selengkapnya, lihat Membuat parameter Manajer Sistem (AWS CLI), M engelola tingkatan parameter, dan Bekerja dengan kebijakan parameter di Panduan AWS Pengguna Manajer Sistem.

Contoh 2: Untuk membuat parameter lanjutan

put-parameterContoh berikut membuat parameter lanjutan.

aws ssm put-parameter \ --name "MyAdvancedParameter" \ --description "This is an advanced parameter" \ --value "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat [truncated]" \ --type "String" \ --tier Advanced

Output:

{ "Version": 1, "Tier": "Advanced" }

Untuk informasi selengkapnya, lihat Membuat parameter Manajer Sistem (AWS CLI), M engelola tingkatan parameter, dan Bekerja dengan kebijakan parameter di Panduan AWS Pengguna Manajer Sistem.

Contoh 3: Untuk mengonversi parameter standar ke parameter lanjutan

put-parameterContoh berikut mengubah parameter standar yang ada menjadi parameter lanjutan.

aws ssm put-parameter \ --name "MyConvertedParameter" \ --value "abc123" \ --type "String" \ --tier Advanced \ --overwrite

Output:

{ "Version": 2, "Tier": "Advanced" }

Untuk informasi selengkapnya, lihat Membuat parameter Manajer Sistem (AWS CLI), M engelola tingkatan parameter, dan Bekerja dengan kebijakan parameter di Panduan AWS Pengguna Manajer Sistem.

Contoh 4: Untuk membuat parameter dengan kebijakan terlampir

put-parameterContoh berikut membuat parameter lanjutan dengan kebijakan parameter terlampir.

aws ssm put-parameter \ --name "/Finance/Payroll/q2accesskey" \ --value "P@sSwW)rd" \ --type "SecureString" \ --tier Advanced \ --policies "[{\"Type\":\"Expiration\",\"Version\":\"1.0\",\"Attributes\":{\"Timestamp\":\"2020-06-30T00:00:00.000Z\"}},{\"Type\":\"ExpirationNotification\",\"Version\":\"1.0\",\"Attributes\":{\"Before\":\"5\",\"Unit\":\"Days\"}},{\"Type\":\"NoChangeNotification\",\"Version\":\"1.0\",\"Attributes\":{\"After\":\"60\",\"Unit\":\"Days\"}}]"

Output:

{ "Version": 1, "Tier": "Advanced" }

Untuk informasi selengkapnya, lihat Membuat parameter Manajer Sistem (AWS CLI), M engelola tingkatan parameter, dan Bekerja dengan kebijakan parameter di Panduan AWS Pengguna Manajer Sistem.

Contoh 5: Untuk menambahkan kebijakan ke parameter yang ada

put-parameterContoh berikut melampirkan kebijakan ke parameter lanjutan yang ada.

aws ssm put-parameter \ --name "/Finance/Payroll/q2accesskey" \ --value "N3wP@sSwW)rd" \ --type "SecureString" \ --tier Advanced \ --policies "[{\"Type\":\"Expiration\",\"Version\":\"1.0\",\"Attributes\":{\"Timestamp\":\"2020-06-30T00:00:00.000Z\"}},{\"Type\":\"ExpirationNotification\",\"Version\":\"1.0\",\"Attributes\":{\"Before\":\"5\",\"Unit\":\"Days\"}},{\"Type\":\"NoChangeNotification\",\"Version\":\"1.0\",\"Attributes\":{\"After\":\"60\",\"Unit\":\"Days\"}}]" --overwrite

Output:

{ "Version": 2, "Tier": "Advanced" }

Untuk informasi selengkapnya, lihat Membuat parameter Manajer Sistem (AWS CLI), M engelola tingkatan parameter, dan Bekerja dengan kebijakan parameter di Panduan AWS Pengguna Manajer Sistem.

  • Untuk detail API, lihat PutParameter di Refer AWS CLI ensi Perintah.

Contoh kode berikut menunjukkan cara menggunakanregister-default-patch-baseline.

AWS CLI

Untuk mengatur baseline patch default

register-default-patch-baselineContoh berikut mendaftarkan baseline patch kustom yang ditentukan sebagai baseline patch default untuk jenis sistem operasi yang didukungnya.

aws ssm register-default-patch-baseline \ --baseline-id "pb-abc123cf9bEXAMPLE"

Output:

{ "BaselineId":"pb-abc123cf9bEXAMPLE" }

register-default-patch-baselineContoh berikut mendaftarkan baseline patch default yang disediakan oleh AWS untuk CentOS sebagai baseline patch default.

aws ssm register-default-patch-baseline \ --baseline-id "arn:aws:ssm:us-east-2:733109147000:patchbaseline/pb-0574b43a65ea646ed"

Output:

{ "BaselineId":"pb-abc123cf9bEXAMPLE" }

Untuk informasi selengkapnya, lihat Tentang Garis Dasar Patch Standar dan Kustom di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanregister-patch-baseline-for-patch-group.

AWS CLI

Untuk mendaftarkan baseline patch untuk grup patch

register-patch-baseline-for-patch-groupContoh berikut mendaftarkan baseline patch untuk grup patch.

aws ssm register-patch-baseline-for-patch-group \ --baseline-id "pb-045f10b4f382baeda" \ --patch-group "Production"

Output:

{ "BaselineId": "pb-045f10b4f382baeda", "PatchGroup": "Production" }

Untuk informasi selengkapnya, lihat Membuat Grup Patch < https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-patch-group-tagging.html >__ dan Menambahkan Grup Patch ke Dasar Patch di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanregister-target-with-maintenance-window.

AWS CLI

Contoh 1: Untuk mendaftarkan target tunggal dengan jendela pemeliharaan

register-target-with-maintenance-windowContoh berikut mendaftarkan instance dengan jendela pemeliharaan.

aws ssm register-target-with-maintenance-window \ --window-id "mw-ab12cd34ef56gh78" \ --target "Key=InstanceIds,Values=i-0000293ffd8c57862" \ --owner-information "Single instance" \ --resource-type "INSTANCE"

Output:

{ "WindowTargetId":"1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d-1a2" }

Contoh 2: Untuk mendaftarkan beberapa target dengan jendela pemeliharaan menggunakan ID instance

register-target-with-maintenance-windowContoh berikut mendaftarkan dua instance dengan jendela pemeliharaan dengan menentukan ID instansnya.

aws ssm register-target-with-maintenance-window \ --window-id "mw-ab12cd34ef56gh78" \ --target "Key=InstanceIds,Values=i-0000293ffd8c57862,i-0cb2b964d3e14fd9f" \ --owner-information "Two instances in a list" \ --resource-type "INSTANCE"

Output:

{ "WindowTargetId":"1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d-1a2" }

Contoh 3: Untuk mendaftarkan target dengan jendela pemeliharaan menggunakan tag sumber daya

register-target-with-maintenance-windowContoh berikut mendaftarkan instance dengan jendela pemeliharaan dengan menentukan tag sumber daya yang telah diterapkan ke instance.

aws ssm register-target-with-maintenance-window \ --window-id "mw-06cf17cbefcb4bf4f" \ --targets "Key=tag:Environment,Values=Prod" "Key=Role,Values=Web" \ --owner-information "Production Web Servers" \ --resource-type "INSTANCE"

Output:

{ "WindowTargetId":"1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d-1a2" }

Contoh 4: Untuk mendaftarkan target menggunakan sekelompok kunci tag

register-target-with-maintenance-windowContoh berikut mendaftarkan instance yang semuanya memiliki satu atau lebih kunci tag yang ditetapkan untuk mereka, terlepas dari nilai kuncinya.

aws ssm register-target-with-maintenance-window \ --window-id "mw-0c50858d01EXAMPLE" \ --resource-type "INSTANCE" \ --target "Key=tag-key,Values=Name,Instance-Type,CostCenter"

Output:

{ "WindowTargetId":"1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d-1a2" }

Contoh 5: Untuk mendaftarkan target menggunakan nama grup sumber daya

register-target-with-maintenance-windowContoh berikut mendaftarkan grup sumber daya tertentu, terlepas dari jenis sumber daya yang dikandungnya.

aws ssm register-target-with-maintenance-window \ --window-id "mw-0c50858d01EXAMPLE" \ --resource-type "RESOURCE_GROUP" \ --target "Key=resource-groups:Name,Values=MyResourceGroup"

Output:

{ "WindowTargetId":"1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d-1a2" }

Untuk informasi selengkapnya, lihat Mendaftarkan Instans Target dengan Jendela Pem AWS eliharaan (CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanregister-task-with-maintenance-window.

AWS CLI

Contoh 1: Untuk mendaftarkan tugas Otomasi dengan jendela pemeliharaan

register-task-with-maintenance-windowContoh berikut mendaftarkan tugas Otomasi dengan jendela pemeliharaan yang ditargetkan pada sebuah instance.

aws ssm register-task-with-maintenance-window \ --window-id "mw-082dcd7649EXAMPLE" \ --targets Key=InstanceIds,Values=i-1234520122EXAMPLE \ --task-arn AWS-RestartEC2Instance \ --service-role-arn arn:aws:iam::111222333444:role/SSM --task-type AUTOMATION \ --task-invocation-parameters "{\"Automation\":{\"DocumentVersion\":\"\$LATEST\",\"Parameters\":{\"InstanceId\":[\"{{RESOURCE_ID}}\"]}}}" \ --priority 0 \ --max-concurrency 1 \ --max-errors 1 \ --name "AutomationExample" \ --description "Restarting EC2 Instance for maintenance"

Output:

{ "WindowTaskId":"11144444-5555-6666-7777-88888888" }

Untuk informasi selengkapnya, lihat Mendaftarkan Tugas dengan Jendela Pem AWS eliharaan (CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh 2: Untuk mendaftarkan tugas Lambda dengan Jendela Pemeliharaan

register-task-with-maintenance-windowContoh berikut mendaftarkan tugas Lambda dengan Jendela Pemeliharaan yang ditargetkan pada sebuah instance.

aws ssm register-task-with-maintenance-window \ --window-id "mw-082dcd7649dee04e4" \ --targets Key=InstanceIds,Values=i-12344d305eEXAMPLE \ --task-arn arn:aws:lambda:us-east-1:111222333444:function:SSMTestLAMBDA \ --service-role-arn arn:aws:iam::111222333444:role/SSM \ --task-type LAMBDA \ --task-invocation-parameters '{"Lambda":{"Payload":"{\"InstanceId\":\"{{RESOURCE_ID}}\",\"targetType\":\"{{TARGET_TYPE}}\"}","Qualifier":"$LATEST"}}' \ --priority 0 \ --max-concurrency 10 \ --max-errors 5 \ --name "Lambda_Example" \ --description "My Lambda Example"

Output:

{ "WindowTaskId":"22244444-5555-6666-7777-88888888" }

Untuk informasi selengkapnya, lihat Mendaftarkan Tugas dengan Jendela Pem AWS eliharaan (CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh 3: Untuk mendaftarkan tugas Run Command dengan jendela pemeliharaan

register-task-with-maintenance-windowContoh berikut mendaftarkan tugas Run Command dengan jendela pemeliharaan yang ditargetkan pada sebuah instance.

aws ssm register-task-with-maintenance-window \ --window-id "mw-082dcd7649dee04e4" \ --targets "Key=InstanceIds,Values=i-12344d305eEXAMPLE" \ --service-role-arn "arn:aws:iam::111222333444:role/SSM" \ --task-type "RUN_COMMAND" \ --name "SSMInstallPowerShellModule" \ --task-arn "AWS-InstallPowerShellModule" \ --task-invocation-parameters "{\"RunCommand\":{\"Comment\":\"\",\"OutputS3BucketName\":\"runcommandlogs\",\"Parameters\":{\"commands\":[\"Get-Module -ListAvailable\"],\"executionTimeout\":[\"3600\"],\"source\":[\"https:\/\/gallery.technet.microsoft.com\/EZOut-33ae0fb7\/file\/110351\/1\/EZOut.zip\"],\"workingDirectory\":[\"\\\\\"]},\"TimeoutSeconds\":600}}" \ --max-concurrency 1 \ --max-errors 1 \ --priority 10

Output:

{ "WindowTaskId":"33344444-5555-6666-7777-88888888" }

Untuk informasi selengkapnya, lihat Mendaftarkan Tugas dengan Jendela Pem AWS eliharaan (CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh 4: Untuk mendaftarkan tugas Fungsi Langkah dengan jendela pemeliharaan

register-task-with-maintenance-windowContoh berikut mendaftarkan tugas Fungsi Langkah dengan jendela pemeliharaan yang ditargetkan pada sebuah instance.

aws ssm register-task-with-maintenance-window \ --window-id "mw-1234d787d6EXAMPLE" \ --targets Key=WindowTargetIds,Values=12347414-69c3-49f8-95b8-ed2dcEXAMPLE \ --task-arn arn:aws:states:us-east-1:111222333444:stateMachine:SSMTestStateMachine \ --service-role-arn arn:aws:iam::111222333444:role/MaintenanceWindows \ --task-type STEP_FUNCTIONS \ --task-invocation-parameters '{"StepFunctions":{"Input":"{\"InstanceId\":\"{{RESOURCE_ID}}\"}"}}' \ --priority 0 \ --max-concurrency 10 \ --max-errors 5 \ --name "Step_Functions_Example" \ --description "My Step Functions Example"

Output:

{ "WindowTaskId":"44444444-5555-6666-7777-88888888" }

Untuk informasi selengkapnya, lihat Mendaftarkan Tugas dengan Jendela Pem AWS eliharaan (CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh 5: Untuk mendaftarkan tugas menggunakan ID target jendela pemeliharaan

register-task-with-maintenance-windowContoh berikut mendaftarkan tugas menggunakan ID target jendela pemeliharaan. ID target jendela pemeliharaan ada di output aws ssm register-target-with-maintenance-window perintah. Anda juga dapat mengambilnya dari output aws ssm describe-maintenance-window-targets perintah.

aws ssm register-task-with-maintenance-window \ --targets "Key=WindowTargetIds,Values=350d44e6-28cc-44e2-951f-4b2c9EXAMPLE" \ --task-arn "AWS-RunShellScript" \ --service-role-arn "arn:aws:iam::111222333444:role/MaintenanceWindowsRole" \ --window-id "mw-ab12cd34eEXAMPLE" \ --task-type "RUN_COMMAND" \ --task-parameters "{\"commands\":{\"Values\":[\"df\"]}}" \ --max-concurrency 1 \ --max-errors 1 \ --priority 10

Output:

{ "WindowTaskId":"33344444-5555-6666-7777-88888888" }

Untuk informasi selengkapnya, lihat Mendaftarkan Tugas dengan Jendela Pem AWS eliharaan (CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanremove-tags-from-resource.

AWS CLI

Untuk menghapus tag dari baseline patch

remove-tags-from-resourceContoh berikut menghapus tag dari baseline patch.

aws ssm remove-tags-from-resource \ --resource-type "PatchBaseline" \ --resource-id "pb-0123456789abcdef0" \ --tag-keys "Region"

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Menandai Sumber AWS Daya di Refer ensi AWS Umum.

Contoh kode berikut menunjukkan cara menggunakanreset-service-setting.

AWS CLI

Untuk mengatur ulang pengaturan layanan untuk throughput Penyimpanan Parameter

reset-service-settingContoh berikut mengatur ulang pengaturan layanan untuk throughput Penyimpanan Parameter di wilayah yang ditentukan agar tidak lagi menggunakan peningkatan throughput.

aws ssm reset-service-setting \ --setting-id arn:aws:ssm:us-east-1:123456789012:servicesetting/ssm/parameter-store/high-throughput-enabled

Output:

{ "ServiceSetting": { "SettingId": "/ssm/parameter-store/high-throughput-enabled", "SettingValue": "false", "LastModifiedDate": 1555532818.578, "LastModifiedUser": "System", "ARN": "arn:aws:ssm:us-east-1:123456789012:servicesetting/ssm/parameter-store/high-throughput-enabled", "Status": "Default" } }

Untuk informasi selengkapnya, lihat Meningkatkan Throughput Peny impanan Parameter di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanresume-session.

AWS CLI

Untuk melanjutkan sesi Manajer Sesi

resume-sessionContoh ini melanjutkan sesi Manajer Sesi dengan instance setelah terputus. Perhatikan bahwa perintah interaktif ini memerlukan plugin Session Manager untuk diinstal pada mesin klien yang melakukan panggilan.

aws ssm resume-session \ --session-id Mary-Major-07a16060613c408b5

Output:

{ "SessionId": "Mary-Major-07a16060613c408b5", "TokenValue": "AAEAAVbTGsaOnyvcUoNGqifbv5r/8lgxuQljCuY8qVcvOnoBAAAAAFxtd3jIXAFUUXGTJ7zF/AWJPwDviOlF5p3dlAgrqVIVO6IEXhkHLz0/1gXKRKEME71E6TLOplLDJAMZ+kREejkZu4c5AxMkrQjMF+gtHP1bYJKTwtHQd1wjulPLexO8SHl7g5R/wekrj6WsDUpnEegFBfGftpAIz2GXQVfTJXKfkc5qepQ11C11DOIT2dozOqXgHwfQHfAKLErM5dWDZqKwyT1Z3iw7unQdm3p5qsbrugiOZ7CRANTE+ihfGa6MEJJ97Jmat/a2TspEnOjNn9Mvu5iwXIW2yCvWZrGUj+/QI5Xr7s1XJBEnSKR54o4fN0GV9RWl0RZsZm1m1ki0JJtiwwgZ", "StreamUrl": "wss://ssmmessages.us-east-2.amazonaws.com/v1/data-channel/Mary-Major-07a16060613c408b5?role=publish_subscribe" }

Untuk informasi selengkapnya, lihat Menginstal Plugin Pengelola Sesi untuk AWS CLI di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakansend-automation-signal.

AWS CLI

Untuk mengirim sinyal ke eksekusi otomatisasi

send-automation-signalContoh berikut mengirimkan sinyal Approve ke eksekusi Otomasi.

aws ssm send-automation-signal \ --automation-execution-id 73c8eef8-f4ee-4a05-820c-e354fEXAMPLE \ --signal-type "Approve"

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Menjalankan Alur Kerja Otomasi dengan Set uju di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakansend-command.

AWS CLI

Contoh 1: Untuk menjalankan perintah pada satu atau beberapa instance jarak jauh

send-commandContoh berikut menjalankan echo perintah pada instance target.

aws ssm send-command \ --document-name "AWS-RunShellScript" \ --parameters 'commands=["echo HelloWorld"]' \ --targets "Key=instanceids,Values=i-1234567890abcdef0" \ --comment "echo HelloWorld"

Output:

{ "Command": { "CommandId": "92853adf-ba41-4cd6-9a88-142d1EXAMPLE", "DocumentName": "AWS-RunShellScript", "DocumentVersion": "", "Comment": "echo HelloWorld", "ExpiresAfter": 1550181014.717, "Parameters": { "commands": [ "echo HelloWorld" ] }, "InstanceIds": [ "i-0f00f008a2dcbefe2" ], "Targets": [], "RequestedDateTime": 1550173814.717, "Status": "Pending", "StatusDetails": "Pending", "OutputS3BucketName": "", "OutputS3KeyPrefix": "", "MaxConcurrency": "50", "MaxErrors": "0", "TargetCount": 1, "CompletedCount": 0, "ErrorCount": 0, "DeliveryTimedOutCount": 0, "ServiceRole": "", "NotificationConfig": { "NotificationArn": "", "NotificationEvents": [], "NotificationType": "" }, "CloudWatchOutputConfig": { "CloudWatchLogGroupName": "", "CloudWatchOutputEnabled": false } } }

Untuk informasi selengkapnya, lihat Menjalankan Perintah Menggunakan Perintah Jalankan Manajer AWS Sistem di Panduan Pengguna Manajer Sistem.

Contoh 2: Untuk mendapatkan informasi IP tentang sebuah instance

send-commandContoh berikut mengambil informasi IP tentang sebuah instance.

aws ssm send-command \ --instance-ids "i-1234567890abcdef0" \ --document-name "AWS-RunShellScript" \ --comment "IP config" \ --parameters "commands=ifconfig"

Lihat contoh 1 untuk keluaran sampel.

Untuk informasi selengkapnya, lihat Menjalankan Perintah Menggunakan Perintah Jalankan Manajer AWS Sistem di Panduan Pengguna Manajer Sistem.

Contoh 3: Untuk menjalankan perintah pada instance dengan tag tertentu

send-commandContoh berikut menjalankan perintah pada instance yang memiliki kunci tag “ENV” dan nilai “Dev”.

aws ssm send-command \ --targets "Key=tag:ENV,Values=Dev" \ --document-name "AWS-RunShellScript" \ --parameters "commands=ifconfig"

Lihat contoh 1 untuk keluaran sampel.

Untuk informasi selengkapnya, lihat Menjalankan Perintah Menggunakan Perintah Jalankan Manajer AWS Sistem di Panduan Pengguna Manajer Sistem.

Contoh 4: Untuk menjalankan perintah yang mengirimkan notifikasi SNS

send-commandContoh berikut menjalankan perintah yang mengirimkan notifikasi SNS untuk semua peristiwa notifikasi dan jenis Command notifikasi.

aws ssm send-command \ --instance-ids "i-1234567890abcdef0" \ --document-name "AWS-RunShellScript" \ --comment "IP config" \ --parameters "commands=ifconfig" \ --service-role-arn "arn:aws:iam::123456789012:role/SNS_Role" \ --notification-config "NotificationArn=arn:aws:sns:us-east-1:123456789012:SNSTopicName,NotificationEvents=All,NotificationType=Command"

Lihat contoh 1 untuk keluaran sampel.

Untuk informasi selengkapnya, lihat Menjalankan Perintah Menggunakan Perintah Jalankan Manajer AWS Sistem di Panduan Pengguna Manajer Sistem.

Contoh 5: Untuk menjalankan perintah yang menghasilkan ke S3 dan CloudWatch

send-commandContoh berikut menjalankan perintah yang menampilkan detail perintah ke bucket S3 dan ke grup CloudWatch log log.

aws ssm send-command \ --instance-ids "i-1234567890abcdef0" \ --document-name "AWS-RunShellScript" \ --comment "IP config" \ --parameters "commands=ifconfig" \ --output-s3-bucket-name "s3-bucket-name" \ --output-s3-key-prefix "runcommand" \ --cloud-watch-output-config "CloudWatchOutputEnabled=true,CloudWatchLogGroupName=CWLGroupName"

Lihat contoh 1 untuk keluaran sampel.

Untuk informasi selengkapnya, lihat Menjalankan Perintah Menggunakan Perintah Jalankan Manajer AWS Sistem di Panduan Pengguna Manajer Sistem.

Contoh 6: Untuk menjalankan perintah pada beberapa instance dengan tag yang berbeda

send-commandContoh berikut menjalankan perintah pada instance dengan dua kunci tag dan nilai yang berbeda.

aws ssm send-command \ --document-name "AWS-RunPowerShellScript" \ --parameters commands=["echo helloWorld"] \ --targets Key=tag:Env,Values=Dev Key=tag:Role,Values=WebServers

Lihat contoh 1 untuk keluaran sampel.

Untuk informasi selengkapnya, lihat Menjalankan Perintah Menggunakan Perintah Jalankan Manajer AWS Sistem di Panduan Pengguna Manajer Sistem.

Contoh 7: Untuk menargetkan beberapa instance dengan kunci tag yang sama

send-commandContoh berikut menjalankan perintah pada instance yang memiliki kunci tag yang sama tetapi dengan nilai yang berbeda.

aws ssm send-command \ --document-name "AWS-RunPowerShellScript" \ --parameters commands=["echo helloWorld"] \ --targets Key=tag:Env,Values=Dev,Test

Lihat contoh 1 untuk keluaran sampel.

Untuk informasi selengkapnya, lihat Menjalankan Perintah Menggunakan Perintah Jalankan Manajer AWS Sistem di Panduan Pengguna Manajer Sistem.

Contoh 8: Untuk menjalankan perintah yang menggunakan dokumen bersama

send-commandContoh berikut menjalankan dokumen bersama pada instance target.

aws ssm send-command \ --document-name "arn:aws:ssm:us-east-1:123456789012:document/ExampleDocument" \ --targets "Key=instanceids,Values=i-1234567890abcdef0"

Lihat contoh 1 untuk keluaran sampel.

Untuk informasi selengkapnya, lihat Menggunakan dokumen SSM bersama di Panduan AWS Pengguna Manajer Sistem.

  • Untuk detail API, lihat SendCommand di Refer AWS CLI ensi Perintah.

Contoh kode berikut menunjukkan cara menggunakanstart-associations-once.

AWS CLI

Untuk menjalankan asosiasi segera dan hanya satu kali

start-associations-onceContoh berikut menjalankan asosiasi yang ditentukan segera dan hanya sekali. Tidak ada output jika perintah berhasil.

aws ssm start-associations-once \ --association-id "8dfe3659-4309-493a-8755-0123456789ab"

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Melihat riwayat asosiasi di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanstart-automation-execution.

AWS CLI

Contoh 1: Untuk mengeksekusi dokumen otomatisasi

start-automation-executionContoh berikut menjalankan dokumen Otomasi.

aws ssm start-automation-execution \ --document-name "AWS-UpdateLinuxAmi" \ --parameters "AutomationAssumeRole=arn:aws:iam::123456789012:role/SSMAutomationRole,SourceAmiId=ami-EXAMPLE,IamInstanceProfileName=EC2InstanceRole"

Output:

{ "AutomationExecutionId": "4105a4fc-f944-11e6-9d32-0a1b2EXAMPLE" }

Untuk informasi selengkapnya, lihat Menjalankan Alur Kerja Otomasi Secara Manual di Panduan Pengguna Manajer AWS Sistem.

Contoh 2: Untuk menjalankan dokumen otomatisasi bersama

start-automation-executionContoh berikut menjalankan dokumen Otomasi bersama.

aws ssm start-automation-execution \ --document-name "arn:aws:ssm:us-east-1:123456789012:document/ExampleDocument"

Output:

{ "AutomationExecutionId": "4105a4fc-f944-11e6-9d32-0a1b2EXAMPLE" }

Untuk informasi selengkapnya, lihat Menggunakan dokumen SSM bersama di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanstart-change-request-execution.

AWS CLI

Contoh 1: Untuk memulai permintaan perubahan

start-change-request-executionContoh berikut memulai permintaan perubahan dengan opsi minimal yang ditentukan.

aws ssm start-change-request-execution \ --change-request-name MyChangeRequest \ --document-name AWS-HelloWorldChangeTemplate \ --runbooks '[{"DocumentName": "AWS-HelloWorld","Parameters": {"AutomationAssumeRole": ["arn:aws:iam:us-east-2:1112223233444:role/MyChangeManagerAssumeRole"]}}]' \ --parameters Approver="JohnDoe",ApproverType="IamUser",ApproverSnsTopicArn="arn:aws:sns:us-east-2:1112223233444:MyNotificationTopic"

Output:

{ "AutomationExecutionId": "9d32a4fc-f944-11e6-4105-0a1b2EXAMPLE" }

Contoh 2: Untuk memulai permintaan perubahan menggunakan file JSON eksternal

start-automation-executionContoh berikut memulai permintaan perubahan dengan beberapa opsi yang ditentukan dalam file JSON.

aws ssm start-change-request-execution \ --cli-input-json file://MyChangeRequest.json

Isi dari MyChangeRequest.json:

{ "ChangeRequestName": "MyChangeRequest", "DocumentName": "AWS-HelloWorldChangeTemplate", "DocumentVersion": "$DEFAULT", "ScheduledTime": "2021-12-30T03:00:00", "ScheduledEndTime": "2021-12-30T03:05:00", "Tags": [ { "Key": "Purpose", "Value": "Testing" } ], "Parameters": { "Approver": [ "JohnDoe" ], "ApproverType": [ "IamUser" ], "ApproverSnsTopicArn": [ "arn:aws:sns:us-east-2:111222333444;:MyNotificationTopic ] }, "Runbooks": [ { "DocumentName": "AWS-HelloWorld", "DocumentVersion": "1", "MaxConcurrency": "1", "MaxErrors": "1", "Parameters": { "AutomationAssumeRole": [ "arn:aws:iam::111222333444:role/MyChangeManagerAssumeRole" ] } } ], "ChangeDetails": "### Document Name: HelloWorldChangeTemplate\n\n## What does this document do?\nThis change template demonstrates the feature set available for creating change templates for Change Manager. This template starts a Runbook workflow for the Automation document called AWS-HelloWorld.\n\n## Input Parameters\n* ApproverSnsTopicArn: (Required) Amazon Simple Notification Service ARN for approvers.\n* Approver: (Required) The name of the approver to send this request to.\n* ApproverType: (Required) The type of reviewer.\n * Allowed Values: IamUser, IamGroup, IamRole, SSOGroup, SSOUser\n\n## Output Parameters\nThis document has no outputs \n" }

Output:

{ "AutomationExecutionId": "9d32a4fc-f944-11e6-4105-0a1b2EXAMPLE" }

Untuk informasi selengkapnya, lihat Membuat permintaan perubahan di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanstart-session.

AWS CLI

Contoh 1: Untuk memulai sesi Manajer Sesi

start-sessionContoh ini membuat koneksi dengan instance untuk sesi Manajer Sesi. Perhatikan bahwa perintah interaktif ini memerlukan plugin Session Manager untuk diinstal pada mesin klien yang melakukan panggilan.

aws ssm start-session \ --target "i-1234567890abcdef0"

Output:

Starting session with SessionId: Jane-Roe-07a16060613c408b5

Contoh 2: Untuk memulai sesi Manajer Sesi menggunakan SSH

start-sessionContoh ini membuat koneksi dengan instance untuk sesi Manajer Sesi menggunakan SSH. Perhatikan bahwa perintah interaktif ini memerlukan plugin Session Manager untuk diinstal pada mesin klien yang melakukan panggilan, dan bahwa perintah tersebut menggunakan pengguna default pada instance, seperti ec2-user untuk instans EC2 untuk Linux.

ssh -i /path/my-key-pair.pem ec2-user@i-02573cafcfEXAMPLE

Output:

Starting session with SessionId: ec2-user-07a16060613c408b5

Untuk informasi selengkapnya, lihat Mem ulai S esi dan Menginstal Plugin Pengelola Sesi untuk AWS CLI di Panduan AWS Pengguna Manajer Sistem.

  • Untuk detail API, lihat StartSession di Refer AWS CLI ensi Perintah.

Contoh kode berikut menunjukkan cara menggunakanstop-automation-execution.

AWS CLI

Untuk menghentikan eksekusi otomatisasi

stop-automation-executionContoh berikut menghentikan dokumen Otomasi.

aws ssm stop-automation-execution --automation-execution-id "4105a4fc-f944-11e6-9d32-0a1b2EXAMPLE"

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Menjalankan Alur Kerja Otomasi Secara Manual di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanterminate-session.

AWS CLI

Untuk mengakhiri sesi Manajer Sesi

terminate-sessionContoh ini secara permanen mengakhiri sesi yang dibuat oleh pengguna "Shirley-Rodriguez" dan menutup koneksi data antara klien Manajer Sesi dan Agen SSM pada instance.

aws ssm terminate-session \ --session-id "Shirley-Rodriguez-07a16060613c408b5"

Output:

{ "SessionId": "Shirley-Rodriguez-07a16060613c408b5" }

Untuk informasi selengkapnya, lihat Meng akhiri S esi di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanunlabel-parameter-version.

AWS CLI

Untuk menghapus label parameter

unlabel-parameter-versionContoh berikut menghapus label yang ditentukan dari versi parameter yang diberikan.

aws ssm unlabel-parameter-version \ --name "parameterName" \ --parameter-version 2 \ --labels "label_1" "label_2" "label_3"

Output:

{ "RemovedLabels": [ "label_1" "label_2" "label_3" ], "InvalidLabels": [] }

Untuk informasi selengkapnya, lihat Mengh apus label parameter (AWS CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanupdate-association-status.

AWS CLI

Untuk memperbarui status asosiasi

update-association-statusContoh berikut memperbarui status asosiasi hubungan antara instance dan dokumen.

aws ssm update-association-status \ --name "AWS-UpdateSSMAgent" \ --instance-id "i-1234567890abcdef0" \ --association-status "Date=1424421071.939,Name=Pending,Message=temp_status_change,AdditionalInfo=Additional-Config-Needed"

Output:

{ "AssociationDescription": { "Name": "AWS-UpdateSSMAgent", "InstanceId": "i-1234567890abcdef0", "AssociationVersion": "1", "Date": 1550507529.604, "LastUpdateAssociationDate": 1550507806.974, "Status": { "Date": 1424421071.0, "Name": "Pending", "Message": "temp_status_change", "AdditionalInfo": "Additional-Config-Needed" }, "Overview": { "Status": "Success", "AssociationStatusAggregatedCount": { "Success": 1 } }, "DocumentVersion": "$DEFAULT", "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "Targets": [ { "Key": "InstanceIds", "Values": [ "i-1234567890abcdef0" ] } ], "LastExecutionDate": 1550507808.0, "LastSuccessfulExecutionDate": 1550507808.0 } }

Untuk informasi selengkapnya, lihat Bekerja dengan asosiasi di Manajer Sistem di AWS Panduan Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanupdate-association.

AWS CLI

Contoh 1: Untuk memperbarui asosiasi dokumen

update-associationContoh berikut memperbarui asosiasi dengan versi dokumen baru.

aws ssm update-association \ --association-id "8dfe3659-4309-493a-8755-0123456789ab" \ --document-version "\$LATEST"

Output:

{ "AssociationDescription": { "Name": "AWS-UpdateSSMAgent", "AssociationVersion": "2", "Date": 1550508093.293, "LastUpdateAssociationDate": 1550508106.596, "Overview": { "Status": "Pending", "DetailedStatus": "Creating" }, "DocumentVersion": "$LATEST", "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "Targets": [ { "Key": "tag:Name", "Values": [ "Linux" ] } ], "LastExecutionDate": 1550508094.879, "LastSuccessfulExecutionDate": 1550508094.879 } }

Untuk informasi selengkapnya, lihat Meng edit dan membuat versi baru asosiasi di Panduan AWS Pengguna Manajer Sistem.

Contoh 2: Untuk memperbarui ekspresi jadwal asosiasi

update-associationContoh berikut memperbarui ekspresi jadwal untuk asosiasi yang ditentukan.

aws ssm update-association \ --association-id "8dfe3659-4309-493a-8755-0123456789ab" \ --schedule-expression "cron(0 0 0/4 1/1 * ? *)"

Output:

{ "AssociationDescription": { "Name": "AWS-HelloWorld", "AssociationVersion": "2", "Date": "2021-02-08T13:54:19.203000-08:00", "LastUpdateAssociationDate": "2021-06-29T11:51:07.933000-07:00", "Overview": { "Status": "Pending", "DetailedStatus": "Creating" }, "DocumentVersion": "$DEFAULT", "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "Targets": [ { "Key": "aws:NoOpAutomationTag", "Values": [ "AWS-NoOpAutomationTarget-Value" ] } ], "ScheduleExpression": "cron(0 0 0/4 1/1 * ? *)", "LastExecutionDate": "2021-06-26T19:00:48.110000-07:00", "ApplyOnlyAtCronInterval": false } }

Untuk informasi selengkapnya, lihat Meng edit dan membuat versi baru asosiasi di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanupdate-document-default-version.

AWS CLI

Untuk memperbarui versi default dokumen

update-document-default-versionContoh berikut memperbarui versi default dari dokumen Manajer Sistem.

aws ssm update-document-default-version \ --name "Example" \ --document-version "2"

Output:

{ "Description": { "Name": "Example", "DefaultVersion": "2" } }

Untuk informasi selengkapnya, lihat Menulis Konten Dokumen SSM di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanupdate-document-metadata.

AWS CLI

Contoh: Untuk menyetujui versi terbaru dari template perubahan

Berikut ini update-document-metadata memberikan persetujuan untuk versi terbaru dari template perubahan yang telah dikirimkan untuk ditinjau.

aws ssm update-document-metadata \ --name MyChangeManagerTemplate \ --document-reviews 'Action=Approve,Comment=[{Type=Comment,Content=Approved!}]'

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Meninjau dan menyetujui atau menolak templat perubahan di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanupdate-document.

AWS CLI

Untuk membuat versi baru dokumen

update-documentContoh berikut membuat versi baru dokumen saat dijalankan di komputer Windows. Dokumen yang ditentukan oleh --document harus dalam format JSON. Perhatikan bahwa file:// harus direferensikan diikuti oleh jalur file konten. Karena $ di awal --document-version parameter, Pada Windows Anda harus mengelilingi nilai dengan tanda kutip ganda. Di Linux, macOS, atau saat diminta PowerShell , Anda harus mengelilingi nilai dengan tanda kutip tunggal.

Versi Windows:

aws ssm update-document \ --name "RunShellScript" \ --content "file://RunShellScript.json" \ --document-version "$LATEST"

Linux/Mac versi:

aws ssm update-document \ --name "RunShellScript" \ --content "file://RunShellScript.json" \ --document-version '$LATEST'

Output:

{ "DocumentDescription": { "Status": "Updating", "Hash": "f775e5df4904c6fa46686c4722fae9de1950dace25cd9608ff8d622046b68d9b", "Name": "RunShellScript", "Parameters": [ { "Type": "StringList", "Name": "commands", "Description": "(Required) Specify a shell script or a command to run." } ], "DocumentType": "Command", "PlatformTypes": [ "Linux" ], "DocumentVersion": "2", "HashType": "Sha256", "CreatedDate": 1487899655.152, "Owner": "809632081692", "SchemaVersion": "2.0", "DefaultVersion": "1", "LatestVersion": "2", "Description": "Run an updated script" } }

Contoh kode berikut menunjukkan cara menggunakanupdate-maintenance-window-target.

AWS CLI

Untuk memperbarui target jendela pemeliharaan

update-maintenance-window-targetContoh berikut hanya memperbarui nama target jendela pemeliharaan.

aws ssm update-maintenance-window-target \ --window-id "mw-0c5ed765acEXAMPLE" \ --window-target-id "57e8344e-fe64-4023-8191-6bf05EXAMPLE" \ --name "NewName" \ --no-replace

Output:

{ "Description": "", "OwnerInformation": "", "WindowTargetId": "57e8344e-fe64-4023-8191-6bf05EXAMPLE", "WindowId": "mw-0c5ed765acEXAMPLE", "Targets": [ { "Values": [ "i-1234567890EXAMPLE" ], "Key": "InstanceIds" } ], "Name": "NewName" }

Untuk informasi selengkapnya, lihat Memperbarui Jendela Pemeliharaan (AWS CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanupdate-maintenance-window-task.

AWS CLI

Untuk memperbarui tugas jendela pemeliharaan

update-maintenance-window-taskContoh berikut memperbarui peran layanan untuk tugas jendela pemeliharaan.

aws ssm update-maintenance-window-task \ --window-id "mw-0c5ed765acEXAMPLE" \ --window-task-id "23d3809e-9fbe-4ddf-b41a-b49d7EXAMPLE" \ --service-role-arn "arn:aws:iam::111222333444:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM"

Output:

{ "ServiceRoleArn": "arn:aws:iam::111222333444:role/aws-service-role/ssm.amazonaws.com/AWSServiceRoleForAmazonSSM", "MaxErrors": "1", "TaskArn": "AWS-UpdateEC2Config", "MaxConcurrency": "1", "WindowTaskId": "23d3809e-9fbe-4ddf-b41a-b49d7EXAMPLE", "TaskParameters": {}, "Priority": 1, "TaskInvocationParameters": { "RunCommand": { "TimeoutSeconds": 600, "Parameters": { "allowDowngrade": [ "false" ] } } }, "WindowId": "mw-0c5ed765acEXAMPLE", "Description": "UpdateEC2Config", "Targets": [ { "Values": [ "57e8344e-fe64-4023-8191-6bf05EXAMPLE" ], "Key": "WindowTargetIds" } ], "Name": "UpdateEC2Config" }

Untuk informasi selengkapnya, lihat Memperbarui Jendela Pemeliharaan (AWS CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanupdate-maintenance-window.

AWS CLI

Contoh 1: Untuk memperbarui jendela pemeliharaan

update-maintenance-windowContoh berikut memperbarui nama jendela pemeliharaan.

aws ssm update-maintenance-window \ --window-id "mw-1a2b3c4d5e6f7g8h9" \ --name "My-Renamed-MW"

Output:

{ "Cutoff": 1, "Name": "My-Renamed-MW", "Schedule": "cron(0 16 ? * TUE *)", "Enabled": true, "AllowUnassociatedTargets": true, "WindowId": "mw-1a2b3c4d5e6f7g8h9", "Duration": 4 }

Contoh 2: Untuk menonaktifkan jendela pemeliharaan

update-maintenance-windowContoh berikut menonaktifkan jendela pemeliharaan.

aws ssm update-maintenance-window \ --window-id "mw-1a2b3c4d5e6f7g8h9" \ --no-enabled

Contoh 3: Untuk mengaktifkan jendela pemeliharaan

update-maintenance-windowContoh berikut memungkinkan jendela pemeliharaan.

aws ssm update-maintenance-window \ --window-id "mw-1a2b3c4d5e6f7g8h9" \ --enabled

Untuk informasi selengkapnya, lihat Memperbarui Jendela Pemeliharaan (AWS CLI) di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanupdate-managed-instance-role.

AWS CLI

Untuk memperbarui peran IAM dari instance terkelola

update-managed-instance-roleContoh berikut memperbarui profil instance IAM dari instance terkelola.

aws ssm update-managed-instance-role \ --instance-id "mi-08ab247cdfEXAMPLE" \ --iam-role "ExampleRole"

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Langkah 4: Membuat Profil Instans IAM untuk Manajer Sistem di Panduan AWS Pengguna Manajer Sistem.

Contoh kode berikut menunjukkan cara menggunakanupdate-ops-item.

AWS CLI

Untuk memperbarui OpsItem

update-ops-itemContoh berikut memperbarui deskripsi, prioritas, dan kategori untuk OpsItem. Selain itu, perintah menentukan topik SNS tempat pemberitahuan dikirim ketika ini OpsItem diedit atau diubah.

aws ssm update-ops-item \ --ops-item-id "oi-287b5EXAMPLE" \ --description "Primary OpsItem for failover event 2020-01-01-fh398yf" \ --priority 2 \ --category "Security" \ --notifications "Arn=arn:aws:sns:us-east-2:111222333444:my-us-east-2-topic"

Output:

This command produces no output.

Untuk informasi selengkapnya, lihat Bek erja dengan OpsItems di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanupdate-patch-baseline.

AWS CLI

Contoh 1: Untuk memperbarui baseline patch

update-patch-baselineContoh berikut menambahkan dua patch yang ditentukan sebagai ditolak dan satu patch sebagaimana disetujui ke baseline patch yang ditentukan.

aws ssm update-patch-baseline \ --baseline-id "pb-0123456789abcdef0" \ --rejected-patches "KB2032276" "MS10-048" \ --approved-patches "KB2124261"

Output:

{ "BaselineId": "pb-0123456789abcdef0", "Name": "WindowsPatching", "OperatingSystem": "WINDOWS", "GlobalFilters": { "PatchFilters": [] }, "ApprovalRules": { "PatchRules": [ { "PatchFilterGroup": { "PatchFilters": [ { "Key": "PRODUCT", "Values": [ "WindowsServer2016" ] } ] }, "ComplianceLevel": "CRITICAL", "ApproveAfterDays": 0, "EnableNonSecurity": false } ] }, "ApprovedPatches": [ "KB2124261" ], "ApprovedPatchesComplianceLevel": "UNSPECIFIED", "ApprovedPatchesEnableNonSecurity": false, "RejectedPatches": [ "KB2032276", "MS10-048" ], "RejectedPatchesAction": "ALLOW_AS_DEPENDENCY", "CreatedDate": 1550244180.465, "ModifiedDate": 1550244180.465, "Description": "Patches for Windows Servers", "Sources": [] }

Contoh 2: Untuk mengganti nama baseline patch

update-patch-baselineContoh berikut mengganti nama baseline patch yang ditentukan.

aws ssm update-patch-baseline \ --baseline-id "pb-0713accee01234567" \ --name "Windows-Server-2012-R2-Important-and-Critical-Security-Updates"

Untuk informasi selengkapnya, lihat Memperbarui atau Menghapus Patch Baseline < https://docs.aws.amazon.com/systems-manager/latest/userguide/patch-baseline-update-or-delete.html >`__ di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanupdate-resource-data-sync.

AWS CLI

Untuk memperbarui sinkronisasi data sumber daya

update-resource-data-syncContoh berikut memperbarui sinkronisasi data SyncFromSource sumber daya.

aws ssm update-resource-data-sync \ --sync-name exampleSync \ --sync-type SyncFromSource \ --sync-source '{"SourceType":"SingleAccountMultiRegions", "SourceRegions":["us-east-1", "us-west-2"]}'

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Menyiapkan Explorer Manajer Sistem untuk Menampilkan Data dari Beberapa Akun dan Wilayah di Panduan Pengguna Manajer AWS Sistem.

Contoh kode berikut menunjukkan cara menggunakanupdate-service-setting.

AWS CLI

Untuk memperbarui pengaturan layanan untuk throughput Penyimpanan Parameter

update-service-settingContoh berikut memperbarui pengaturan layanan saat ini untuk throughput Penyimpanan Parameter di wilayah yang ditentukan untuk menggunakan peningkatan throughput.

aws ssm update-service-setting \ --setting-id arn:aws:ssm:us-east-1:123456789012:servicesetting/ssm/parameter-store/high-throughput-enabled \ --setting-value true

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Meningkatkan Throughput Peny impanan Parameter di Panduan Pengguna Manajer AWS Sistem.