forked from aws/aws-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request aws#1176 from awsdocs/ssm-examples
SSM examples & some EC2 updates
- Loading branch information
Showing
16 changed files
with
369 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
**To create multiple associations** | ||
|
||
This example associates the configuration document ``My_Config_1`` with instance ``i-aabb2233``, and associates the configuration document ``My_Config_2`` with instance ``i-cdcd2233``. The output returns a list of successful and unsuccessful operations, if applicable. | ||
|
||
Command:: | ||
|
||
aws ssm create-association-batch --entries Name=My_Config_1,InstanceId=i-aabb2233 Name=My_Config_2,InstanceId=1-cdcd2233 | ||
|
||
Output:: | ||
|
||
|
||
{ | ||
"Successful": [ | ||
{ | ||
"InstanceId": "i-aabb2233", | ||
"Date": 1424421071.939, | ||
"Name": My_Config_1", | ||
"Status": { | ||
"Date": 1424421071.939, | ||
"Message": "Associated with My_Config_1", | ||
"Name": "Associated" | ||
} | ||
} | ||
], | ||
"Failed": [ | ||
{ | ||
"Entry": { | ||
"InstanceId": "i-cdcd2233", | ||
"Name": "My_Config_2" | ||
}, | ||
"Message": "Association Already Exists", | ||
"Fault": "Client" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
**To associate a configuration document** | ||
|
||
This example associates configuration document ``My_Config_File`` with instance ``i-1a2b3c4d``. | ||
|
||
Command:: | ||
|
||
aws ssm create-association --instance-id i-1a2b3c4d --name "My_Config_File" | ||
|
||
Output:: | ||
|
||
{ | ||
"AssociationDescription": { | ||
"InstanceId": "i-1a2b3c4d", | ||
"Date": 1424354424.842, | ||
"Name": "My_Config_File", | ||
"Status": { | ||
"Date": 1424354424.842, | ||
"Message": "Associated with My_Config_File", | ||
"Name": "Associated" | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
**To create a configuration document** | ||
|
||
This example creates a configuration document called ``My_Document`` in your account. The document must be in JSON format. For more information about writing a configuration document, see `Configuration Document`_ in the *SSM API Reference*. | ||
|
||
.. _`Configuration Document`: http://docs.aws.amazon.com/ssm/latest/APIReference/aws-ssm-document.html | ||
|
||
Command:: | ||
|
||
aws ssm create-document --content file://myconfigfile.json --name "My_Config_Document" | ||
|
||
Output:: | ||
|
||
{ | ||
"DocumentDescription": { | ||
"Status": "Creating", | ||
"Sha1": "715919de1715exampled803025817856844a5f3", | ||
"Name": "My_Config_Document", | ||
"CreatedDate": 1424351175.521 | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
**To delete an association** | ||
|
||
This example deletes the association between instance ``i-bbcc3344`` and the configuration document ``Test_config``. If the command succeeds, no output is returned. | ||
|
||
Command:: | ||
|
||
aws ssm delete-association --instance-id i-bbcc3344 --name Test_config | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
**To delete a configuration document** | ||
|
||
This example deletes the configuration document called ``Config_2``. If the command succeeds, no output is returned. | ||
|
||
Command:: | ||
|
||
aws ssm delete-document --name "Config_2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
**To describe an association** | ||
|
||
This example describes the association between instance ``i-1a2b3c4d`` and ``My_Config_File``. | ||
|
||
Command:: | ||
|
||
aws ssm describe-association --instance-id i-1a2b3c4d --name "My_Config_File" | ||
|
||
Output:: | ||
|
||
{ | ||
"AssociationDescription": { | ||
"InstanceId": "i-1a2b3c4d", | ||
"Date": 1424419009.036, | ||
"Name": "My_Config_File", | ||
"Status": { | ||
"Date": 1424419196.804, | ||
"AdditionalInfo": "{agent=EC2Config,ver=3.0.54,osver=6.3.9600,os=Windows Server 2012 R2 Standard,lang=en-US}", | ||
"Message": "RunId=0198dadc-aaaa-4150-875f-exampleba3d, status:InProgress, code:0, message:RuntimeStatusCounts=[PassedAndReboot=1], RuntimeStatus=[aws:domainJoin={PassedAndReboot,Domain join Succeeded to domain: test.ssm.com}]", | ||
"Name": "Pending" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
**To describe a configuration document** | ||
|
||
This example returns information about a document called ``My_Config_Doc``. | ||
|
||
Command:: | ||
|
||
aws ssm describe-document --name "My_Config_Doc" | ||
Output:: | ||
|
||
{ | ||
"Document": { | ||
"Status": "Active", | ||
"Sha1": "715919de171exampleb3d803025817856844a5f3", | ||
"Name": "My_Config_Doc", | ||
"CreatedDate": 1424351175.521 | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
**To get the contents of a configuration document** | ||
|
||
This example gets the contents of the document called ``My_Config_Document``. | ||
|
||
Command:: | ||
|
||
aws ssm get-document --name "My_Config_Document" | ||
|
||
|
||
Output:: | ||
|
||
{ | ||
"Content": "{\n | ||
\"schemaVersion\": \"1.0\",\n | ||
\"description\": \"Sample configuration to join an instance to a domain\",\n | ||
\"runtimeConfig\": {\n | ||
\"aws:domainJoin\": {\n | ||
\"properties\": [\n | ||
{\n | ||
\"directoryId\": \"d-1234567890\",\n | ||
\"directoryName\": \"test.example.com\",\n | ||
\"dnsIpAddresses\": [\"198.51.100.1\",\"198.51.100.2\"]\n | ||
}\n | ||
]\n | ||
}\n | ||
}\n | ||
}", | ||
"Name": "My_Config_Document" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
**To list your associations for a specific instance** | ||
|
||
This example lists all the associations for instance ``i-1a2b3c4d``. | ||
|
||
Command:: | ||
|
||
aws ssm list-associations --association-filter-list key=InstanceId,value=i-1a2b3c4d | ||
|
||
Output:: | ||
|
||
{ | ||
"Associations": [ | ||
{ | ||
"InstanceId": "i-1a2b3c4d", | ||
"Name": "My_Config_File" | ||
} | ||
] | ||
} | ||
|
||
**To list your associations for a specific configuration document** | ||
|
||
This example lists all associations for the configuration document ``My_Config_File``. | ||
|
||
Command:: | ||
|
||
aws ssm list-associations --association-filter-list key=Name,value=My_Config_File | ||
|
||
Output:: | ||
|
||
{ | ||
"Associations": [ | ||
{ | ||
"InstanceId": "i-1a2b3c4d", | ||
"Name": "My_Config_File" | ||
}, | ||
{ | ||
"InstanceId": "i-rraa3344", | ||
"Name": "My_Config_File" | ||
} | ||
] | ||
} | ||
|
Oops, something went wrong.