Gunakan DescribeEffectiveInstanceAssociations dengan CLI - AWS Systems Manager

• AWS Systems ManagerChange Manager tidak lagi terbuka untuk pelanggan baru. Pelanggan yang sudah ada dapat terus menggunakan layanan ini seperti biasa. Untuk informasi selengkapnya, lihat perubahan AWS Systems ManagerChange Manager ketersediaan.

 

• AWS Systems Manager CloudWatch Dasbor tidak akan lagi tersedia setelah 30 April 2026. Pelanggan dapat terus menggunakan CloudWatch konsol Amazon untuk melihat, membuat, dan mengelola CloudWatch dasbor Amazon mereka, seperti yang mereka lakukan hari ini. Untuk informasi selengkapnya, lihat dokumentasi CloudWatch Dasbor Amazon.

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

Gunakan DescribeEffectiveInstanceAssociations dengan CLI

Contoh kode berikut menunjukkan cara menggunakanDescribeEffectiveInstanceAssociations.

CLI
AWS CLI

Untuk mendapatkan rincian asosiasi yang efektif untuk sebuah contoh

describe-effective-instance-associationsContoh berikut mengambil rincian 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" } ] }
PowerShell
Alat untuk PowerShell V4

Contoh 1: Contoh ini menjelaskan asosiasi efektif untuk sebuah instance.

Get-SSMEffectiveInstanceAssociationList -InstanceId "i-0000293ffd8c57862" -MaxResult 5

Output:

AssociationId Content ------------- ------- d8617c07-2079-4c18-9847-1655fc2698b0 {...

Contoh 2: Contoh ini menampilkan isi asosiasi efektif untuk sebuah instance.

(Get-SSMEffectiveInstanceAssociationList -InstanceId "i-0000293ffd8c57862" -MaxResult 5).Content

Output:

{ "schemaVersion": "1.2", "description": "Update the Amazon SSM Agent to the latest version or specified version.", "parameters": { "version": { "default": "", "description": "(Optional) A specific version of the Amazon SSM Agent to install. If not specified, the agen t will be updated to the latest version.", "type": "String" }, "allowDowngrade": { "default": "false", "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.", "type": "String", "allowedValues": [ "true", "false" ] } }, "runtimeConfig": { "aws:updateSsmAgent": { "properties": [ { "agentName": "amazon-ssm-agent", "source": "https://s3.{Region}.amazonaws.com/amazon-ssm-{Region}/ssm-agent-manifest.json", "allowDowngrade": "{{ allowDowngrade }}", "targetVersion": "{{ version }}" } ] } } }
Alat untuk PowerShell V5

Contoh 1: Contoh ini menjelaskan asosiasi efektif untuk sebuah instance.

Get-SSMEffectiveInstanceAssociationList -InstanceId "i-0000293ffd8c57862" -MaxResult 5

Output:

AssociationId Content ------------- ------- d8617c07-2079-4c18-9847-1655fc2698b0 {...

Contoh 2: Contoh ini menampilkan isi asosiasi efektif untuk sebuah instance.

(Get-SSMEffectiveInstanceAssociationList -InstanceId "i-0000293ffd8c57862" -MaxResult 5).Content

Output:

{ "schemaVersion": "1.2", "description": "Update the Amazon SSM Agent to the latest version or specified version.", "parameters": { "version": { "default": "", "description": "(Optional) A specific version of the Amazon SSM Agent to install. If not specified, the agen t will be updated to the latest version.", "type": "String" }, "allowDowngrade": { "default": "false", "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.", "type": "String", "allowedValues": [ "true", "false" ] } }, "runtimeConfig": { "aws:updateSsmAgent": { "properties": [ { "agentName": "amazon-ssm-agent", "source": "https://s3.{Region}.amazonaws.com/amazon-ssm-{Region}/ssm-agent-manifest.json", "allowDowngrade": "{{ allowDowngrade }}", "targetVersion": "{{ version }}" } ] } } }

Untuk daftar lengkap panduan pengembang AWS SDK dan contoh kode, lihatMenggunakan layanan ini dengan AWS SDK. Topik ini juga mencakup informasi tentang memulai dan detail tentang versi SDK sebelumnya.