Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
• Amazon Systems Manager Change Manager is no longer open to new customers. Existing customers can continue to use the service as normal. For more information, see
Amazon Systems Manager Change Manager availability change.
• The Amazon Systems Manager CloudWatch Dashboard will no longer be available after April 30, 2026. Customers can continue to use Amazon CloudWatch console to view, create, and manage their Amazon CloudWatch dashboards, just as they do today. For more information, see
Amazon CloudWatch Dashboard documentation.
Use CreateAssociationBatch with a CLI
The following code examples show how to use CreateAssociationBatch.
- CLI
-
- Amazon CLI
-
To create multiple associations
This example associates a configuration document with multiple instances. The output returns a list of successful and failed operations, if applicable.
Command:
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": []
}
- PowerShell
-
- Tools for PowerShell V4
-
Example 1: This example associates a configuration document with multiple instances. The output returns a list of successful and failed operations, if applicable.
$option1 = @{InstanceId="i-0cb2b964d3e14fd9f";Name=@("AWS-UpdateSSMAgent")}
$option2 = @{InstanceId="i-0000293ffd8c57862";Name=@("AWS-UpdateSSMAgent")}
New-SSMAssociationFromBatch -Entry $option1,$option2
Output:
Failed Successful
------ ----------
{} {Amazon.SimpleSystemsManagement.Model.FailedCreateAssociation, Amazon.SimpleSystemsManagement.Model.FailedCreateAsso...
Example 2: This example will show the full details of a successful operation.
$option1 = @{InstanceId="i-0cb2b964d3e14fd9f";Name=@("AWS-UpdateSSMAgent")}
$option2 = @{InstanceId="i-0000293ffd8c57862";Name=@("AWS-UpdateSSMAgent")}
(New-SSMAssociationFromBatch -Entry $option1,$option2).Successful
- Tools for PowerShell V5
-
Example 1: This example associates a configuration document with multiple instances. The output returns a list of successful and failed operations, if applicable.
$option1 = @{InstanceId="i-0cb2b964d3e14fd9f";Name=@("AWS-UpdateSSMAgent")}
$option2 = @{InstanceId="i-0000293ffd8c57862";Name=@("AWS-UpdateSSMAgent")}
New-SSMAssociationFromBatch -Entry $option1,$option2
Output:
Failed Successful
------ ----------
{} {Amazon.SimpleSystemsManagement.Model.FailedCreateAssociation, Amazon.SimpleSystemsManagement.Model.FailedCreateAsso...
Example 2: This example will show the full details of a successful operation.
$option1 = @{InstanceId="i-0cb2b964d3e14fd9f";Name=@("AWS-UpdateSSMAgent")}
$option2 = @{InstanceId="i-0000293ffd8c57862";Name=@("AWS-UpdateSSMAgent")}
(New-SSMAssociationFromBatch -Entry $option1,$option2).Successful
For a complete list of Amazon SDK developer guides and code examples, see
Using this service with an Amazon SDK.
This topic also includes information about getting started and details about previous SDK versions.