id
stringlengths
8
78
source
stringclasses
743 values
chunk_id
int64
1
5.05k
text
stringlengths
593
49.7k
systems-manager-ug-788
systems-manager-ug.pdf
788
= async ({ instanceId }) => { const client = new SSMClient({}); try { const listCommandInvocationsPaginated = []; // The paginate function is a wrapper around the base command. const paginator = paginateListCommandInvocations( { client }, { InstanceId: instanceId, }, ); for await (const page of paginator) { listCommandInvocationsPaginated.push(...page.CommandInvocations); } console.log("Here is the list of command invocations:"); console.log(listCommandInvocationsPaginated); return { CommandInvocations: listCommandInvocationsPaginated }; } catch (caught) { if (caught instanceof Error && caught.name === "ValidationError") { console.warn(`${caught.message}. Did you provide a valid instance ID?`); } throw caught; } }; Actions 2766 AWS Systems Manager User Guide • For API details, see ListCommandInvocations in AWS SDK for JavaScript API Reference. PowerShell Tools for PowerShell Example 1: This example lists all the invocations of a command. Get-SSMCommandInvocation -CommandId "b8eac879-0541-439d-94ec-47a80d554f44" - Detail $true Output: CommandId : b8eac879-0541-439d-94ec-47a80d554f44 CommandPlugins : {aws:runShellScript} Comment : IP config DocumentName : AWS-RunShellScript InstanceId : i-0cb2b964d3e14fd9f InstanceName : NotificationConfig : Amazon.SimpleSystemsManagement.Model.NotificationConfig RequestedDateTime : 2/22/2017 8:13:16 PM ServiceRole : StandardErrorUrl : StandardOutputUrl : Status : Success StatusDetails : Success TraceOutput : Example 2: This example lists CommandPlugins for invocation of the command id e1eb2e3c-ed4c-5123-45c1-234f5612345f Get-SSMCommandInvocation -CommandId e1eb2e3c-ed4c-5123-45c1-234f5612345f -Detail: $true | Select-Object -ExpandProperty CommandPlugins Output: Name : aws:runPowerShellScript Output : Completed 17.7 KiB/17.7 KiB (40.1 KiB/s) with 1 file(s) remainingdownload: s3://dd-aess-r-ctmer/KUMO.png to ..\..\programdata\KUMO.png kumo available Actions 2767 AWS Systems Manager User Guide OutputS3BucketName : OutputS3KeyPrefix : OutputS3Region : eu-west-1 ResponseCode : 0 ResponseFinishDateTime : 4/3/2019 11:53:23 AM ResponseStartDateTime : 4/3/2019 11:53:21 AM StandardErrorUrl : StandardOutputUrl : Status : Success StatusDetails : Success • For API details, see ListCommandInvocations in AWS Tools for PowerShell Cmdlet Reference. Python SDK for Python (Boto3) Note There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository. class DocumentWrapper: """Encapsulates AWS Systems Manager Document actions.""" def __init__(self, ssm_client): """ :param ssm_client: A Boto3 Systems Manager client. """ self.ssm_client = ssm_client self.name = None @classmethod def from_client(cls): ssm_client = boto3.client("ssm") return cls(ssm_client) def list_command_invocations(self, instance_id): Actions 2768 AWS Systems Manager """ User Guide Lists the commands for an instance. :param instance_id: The ID of the instance. :return: The list of commands. """ try: paginator = self.ssm_client.get_paginator("list_command_invocations") command_invocations = [] for page in paginator.paginate(InstanceId=instance_id): command_invocations.extend(page["CommandInvocations"]) num_of_commands = len(command_invocations) print( f"{num_of_commands} command invocation(s) found for instance {instance_id}." ) if num_of_commands > 10: print("Displaying the first 10 commands:") num_of_commands = 10 date_format = "%A, %d %B %Y %I:%M%p" for command in command_invocations[:num_of_commands]: print( f" The time of command invocation is {command['RequestedDateTime'].strftime(date_format)}" ) except ClientError as err: logger.error( "Couldn't list commands for %s. Here's why: %s: %s", instance_id, err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise • For API details, see ListCommandInvocations in AWS SDK for Python (Boto3) API Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Actions 2769 AWS Systems Manager User Guide Use ListCommands with a CLI The following code examples show how to use ListCommands. CLI AWS CLI Example 1: To get the status of a specific command The following list-commands example retrieves and displays the status of the specified command. aws ssm list-commands \ --command-id "0831e1a8-a1ac-4257-a1fd-c831bEXAMPLE" Example 2: To get the status of commands requested after a specific date The following list-commands example retrieves the details of commands requested after the specified date. aws ssm list-commands \ --filter "key=InvokedAfter,value=2020-02-01T00:00:00Z" Example 3: To list all commands requested in an AWS account The following list-commands example lists all commands requested by users in the current AWS account and Region. 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", Actions 2770 AWS Systems Manager User Guide "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" Actions 2771 AWS Systems Manager User Guide ] }, "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", Actions 2772 AWS Systems Manager User Guide "Parameters": { "InstallOverrideList": [ "" ], "Operation": [ "Install" ], "RebootOption": [ "RebootIfNeeded" ], "SnapshotId": [ "" ] }, "InstanceIds":
systems-manager-ug-789
systems-manager-ug.pdf
789
Guide ] }, "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", Actions 2772 AWS Systems Manager User Guide "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" Actions 2773 AWS Systems Manager }, "CloudWatchOutputConfig": { "CloudWatchLogGroupName": "", "CloudWatchOutputEnabled": false User Guide } } ] } For more information, see Running Commands Using Systems Manager Run Command in the AWS Systems Manager User Guide. • For API details, see ListCommands in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This example lists all commands requested. Get-SSMCommand Output: CommandId : 4b75a163-d39a-4d97-87c9-98ae52c6be35 Comment : Apply association with id at update time: 4cc73e42- d5ae-4879-84f8-57e09c0efcd0 CompletedCount : 1 DocumentName : AWS-RefreshAssociation ErrorCount : 0 ExpiresAfter : 2/24/2017 3:19:08 AM InstanceIds : {i-0cb2b964d3e14fd9f} MaxConcurrency : 50 MaxErrors : 0 NotificationConfig : Amazon.SimpleSystemsManagement.Model.NotificationConfig OutputS3BucketName : OutputS3KeyPrefix : OutputS3Region : Parameters : {[associationIds, Amazon.Runtime.Internal.Util.AlwaysSendList`1[System.String]]} RequestedDateTime : 2/24/2017 3:18:08 AM ServiceRole : Actions 2774 AWS Systems Manager User Guide Status : Success StatusDetails : Success TargetCount : 1 Targets : {} Example 2: This example gets the status of a specific command. Get-SSMCommand -CommandId "4b75a163-d39a-4d97-87c9-98ae52c6be35" Example 3: This example retrieves all SSM commands invoked after 2019-04-01T00:00:00Z Get-SSMCommand -Filter @{Key="InvokedAfter";Value="2019-04-01T00:00:00Z"} | Select-Object CommandId, DocumentName, Status, RequestedDateTime | Sort-Object - Property RequestedDateTime -Descending Output: CommandId DocumentName Status RequestedDateTime --------- ------------ ------ ----------------- edb1b23e-456a-7adb-aef8-90e-012ac34f AWS-RunPowerShellScript Cancelled 4/16/2019 5:45:23 AM 1a2dc3fb-4567-890d-a1ad-234b5d6bc7d9 AWS-ConfigureAWSPackage Success 4/6/2019 9:19:42 AM 12c3456c-7e90-4f12-1232-1234f5b67893 KT-Retrieve-Cloud-Type-Win Failed 4/2/2019 4:13:07 AM fe123b45-240c-4123-a2b3-234bdd567ecf AWS-RunInspecChecks Failed 4/1/2019 2:27:31 PM 1eb23aa4-567d-4123-12a3-4c1c2ab34561 AWS-RunPowerShellScript Success 4/1/2019 1:05:55 PM 1c2f3bb4-ee12-4bc1-1a23-12345eea123e AWS-RunInspecChecks Failed 4/1/2019 11:13:09 AM • For API details, see ListCommands in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Actions 2775 AWS Systems Manager User Guide Use ListComplianceItems with a CLI The following code examples show how to use ListComplianceItems. CLI AWS CLI To list compliance items for a specific instance This example lists all compliance items for the specified instance. Command: 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", Actions 2776 AWS Systems Manager User Guide "Title": "", "Status": "COMPLIANT", "Severity": "UNSPECIFIED", "ExecutionSummary": { "ExecutionTime": 1550508475.0 }, "Details": { "DocumentName": "AWS-UpdateSSMAgent", "DocumentVersion": "1" } }, ... ], "NextToken": "--token string truncated--" } To list compliance items for a specific instance and association ID This example lists all compliance items for the specified instance and association ID. Command: 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" To list compliance items for a instance after a specific date and time This example lists all compliance items for an instance after the specified date and time. Command: aws ssm list-compliance-items --resource-ids "i-1234567890abcdef0" --resource- types "ManagedInstance" -- filters "Key=ExecutionTime,Values=2019-02-18T16:00:00Z,Type=GREATER_THAN" • For API details, see ListComplianceItems in AWS CLI Command Reference. Actions 2777 AWS Systems Manager PowerShell Tools for PowerShell User Guide Example 1: This example lists compliance items list for the given resource id and type, filtering compliance-type being 'Association' Get-SSMComplianceItemList -ResourceId i-1a2caf345f67d0dc2 -ResourceType ManagedInstance -Filter @{Key="ComplianceType";Values="Association"} Output: ComplianceType : Association Details : {[DocumentName, AWS-GatherSoftwareInventory], [DocumentVersion, 1]} ExecutionSummary : Amazon.SimpleSystemsManagement.Model.ComplianceExecutionSummary Id : 123a45a1-c234-1234-1245-67891236db4e ResourceId : i-1a2caf345f67d0dc2 ResourceType : ManagedInstance Severity : UNSPECIFIED Status : COMPLIANT Title : • For API details, see ListComplianceItems in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use ListComplianceSummaries with a CLI The following code examples show how to use ListComplianceSummaries. CLI AWS CLI To list compliance summaries for all compliance types This example lists compliance summaries for all compliance types in your account. Actions 2778 User Guide AWS Systems Manager Command: aws ssm list-compliance-summaries Output: { "ComplianceSummaryItems": [ { "ComplianceType":
systems-manager-ug-790
systems-manager-ug.pdf
790
For API details, see ListComplianceItems in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use ListComplianceSummaries with a CLI The following code examples show how to use ListComplianceSummaries. CLI AWS CLI To list compliance summaries for all compliance types This example lists compliance summaries for all compliance types in your account. Actions 2778 User Guide AWS Systems Manager Command: 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, Actions 2779 AWS Systems Manager User Guide "UnspecifiedCount": 1 } }, "NonCompliantSummary": { "NonCompliantCount": 1, "SeveritySummary": { "CriticalCount": 1, "HighCount": 0, "MediumCount": 0, "LowCount": 0, "InformationalCount": 0, "UnspecifiedCount": 0 } } }, ... ], "NextToken": "eyJOZXh0VG9rZW4iOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAyfQ==" } To list compliance summaries for a specific compliance type This example lists the compliance summary for the Patch compliance type. Command: aws ssm list-compliance-summaries -- filters "Key=ComplianceType,Values=Patch,Type=EQUAL" • For API details, see ListComplianceSummaries in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This example returns a summary count of compliant and non-compliant resources for all compliance types. Get-SSMComplianceSummaryList Output: Actions 2780 AWS Systems Manager User Guide ComplianceType CompliantSummary NonCompliantSummary -------------- ---------------- ------------------- FleetTotal Amazon.SimpleSystemsManagement.Model.CompliantSummary Amazon.SimpleSystemsManagement.Model.NonCompliantSummary Association Amazon.SimpleSystemsManagement.Model.CompliantSummary Amazon.SimpleSystemsManagement.Model.NonCompliantSummary Custom:InSpec Amazon.SimpleSystemsManagement.Model.CompliantSummary Amazon.SimpleSystemsManagement.Model.NonCompliantSummary Patch Amazon.SimpleSystemsManagement.Model.CompliantSummary Amazon.SimpleSystemsManagement.Model.NonCompliantSummary • For API details, see ListComplianceSummaries in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use ListDocumentVersions with a CLI The following code examples show how to use ListDocumentVersions. CLI AWS CLI To list document versions The following list-document-versions example lists all versions for a Systems Manager document. aws ssm list-document-versions \ --name "Example" Output: { "DocumentVersions": [ { Actions 2781 AWS Systems Manager User Guide "Name": "Example", "DocumentVersion": "1", "CreatedDate": 1583257938.266, "IsDefaultVersion": true, "DocumentFormat": "YAML", "Status": "Active" } ] } For more information, see Sending Commands that Use the Document Version Parameter in the AWS Systems Manager User Guide. • For API details, see ListDocumentVersions in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This example lists all the versions for a document. Get-SSMDocumentVersionList -Name "AWS-UpdateSSMAgent" Output: CreatedDate : 6/1/2021 5:19:10 PM DocumentFormat : JSON DocumentVersion : 1 IsDefaultVersion : True Name : AWS-UpdateSSMAgent Status : Active • For API details, see ListDocumentVersions in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use ListDocuments with a CLI The following code examples show how to use ListDocuments. Actions 2782 AWS Systems Manager CLI AWS CLI Example 1: To list documents User Guide The following list-documents example lists documents owned by the requesting account tagged with the custom tag. 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" } ] } ] } For more information, see AWS Systems Manager Documents in the AWS Systems Manager User Guide. Example 2: To list shared documents Actions 2783 AWS Systems Manager User Guide The following list-documents example lists shared documents, including private shared documents not owned by 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": [] } ] } For more information, see AWS Systems Manager Documents in the AWS Systems Manager User Guide. • For API details, see ListDocuments in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: Lists all the configuration documents in your account. Get-SSMDocumentList Output: DocumentType : Command Actions 2784 AWS Systems Manager User Guide DocumentVersion : 1 Name : AWS-ApplyPatchBaseline Owner : Amazon PlatformTypes : {Windows} SchemaVersion : 1.2 DocumentType : Command DocumentVersion : 1 Name : AWS-ConfigureAWSPackage Owner : Amazon PlatformTypes : {Windows, Linux} SchemaVersion : 2.0 DocumentType : Command DocumentVersion : 1 Name : AWS-ConfigureCloudWatch Owner : Amazon PlatformTypes : {Windows} SchemaVersion : 1.2 ... Example 2: This example retrieves all automation documents with name matchingi 'Platform' Get-SSMDocumentList -DocumentFilterList @{Key="DocumentType";Value="Automation"} | Where-Object Name -Match
systems-manager-ug-791
systems-manager-ug.pdf
791
Command Reference. PowerShell Tools for PowerShell Example 1: Lists all the configuration documents in your account. Get-SSMDocumentList Output: DocumentType : Command Actions 2784 AWS Systems Manager User Guide DocumentVersion : 1 Name : AWS-ApplyPatchBaseline Owner : Amazon PlatformTypes : {Windows} SchemaVersion : 1.2 DocumentType : Command DocumentVersion : 1 Name : AWS-ConfigureAWSPackage Owner : Amazon PlatformTypes : {Windows, Linux} SchemaVersion : 2.0 DocumentType : Command DocumentVersion : 1 Name : AWS-ConfigureCloudWatch Owner : Amazon PlatformTypes : {Windows} SchemaVersion : 1.2 ... Example 2: This example retrieves all automation documents with name matchingi 'Platform' Get-SSMDocumentList -DocumentFilterList @{Key="DocumentType";Value="Automation"} | Where-Object Name -Match "Platform" Output: DocumentFormat : JSON DocumentType : Automation DocumentVersion : 7 Name : KT-Get-Platform Owner : 987654123456 PlatformTypes : {Windows, Linux} SchemaVersion : 0.3 Tags : {} TargetType : VersionName : • For API details, see ListDocuments in AWS Tools for PowerShell Cmdlet Reference. Actions 2785 AWS Systems Manager User Guide For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use ListInventoryEntries with a CLI The following code examples show how to use ListInventoryEntries. CLI AWS CLI Example 1: To view specific inventory type entries for an instance This following list-inventory-entries example lists the inventory entries for the AWS:Application inventory type on a specific instance. 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" Actions 2786 AWS Systems Manager } ] } User Guide Example 2: To view custom inventory entries assigned to an instance The following list-inventory-entries example lists a custom inventory entry assigned to an 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" } ] } • For API details, see ListInventoryEntries in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This example lists all the custom inventory entries for an instance. Get-SSMInventoryEntriesList -InstanceId "i-0cb2b964d3e14fd9f" -TypeName "Custom:RackInfo" Output: CaptureTime : 2016-08-22T10:01:01Z Actions 2787 AWS Systems Manager Entries : User Guide {Amazon.Runtime.Internal.Util.AlwaysSendDictionary`2[System.String,System.String]} InstanceId : i-0cb2b964d3e14fd9f NextToken : SchemaVersion : 1.0 TypeName : Custom:RackInfo Example 2: This example lists the details. (Get-SSMInventoryEntriesList -InstanceId "i-0cb2b964d3e14fd9f" -TypeName "Custom:RackInfo").Entries Output: Key Value --- ----- RackLocation Bay B/Row C/Rack D/Shelf E • For API details, see ListInventoryEntries in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use ListResourceComplianceSummaries with a CLI The following code examples show how to use ListResourceComplianceSummaries. CLI AWS CLI To list resource-level compliance summary counts This example lists resource-level compliance summary counts. Command: aws ssm list-resource-compliance-summaries Actions 2788 AWS Systems Manager Output: { User Guide "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, Actions 2789 AWS Systems Manager User Guide "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--" } To list resource-level compliance summaries for a specific compliance type This example lists resource-level compliance summaries for the Patch compliance type. Command: aws ssm list-resource-compliance-summaries -- filters "Key=ComplianceType,Values=Patch,Type=EQUAL" • For API details, see ListResourceComplianceSummaries in AWS CLI Command Reference. Actions 2790 AWS Systems Manager PowerShell Tools for PowerShell User Guide Example 1: This example gets a resource-level summary count. The summary includes information about compliant and non-compliant statuses and detailed compliance-item severity counts for products that match "Windows10". Because the MaxResult default is 100 if the parameter is not specified, and this value is not valid, MaxResult parameter is added, and the value is set to 50. $FilterValues = @{ "Key"="Product" "Type"="EQUAL" "Values"="Windows10" } Get-SSMResourceComplianceSummaryList -Filter $FilterValues -MaxResult 50 • For API details, see ListResourceComplianceSummaries in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This
systems-manager-ug-792
systems-manager-ug.pdf
792
example gets a resource-level summary count. The summary includes information about compliant and non-compliant statuses and detailed compliance-item severity counts for products that match "Windows10". Because the MaxResult default is 100 if the parameter is not specified, and this value is not valid, MaxResult parameter is added, and the value is set to 50. $FilterValues = @{ "Key"="Product" "Type"="EQUAL" "Values"="Windows10" } Get-SSMResourceComplianceSummaryList -Filter $FilterValues -MaxResult 50 • For API details, see ListResourceComplianceSummaries in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use ListTagsForResource with a CLI The following code examples show how to use ListTagsForResource. CLI AWS CLI To list the tags applied to a patch baseline The following list-tags-for-resource example lists the tags for a patch baseline. aws ssm list-tags-for-resource \ --resource-type "PatchBaseline" \ --resource-id "pb-0123456789abcdef0" Output: Actions 2791 AWS Systems Manager User Guide { "TagList": [ { "Key": "Environment", "Value": "Production" }, { "Key": "Region", "Value": "EMEA" } ] } For more information, see Tagging AWS Resources in the AWS General Reference. • For API details, see ListTagsForResource in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This example lists the tags for a maintenance window. Get-SSMResourceTag -ResourceId "mw-03eb9db42890fb82d" -ResourceType "MaintenanceWindow" Output: Key Value --- ----- Stack Production • For API details, see ListTagsForResource in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use ModifyDocumentPermission with a CLI The following code examples show how to use ModifyDocumentPermission. Actions 2792 AWS Systems Manager CLI AWS CLI User Guide To modify document permissions The following modify-document-permission example shares a Systems Manager document publicly. aws ssm modify-document-permission \ --name "Example" \ --permission-type "Share" \ --account-ids-to-add "All" This command produces no output. For more information, see Share a Systems Manager Document in the AWS Systems Manager User Guide. • For API details, see ModifyDocumentPermission in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This example adds "share" permissions to all accounts for a document. There is no output if the command succeeds. Edit-SSMDocumentPermission -Name "RunShellScript" -PermissionType "Share" - AccountIdsToAdd all Example 2: This example adds "share" permissions to a specific account for a document. There is no output if the command succeeds. Edit-SSMDocumentPermission -Name "RunShellScriptNew" -PermissionType "Share" - AccountIdsToAdd "123456789012" • For API details, see ModifyDocumentPermission in AWS Tools for PowerShell Cmdlet Reference. Actions 2793 AWS Systems Manager User Guide For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use PutComplianceItems with a CLI The following code examples show how to use PutComplianceItems. CLI AWS CLI To register a compliance type and compliance details to a designated instance This example registers the compliance type Custom:AVCheck to the specified managed instance. There is no output if the command succeeds. Command: 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" • For API details, see PutComplianceItems in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This example writes a custom compliance item for the given managed instance $item = [Amazon.SimpleSystemsManagement.Model.ComplianceItemEntry]::new() $item.Id = "07Jun2019-3" $item.Severity="LOW" $item.Status="COMPLIANT" $item.Title="Fin-test-1 - custom" Write-SSMComplianceItem -ResourceId mi-012dcb3ecea45b678 -ComplianceType Custom:VSSCompliant2 -ResourceType ManagedInstance -Item $item - ExecutionSummary_ExecutionTime "07-Jun-2019" Actions 2794 AWS Systems Manager User Guide • For API details, see PutComplianceItems in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use PutInventory with a CLI The following code examples show how to use PutInventory. CLI AWS CLI To assign customer metadata to an instance This example assigns rack location information to an instance. There is no output if the command succeeds. Command (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"}]}]' Command (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'}]" • For API details, see PutInventory in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This example assigns rack location information to an instance. There is no output if the command succeeds. Actions 2795 AWS Systems Manager User Guide $data = New-Object "System.Collections.Generic.Dictionary[System.String,System.String]" $data.Add("RackLocation", "Bay B/Row C/Rack D/Shelf F") $items = New-Object "System.Collections.Generic.List[System.Collections.Generic.Dictionary[System.String, System.String]]" $items.Add($data) $customInventoryItem = New-Object Amazon.SimpleSystemsManagement.Model.InventoryItem $customInventoryItem.CaptureTime = "2016-08-22T10:01:01Z" $customInventoryItem.Content = $items $customInventoryItem.TypeName = "Custom:TestRackInfo2" $customInventoryItem.SchemaVersion = "1.0" $inventoryItems = @($customInventoryItem) Write-SSMInventory
systems-manager-ug-793
systems-manager-ug.pdf
793
'[{"TypeName": "Custom:RackInfo","SchemaVersion": "1.0","CaptureTime": "2019-01-22T10:01:01Z","Content":[{"RackLocation": "Bay B/Row C/Rack D/Shelf E"}]}]' Command (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'}]" • For API details, see PutInventory in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This example assigns rack location information to an instance. There is no output if the command succeeds. Actions 2795 AWS Systems Manager User Guide $data = New-Object "System.Collections.Generic.Dictionary[System.String,System.String]" $data.Add("RackLocation", "Bay B/Row C/Rack D/Shelf F") $items = New-Object "System.Collections.Generic.List[System.Collections.Generic.Dictionary[System.String, System.String]]" $items.Add($data) $customInventoryItem = New-Object Amazon.SimpleSystemsManagement.Model.InventoryItem $customInventoryItem.CaptureTime = "2016-08-22T10:01:01Z" $customInventoryItem.Content = $items $customInventoryItem.TypeName = "Custom:TestRackInfo2" $customInventoryItem.SchemaVersion = "1.0" $inventoryItems = @($customInventoryItem) Write-SSMInventory -InstanceId "i-0cb2b964d3e14fd9f" -Item $inventoryItems • For API details, see PutInventory in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use PutParameter with an AWS SDK or CLI The following code examples show how to use PutParameter. CLI AWS CLI Example 1: To change a parameter value The following put-parameter example changes the value of the specified parameter. aws ssm put-parameter \ --name "MyStringParameter" \ --type "String" \ --value "Vici" \ Actions 2796 AWS Systems Manager --overwrite Output: { "Version": 2, "Tier": "Standard" } User Guide For more information, see Create a Systems Manager parameter (AWS CLI), Managing parameter tiers, and Working with parameter policies in the AWS Systems Manager User Guide. Example 2: To create an advanced parameter The following put-parameter example creates an advanced parameter. 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" } For more information, see Create a Systems Manager parameter (AWS CLI), Managing parameter tiers, and Working with parameter policies in the AWS Systems Manager User Guide. Example 3: To convert a standard parameter to an advanced parameter The following put-parameter example converts an existing standard parameter into an advanced parameter. Actions 2797 AWS Systems Manager User Guide aws ssm put-parameter \ --name "MyConvertedParameter" \ --value "abc123" \ --type "String" \ --tier Advanced \ --overwrite Output: { "Version": 2, "Tier": "Advanced" } For more information, see Create a Systems Manager parameter (AWS CLI), Managing parameter tiers, and Working with parameter policies in the AWS Systems Manager User Guide. Example 4: To create a parameter with a policy attached The following put-parameter example creates an advanced parameter with a parameter policy attached. 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" } Actions 2798 AWS Systems Manager User Guide For more information, see Create a Systems Manager parameter (AWS CLI), Managing parameter tiers, and Working with parameter policies in the AWS Systems Manager User Guide. Example 5: To add a policy to an existing parameter The following put-parameter example attaches a policy to an existing advanced parameter. 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" } For more information, see Create a Systems Manager parameter (AWS CLI), Managing parameter tiers, and Working with parameter policies in the AWS Systems Manager User Guide. • For API details, see PutParameter in AWS CLI Command Reference. Actions 2799 AWS Systems Manager Java SDK for Java 2.x Note User Guide There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository. import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.ssm.SsmClient; import software.amazon.awssdk.services.ssm.model.ParameterType; import software.amazon.awssdk.services.ssm.model.PutParameterRequest; import software.amazon.awssdk.services.ssm.model.SsmException; public class PutParameter { public static void main(String[] args) { final String usage = """ Usage: <paraName> Where: paraName - The name of the parameter. paraValue - The value of the parameter. """; if (args.length != 2) { System.out.println(usage); System.exit(1); } String paraName = args[0]; String paraValue = args[1]; Region region = Region.US_EAST_1; SsmClient ssmClient = SsmClient.builder() .region(region) .build(); putParaValue(ssmClient, paraName, paraValue); Actions 2800 AWS Systems Manager User Guide ssmClient.close(); } public static void putParaValue(SsmClient ssmClient, String paraName, String value) { try { PutParameterRequest parameterRequest = PutParameterRequest.builder() .name(paraName) .type(ParameterType.STRING) .value(value) .build(); ssmClient.putParameter(parameterRequest); System.out.println("The parameter was successfully added."); } catch (SsmException e) { System.err.println(e.getMessage()); System.exit(1); } } } • For API details, see PutParameter in AWS SDK for Java 2.x API Reference. PowerShell Tools for PowerShell Example 1: This example creates a parameter. There is no output if the command succeeds. Write-SSMParameter -Name "Welcome" -Type "String" -Value "helloWorld" Example 2: This example
systems-manager-ug-794
systems-manager-ug.pdf
794
= Region.US_EAST_1; SsmClient ssmClient = SsmClient.builder() .region(region) .build(); putParaValue(ssmClient, paraName, paraValue); Actions 2800 AWS Systems Manager User Guide ssmClient.close(); } public static void putParaValue(SsmClient ssmClient, String paraName, String value) { try { PutParameterRequest parameterRequest = PutParameterRequest.builder() .name(paraName) .type(ParameterType.STRING) .value(value) .build(); ssmClient.putParameter(parameterRequest); System.out.println("The parameter was successfully added."); } catch (SsmException e) { System.err.println(e.getMessage()); System.exit(1); } } } • For API details, see PutParameter in AWS SDK for Java 2.x API Reference. PowerShell Tools for PowerShell Example 1: This example creates a parameter. There is no output if the command succeeds. Write-SSMParameter -Name "Welcome" -Type "String" -Value "helloWorld" Example 2: This example changes a parameter. There is no output if the command succeeds. Write-SSMParameter -Name "Welcome" -Type "String" -Value "Good day, Sunshine!" - Overwrite $true • For API details, see PutParameter in AWS Tools for PowerShell Cmdlet Reference. Actions 2801 AWS Systems Manager Rust SDK for Rust Note User Guide There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository. async fn make_parameter( client: &Client, name: &str, value: &str, description: &str, ) -> Result<(), Error> { let resp = client .put_parameter() .overwrite(true) .r#type(ParameterType::String) .name(name) .value(value) .description(description) .send() .await?; println!("Success! Parameter now has version: {}", resp.version()); Ok(()) } • For API details, see PutParameter in AWS SDK for Rust API reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use RegisterDefaultPatchBaseline with a CLI The following code examples show how to use RegisterDefaultPatchBaseline. Actions 2802 AWS Systems Manager CLI AWS CLI User Guide To set the default patch baseline The following register-default-patch-baseline example registers the specified custom patch baseline as the default patch baseline for the operating system type that it supports. aws ssm register-default-patch-baseline \ --baseline-id "pb-abc123cf9bEXAMPLE" Output: { "BaselineId":"pb-abc123cf9bEXAMPLE" } The following register-default-patch-baseline example registers the default patch baseline provided by AWS for CentOS as the default patch baseline. aws ssm register-default-patch-baseline \ --baseline-id "arn:aws:ssm:us-east-2:733109147000:patchbaseline/ pb-0574b43a65ea646ed" Output: { "BaselineId":"pb-abc123cf9bEXAMPLE" } For more information, see About Predefined and Custom Patch Baselines in the AWS Systems Manager User Guide. • For API details, see RegisterDefaultPatchBaseline in AWS CLI Command Reference. Actions 2803 AWS Systems Manager PowerShell Tools for PowerShell User Guide Example 1: This example registers a patch baseline as the default patch baseline. Register-SSMDefaultPatchBaseline -BaselineId "pb-03da896ca3b68b639" Output: pb-03da896ca3b68b639 • For API details, see RegisterDefaultPatchBaseline in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use RegisterPatchBaselineForPatchGroup with a CLI The following code examples show how to use RegisterPatchBaselineForPatchGroup. CLI AWS CLI To register a patch baseline for a patch group The following register-patch-baseline-for-patch-group example registers a patch baseline for a patch group. aws ssm register-patch-baseline-for-patch-group \ --baseline-id "pb-045f10b4f382baeda" \ --patch-group "Production" Output: { "BaselineId": "pb-045f10b4f382baeda", Actions 2804 AWS Systems Manager User Guide "PatchGroup": "Production" } For more information, see Create a Patch Group <https://docs.aws.amazon.com/systems- manager/latest/userguide/sysman-patch-group-tagging.html>__ and Add a Patch Group to a Patch Baseline in the AWS Systems Manager User Guide. • For API details, see RegisterPatchBaselineForPatchGroup in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This example registers a patch baseline for a patch group. Register-SSMPatchBaselineForPatchGroup -BaselineId "pb-03da896ca3b68b639" - PatchGroup "Production" Output: BaselineId PatchGroup ---------- ---------- pb-03da896ca3b68b639 Production • For API details, see RegisterPatchBaselineForPatchGroup in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use RegisterTargetWithMaintenanceWindow with a CLI The following code examples show how to use RegisterTargetWithMaintenanceWindow. CLI AWS CLI Example 1: To register a single target with a maintenance window Actions 2805 AWS Systems Manager User Guide The following register-target-with-maintenance-window example registers an instance with a maintenance window. 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" } Example 2: To register multiple targets with a maintenance window using instance IDs The following register-target-with-maintenance-window example registers two instances with a maintenance window by specifying their instance IDs. 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" } Example 3: To register targets with a maintenance window using resource tags The following register-target-with-maintenance-window example registers instances with a maintenance window by specifying resource tags that have been applied to the instances. aws ssm register-target-with-maintenance-window \ --window-id "mw-06cf17cbefcb4bf4f" \ Actions 2806 AWS Systems Manager User Guide --targets "Key=tag:Environment,Values=Prod" "Key=Role,Values=Web" \ --owner-information "Production Web Servers" \ --resource-type
systems-manager-ug-795
systems-manager-ug.pdf
795
window using instance IDs The following register-target-with-maintenance-window example registers two instances with a maintenance window by specifying their instance IDs. 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" } Example 3: To register targets with a maintenance window using resource tags The following register-target-with-maintenance-window example registers instances with a maintenance window by specifying resource tags that have been applied to the instances. aws ssm register-target-with-maintenance-window \ --window-id "mw-06cf17cbefcb4bf4f" \ Actions 2806 AWS Systems Manager User Guide --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" } Example 4: To register targets using a group of tag keys The following register-target-with-maintenance-window example register instances that all have one or more tag keys assigned to them, regardless of their key values. 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" } Example 5: To register targets using a resource group name The following register-target-with-maintenance-window example register a specified resource group, regardless of the type of resources it contains. 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" Actions 2807 AWS Systems Manager } User Guide For more information, see Register a Target Instance with the Maintenance Window (AWS CLI) in the AWS Systems Manager User Guide. • For API details, see RegisterTargetWithMaintenanceWindow in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This example registers an instance with a maintenance window. $option1 = @{Key="InstanceIds";Values=@("i-0000293ffd8c57862")} Register-SSMTargetWithMaintenanceWindow -WindowId "mw-06cf17cbefcb4bf4f" -Target $option1 -OwnerInformation "Single instance" -ResourceType "INSTANCE" Output: d8e47760-23ed-46a5-9f28-927337725398 Example 2: This example registers multiple instances with a maintenance window. $option1 = @{Key="InstanceIds";Values=@("i-0000293ffd8c57862","i-0cb2b964d3e14fd9f")} Register-SSMTargetWithMaintenanceWindow -WindowId "mw-06cf17cbefcb4bf4f" -Target $option1 -OwnerInformation "Single instance" -ResourceType "INSTANCE" Output: 6ab5c208-9fc4-4697-84b7-b02a6cc25f7d Example 3: This example registers an instance with a maintenance window using EC2 tags. $option1 = @{Key="tag:Environment";Values=@("Production")} Register-SSMTargetWithMaintenanceWindow -WindowId "mw-06cf17cbefcb4bf4f" -Target $option1 -OwnerInformation "Production Web Servers" -ResourceType "INSTANCE" Actions 2808 AWS Systems Manager Output: 2994977e-aefb-4a71-beac-df620352f184 User Guide • For API details, see RegisterTargetWithMaintenanceWindow in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use RegisterTaskWithMaintenanceWindow with a CLI The following code examples show how to use RegisterTaskWithMaintenanceWindow. CLI AWS CLI Example 1: To register an Automation task with a maintenance window The following register-task-with-maintenance-window example registers an Automation task with a maintenance window that is targeted at an 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: { Actions 2809 AWS Systems Manager User Guide "WindowTaskId":"11144444-5555-6666-7777-88888888" } For more information, see Register a Task with the Maintenance Window (AWS CLI) in the AWS Systems Manager User Guide. Example 2: To register a Lambda task with a Maintenance Window The following register-task-with-maintenance-window example registers a Lambda task with a Maintenance Window that is targeted at an 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" } For more information, see Register a Task with the Maintenance Window (AWS CLI) in the AWS Systems Manager User Guide. Example 3: To register a Run Command task with a maintenance window The following register-task-with-maintenance-window example registers a Run Command task with a maintenance window that is targeted at an instance. aws ssm register-task-with-maintenance-window \ Actions 2810 AWS Systems Manager User Guide --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" } For more information, see Register a Task with the Maintenance Window (AWS CLI) in the AWS Systems Manager User Guide. Example 4: To register a Step Functions task with a maintenance window The following register-task-with-maintenance-window example registers a Step Functions task with a maintenance window that is targeted at an 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" \ Actions 2811 AWS Systems Manager User Guide --description "My Step Functions Example" Output: { "WindowTaskId":"44444444-5555-6666-7777-88888888" } For more information, see Register a Task with the Maintenance Window (AWS CLI) in the AWS Systems Manager User Guide. Example 5: To register a task using a maintenance windows target ID
systems-manager-ug-796
systems-manager-ug.pdf
796
example registers a Step Functions task with a maintenance window that is targeted at an 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" \ Actions 2811 AWS Systems Manager User Guide --description "My Step Functions Example" Output: { "WindowTaskId":"44444444-5555-6666-7777-88888888" } For more information, see Register a Task with the Maintenance Window (AWS CLI) in the AWS Systems Manager User Guide. Example 5: To register a task using a maintenance windows target ID The following register-task-with-maintenance-window example registers a task using a maintenance window target ID. The maintenance window target ID was in the output of the aws ssm register-target-with-maintenance-window command. You can also retrieve it from the output of the aws ssm describe-maintenance-window- targets command. 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" } For more information, see Register a Task with the Maintenance Window (AWS CLI) in the AWS Systems Manager User Guide. • For API details, see RegisterTaskWithMaintenanceWindow in AWS CLI Command Reference. Actions 2812 AWS Systems Manager PowerShell Tools for PowerShell User Guide Example 1: This example registers a task with a maintenance window using an instance ID. The output is the Task ID. $parameters = @{} $parameterValues = New-Object Amazon.SimpleSystemsManagement.Model.MaintenanceWindowTaskParameterValueExpression $parameterValues.Values = @("Install") $parameters.Add("Operation", $parameterValues) Register-SSMTaskWithMaintenanceWindow -WindowId "mw-03a342e62c96d31b0" -ServiceRoleArn "arn:aws:iam::123456789012:role/MaintenanceWindowsRole" -MaxConcurrency 1 -MaxError 1 -TaskArn "AWS-RunShellScript" -Target @{ Key="InstanceIds";Values="i-0000293ffd8c57862" } -TaskType "RUN_COMMAND" - Priority 10 -TaskParameter $parameters Output: f34a2c47-ddfd-4c85-a88d-72366b69af1b Example 2: This example registers a task with a maintenance window using a target ID. The output is the Task ID. $parameters = @{} $parameterValues = New-Object Amazon.SimpleSystemsManagement.Model.MaintenanceWindowTaskParameterValueExpression $parameterValues.Values = @("Install") $parameters.Add("Operation", $parameterValues) register-ssmtaskwithmaintenancewindow -WindowId "mw-03a342e62c96d31b0" -ServiceRoleArn "arn:aws:iam::123456789012:role/MaintenanceWindowsRole" -MaxConcurrency 1 -MaxError 1 -TaskArn "AWS-RunShellScript" -Target @{ Key="WindowTargetIds";Values="350d44e6-28cc-44e2-951f-4b2c985838f6" } - TaskType "RUN_COMMAND" -Priority 10 -TaskParameter $parameters Output: f34a2c47-ddfd-4c85-a88d-72366b69af1b Actions 2813 AWS Systems Manager User Guide Example 3: This example creates a parameter object for the run command document AWS-RunPowerShellScript and creates a task with given maintenance window using target ID. The return output is the task ID. $parameters = [Collections.Generic.Dictionary[String,Collections.Generic.List[String]]]::new() $parameters.Add("commands",@("ipconfig","dir env:\computername")) $parameters.Add("executionTimeout",@(3600)) $props = @{ WindowId = "mw-0123e4cce56ff78ae" ServiceRoleArn = "arn:aws:iam::123456789012:role/MaintenanceWindowsRole" MaxConcurrency = 1 MaxError = 1 TaskType = "RUN_COMMAND" TaskArn = "AWS-RunPowerShellScript" Target = @{Key="WindowTargetIds";Values="fe1234ea-56d7-890b-12f3-456b789bee0f"} Priority = 1 RunCommand_Parameter = $parameters Name = "set-via-cmdlet" } Register-SSMTaskWithMaintenanceWindow @props Output: f1e2ef34-5678-12e3-456a-12334c5c6cbe Example 4: This example registers an AWS Systems Manager Automation task by using a document named Create-Snapshots. $automationParameters = @{} $automationParameters.Add( "instanceId", @("{{ TARGET_ID }}") ) $automationParameters.Add( "AutomationAssumeRole", @("{arn:aws:iam::111111111111:role/AutomationRole}") ) $automationParameters.Add( "SnapshotTimeout", @("PT20M") ) Register-SSMTaskWithMaintenanceWindow -WindowId mw-123EXAMPLE456` -ServiceRoleArn "arn:aws:iam::123456789012:role/MW-Role"` -MaxConcurrency 1 -MaxError 1 -TaskArn "CreateVolumeSnapshots"` -Target @{ Key="WindowTargetIds";Values="4b5acdf4-946c-4355- bd68-4329a43a5fd1" }` Actions 2814 AWS Systems Manager User Guide -TaskType "AUTOMATION"` -Priority 4` -Automation_DocumentVersion '$DEFAULT' -Automation_Parameter $automationParameters -Name "Create-Snapshots" • For API details, see RegisterTaskWithMaintenanceWindow in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use RemoveTagsFromResource with a CLI The following code examples show how to use RemoveTagsFromResource. CLI AWS CLI To remove a tag from a patch baseline The following remove-tags-from-resource example removes tags from a patch baseline. aws ssm remove-tags-from-resource \ --resource-type "PatchBaseline" \ --resource-id "pb-0123456789abcdef0" \ --tag-keys "Region" This command produces no output. For more information, see Tagging AWS Resources in the AWS General Reference. • For API details, see RemoveTagsFromResource in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This example removes a tag from a maintenance window. There is no output if the command succeeds. Actions 2815 AWS Systems Manager User Guide Remove-SSMResourceTag -ResourceId "mw-03eb9db42890fb82d" -ResourceType "MaintenanceWindow" -TagKey "Production" • For API details, see RemoveTagsFromResource in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use SendCommand with an AWS SDK or CLI The following code examples show how to use SendCommand. Action examples are code excerpts from larger programs and must be run in context. You can see this action in context in the following code example: • Learn the basics CLI AWS CLI Example 1: To run a command on one or more remote instances The following send-command example runs an echo command on a target instance. 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", Actions 2816 AWS Systems Manager User Guide
systems-manager-ug-797
systems-manager-ug.pdf
797
examples show how to use SendCommand. Action examples are code excerpts from larger programs and must be run in context. You can see this action in context in the following code example: • Learn the basics CLI AWS CLI Example 1: To run a command on one or more remote instances The following send-command example runs an echo command on a target instance. 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", Actions 2816 AWS Systems Manager User Guide "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 } } } For more information, see Running Commands Using Systems Manager Run Command in the AWS Systems Manager User Guide. Examle 2: To get IP information about an instance The following send-command example retrieves the IP information about an instance. aws ssm send-command \ --instance-ids "i-1234567890abcdef0" \ Actions 2817 AWS Systems Manager User Guide --document-name "AWS-RunShellScript" \ --comment "IP config" \ --parameters "commands=ifconfig" See example 1 for sample output. For more information, see Running Commands Using Systems Manager Run Command in the AWS Systems Manager User Guide. Example 3: To run a command on instances with specific tags The following send-command example runs a command on instances that have the tag key "ENV" and the value "Dev". aws ssm send-command \ --targets "Key=tag:ENV,Values=Dev" \ --document-name "AWS-RunShellScript" \ --parameters "commands=ifconfig" See example 1 for sample output. For more information, see Running Commands Using Systems Manager Run Command in the AWS Systems Manager User Guide. Example 4: To run a command that sends SNS notifications The following send-command example runs a command that sends SNS notifications for all notification events and the Command notification type. 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" See example 1 for sample output. For more information, see Running Commands Using Systems Manager Run Command in the AWS Systems Manager User Guide. Actions 2818 AWS Systems Manager User Guide Example 5: To run a command that outputs to S3 and CloudWatch The following send-command example runs a command that outputs command details to an S3 bucket and to a CloudWatch Logs log group. 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" See example 1 for sample output. For more information, see Running Commands Using Systems Manager Run Command in the AWS Systems Manager User Guide. Example 6: To run commands on multiple instances with different tags The following send-command example runs a command on instances with two different tag keys and values. aws ssm send-command \ --document-name "AWS-RunPowerShellScript" \ --parameters commands=["echo helloWorld"] \ --targets Key=tag:Env,Values=Dev Key=tag:Role,Values=WebServers See example 1 for sample output. For more information, see Running Commands Using Systems Manager Run Command in the AWS Systems Manager User Guide. Example 7: To target multiple instances with the same tag key The following send-command example runs a command on instances that have the same tag key but with different values. aws ssm send-command \ --document-name "AWS-RunPowerShellScript" \ --parameters commands=["echo helloWorld"] \ Actions 2819 AWS Systems Manager User Guide --targets Key=tag:Env,Values=Dev,Test See example 1 for sample output. For more information, see Running Commands Using Systems Manager Run Command in the AWS Systems Manager User Guide. Example 8: To run a command that uses a shared document The following send-command example runs a shared document on a target instance. aws ssm send-command \ --document-name "arn:aws:ssm:us-east-1:123456789012:document/ExampleDocument" \ --targets "Key=instanceids,Values=i-1234567890abcdef0" See example 1 for sample output. For more information, see Using shared SSM documents in the AWS Systems Manager User Guide. • For API details, see SendCommand in AWS CLI Command Reference. Java SDK for Java 2.x Note There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository. /** * Sends a SSM command to a managed node asynchronously. * * @param documentName The name of the document to use. * @param instanceId The ID of the instance to send the command to. * @return The command ID. * <p> * This method initiates asynchronous requests to send a SSM command to a managed node. Actions 2820 AWS Systems Manager User Guide * It waits until the document is active, sends the command, and checks the command execution status. */ public String sendSSMCommand(String documentName, String instanceId) throws InterruptedException, SsmException {
systems-manager-ug-798
systems-manager-ug.pdf
798
and run in the AWS Code Examples Repository. /** * Sends a SSM command to a managed node asynchronously. * * @param documentName The name of the document to use. * @param instanceId The ID of the instance to send the command to. * @return The command ID. * <p> * This method initiates asynchronous requests to send a SSM command to a managed node. Actions 2820 AWS Systems Manager User Guide * It waits until the document is active, sends the command, and checks the command execution status. */ public String sendSSMCommand(String documentName, String instanceId) throws InterruptedException, SsmException { // Before we use Document to send a command - make sure it is active. CompletableFuture<Void> documentActiveFuture = CompletableFuture.runAsync(() -> { boolean isDocumentActive = false; DescribeDocumentRequest request = DescribeDocumentRequest.builder() .name(documentName) .build(); while (!isDocumentActive) { CompletableFuture<DescribeDocumentResponse> response = getAsyncClient().describeDocument(request); String documentStatus = response.join().document().statusAsString(); if (documentStatus.equals("Active")) { System.out.println("The SSM document is active and ready to use."); isDocumentActive = true; } else { System.out.println("The SSM document is not active. Status: " + documentStatus); try { Thread.sleep(5000); } catch (InterruptedException e) { throw new RuntimeException(e); } } } }); documentActiveFuture.join(); // Create the SendCommandRequest. SendCommandRequest commandRequest = SendCommandRequest.builder() .documentName(documentName) .instanceIds(instanceId) .build(); // Send the command. Actions 2821 AWS Systems Manager User Guide CompletableFuture<SendCommandResponse> commandFuture = getAsyncClient().sendCommand(commandRequest); final String[] commandId = {null}; commandFuture.whenComplete((commandResponse, ex) -> { if (commandResponse != null) { commandId[0] = commandResponse.command().commandId(); System.out.println("Command ID: " + commandId[0]); // Wait for the command execution to complete. GetCommandInvocationRequest invocationRequest = GetCommandInvocationRequest.builder() .commandId(commandId[0]) .instanceId(instanceId) .build(); try { System.out.println("Wait 5 secs"); TimeUnit.SECONDS.sleep(5); // Retrieve the command execution details. CompletableFuture<GetCommandInvocationResponse> invocationFuture = getAsyncClient().getCommandInvocation(invocationRequest); invocationFuture.whenComplete((commandInvocationResponse, invocationEx) -> { if (commandInvocationResponse != null) { // Check the status of the command execution. CommandInvocationStatus status = commandInvocationResponse.status(); if (status == CommandInvocationStatus.SUCCESS) { System.out.println("Command execution successful"); } else { System.out.println("Command execution failed. Status: " + status); } } else { Throwable invocationCause = (invocationEx instanceof CompletionException) ? invocationEx.getCause() : invocationEx; throw new CompletionException(invocationCause); } }).join(); } catch (InterruptedException e) { throw new RuntimeException(e); Actions 2822 AWS Systems Manager } User Guide } else { Throwable cause = (ex instanceof CompletionException) ? ex.getCause() : ex; if (cause instanceof SsmException) { throw (SsmException) cause; } else { throw new RuntimeException(cause); } } }).join(); return commandId[0]; } • For API details, see SendCommand in AWS SDK for Java 2.x API Reference. JavaScript SDK for JavaScript (v3) Note There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository. import { SendCommandCommand, SSMClient } from "@aws-sdk/client-ssm"; import { parseArgs } from "node:util"; /** * Send an SSM command to a managed node. * @param {{ documentName: string }} */ export const main = async ({ documentName }) => { const client = new SSMClient({}); try { await client.send( new SendCommandCommand({ DocumentName: documentName, }), Actions 2823 AWS Systems Manager ); User Guide console.log("Command sent successfully."); return { Success: true }; } catch (caught) { if (caught instanceof Error && caught.name === "ValidationError") { console.warn(`${caught.message}. Did you provide a valid document name?`); } else { throw caught; } } }; • For API details, see SendCommand in AWS SDK for JavaScript API Reference. PowerShell Tools for PowerShell Example 1: This example runs an echo command on a target instance. Send-SSMCommand -DocumentName "AWS-RunPowerShellScript" -Parameter @{commands = "echo helloWorld"} -Target @{Key="instanceids";Values=@("i-0cb2b964d3e14fd9f")} Output: CommandId : d8d190fc-32c1-4d65-a0df-ff5ff3965524 Comment : CompletedCount : 0 DocumentName : AWS-RunPowerShellScript ErrorCount : 0 ExpiresAfter : 3/7/2017 10:48:37 PM InstanceIds : {} MaxConcurrency : 50 MaxErrors : 0 NotificationConfig : Amazon.SimpleSystemsManagement.Model.NotificationConfig OutputS3BucketName : OutputS3KeyPrefix : OutputS3Region : Parameters : {[commands, Amazon.Runtime.Internal.Util.AlwaysSendList`1[System.String]]} RequestedDateTime : 3/7/2017 9:48:37 PM Actions 2824 AWS Systems Manager User Guide ServiceRole : Status : Pending StatusDetails : Pending TargetCount : 0 Targets : {instanceids} Example 2: This example shows how to run a command that accepts nested parameters. Send-SSMCommand -DocumentName "AWS-RunRemoteScript" -Parameter @{ sourceType="GitHub";sourceInfo='{"owner": "me","repository": "amazon- ssm","path": "Examples/Install-Win32OpenSSH"}'; "commandLine"=".\Install- Win32OpenSSH.ps1"} -InstanceId i-0cb2b964d3e14fd9f • For API details, see SendCommand in AWS Tools for PowerShell Cmdlet Reference. Python SDK for Python (Boto3) Note There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository. class DocumentWrapper: """Encapsulates AWS Systems Manager Document actions.""" def __init__(self, ssm_client): """ :param ssm_client: A Boto3 Systems Manager client. """ self.ssm_client = ssm_client self.name = None @classmethod def from_client(cls): ssm_client = boto3.client("ssm") return cls(ssm_client) Actions 2825 AWS Systems Manager User Guide def send_command(self, instance_ids): """ Sends a command to one or more instances. :param instance_ids: The IDs of the instances to send the command to. :return: The ID of the command. """ try: response = self.ssm_client.send_command( InstanceIds=instance_ids, DocumentName=self.name, TimeoutSeconds=3600 ) return response["Command"]["CommandId"] except ClientError as err: logger.error( "Couldn't send command to %s. Here's why: %s: %s", self.name, err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise • For API details, see SendCommand in AWS SDK for
systems-manager-ug-799
systems-manager-ug.pdf
799
""" :param ssm_client: A Boto3 Systems Manager client. """ self.ssm_client = ssm_client self.name = None @classmethod def from_client(cls): ssm_client = boto3.client("ssm") return cls(ssm_client) Actions 2825 AWS Systems Manager User Guide def send_command(self, instance_ids): """ Sends a command to one or more instances. :param instance_ids: The IDs of the instances to send the command to. :return: The ID of the command. """ try: response = self.ssm_client.send_command( InstanceIds=instance_ids, DocumentName=self.name, TimeoutSeconds=3600 ) return response["Command"]["CommandId"] except ClientError as err: logger.error( "Couldn't send command to %s. Here's why: %s: %s", self.name, err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise • For API details, see SendCommand in AWS SDK for Python (Boto3) API Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use StartAutomationExecution with a CLI The following code examples show how to use StartAutomationExecution. CLI AWS CLI Example 1: To execute an automation document The following start-automation-execution example runs an Automation document. aws ssm start-automation-execution \ Actions 2826 AWS Systems Manager User Guide --document-name "AWS-UpdateLinuxAmi" \ --parameters "AutomationAssumeRole=arn:aws:iam::123456789012:role/ SSMAutomationRole,SourceAmiId=ami-EXAMPLE,IamInstanceProfileName=EC2InstanceRole" Output: { "AutomationExecutionId": "4105a4fc-f944-11e6-9d32-0a1b2EXAMPLE" } For more information, see Running an Automation Workflow Manually in the AWS Systems Manager User Guide. Example 2: To run a shared automation document The following start-automation-execution example runs a shared Automation document. aws ssm start-automation-execution \ --document-name "arn:aws:ssm:us-east-1:123456789012:document/ExampleDocument" Output: { "AutomationExecutionId": "4105a4fc-f944-11e6-9d32-0a1b2EXAMPLE" } For more information, see Using shared SSM documents in the AWS Systems Manager User Guide. • For API details, see StartAutomationExecution in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This example runs a document specifying an Automation role, an AMI source ID, and an Amazon EC2 instance role. Start-SSMAutomationExecution -DocumentName AWS-UpdateLinuxAmi - Parameter @{'AutomationAssumeRole'='arn:aws:iam::123456789012:role/ Actions 2827 AWS Systems Manager User Guide SSMAutomationRole';'SourceAmiId'='ami- f173cc91';'InstanceIamRole'='EC2InstanceRole'} Output: 3a532a4f-0382-11e7-9df7-6f11185f6dd1 • For API details, see StartAutomationExecution in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use StartSession with a CLI The following code examples show how to use StartSession. CLI AWS CLI Example 1: To start a Session Manager session This start-session example establishes a connection with an instance for a Session Manager session. Note that this interactive command requires the Session Manager plugin to be installed on the client machine making the call. aws ssm start-session \ --target "i-1234567890abcdef0" Output: Starting session with SessionId: Jane-Roe-07a16060613c408b5 Example 2: To start a Session Manager session using SSH This start-session example establishes a connection with an instance for a Session Manager session using SSH. Note that this interactive command requires the Session Manager plugin to be installed on the client machine making the call, and that the Actions 2828 AWS Systems Manager User Guide command uses the default user on the instance, such as ec2-user for EC2 instances for Linux. ssh -i /path/my-key-pair.pem ec2-user@i-02573cafcfEXAMPLE Output: Starting session with SessionId: ec2-user-07a16060613c408b5 For more information, see Start a Session and Install the Session Manager Plugin for the AWS CLI in the AWS Systems Manager User Guide. • For API details, see StartSession in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This example initiates a connection to a target for a Session Manager session, enabling port forwarding. Start-SSMSession -Target 'i-064578e5e7454488f' -DocumentName 'AWS- StartPortForwardingSession' -Parameter @{ localPortNumber = '8080'; portNumber = '80' } Output: SessionId StreamUrl ---------- ---------- random-id0 wss://ssmmessages.amazonaws.com/v1/data-channel/random-id • For API details, see StartSession in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use StopAutomationExecution with a CLI The following code examples show how to use StopAutomationExecution. Actions 2829 AWS Systems Manager CLI AWS CLI User Guide To stop an automation execution The following stop-automation-execution example stops an Automation document. aws ssm stop-automation-execution --automation-execution-id "4105a4fc-f944-11e6-9d32-0a1b2EXAMPLE" This command produces no output. For more information, see Running an Automation Workflow Manually in the AWS Systems Manager User Guide. • For API details, see StopAutomationExecution in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This example stops an Automation Execution. There is no output if the command succeeds. Stop-SSMAutomationExecution -AutomationExecutionId "4105a4fc- f944-11e6-9d32-8fb2db27a909" • For API details, see StopAutomationExecution in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use UpdateAssociation with a CLI The following code examples show how to use UpdateAssociation. Actions 2830 AWS Systems Manager CLI AWS CLI User Guide Example
systems-manager-ug-800
systems-manager-ug.pdf
800
AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This example stops an Automation Execution. There is no output if the command succeeds. Stop-SSMAutomationExecution -AutomationExecutionId "4105a4fc- f944-11e6-9d32-8fb2db27a909" • For API details, see StopAutomationExecution in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use UpdateAssociation with a CLI The following code examples show how to use UpdateAssociation. Actions 2830 AWS Systems Manager CLI AWS CLI User Guide Example 1: To update a document association The following update-association example updates an association with a new document version. 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 } } For more information, see Editing and creating a new version of an association in the AWS Systems Manager User Guide. Actions 2831 AWS Systems Manager User Guide Example 2: To update the schedule expression of an association The following update-association example updates the schedule expression for the specified association. 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 } } For more information, see Editing and creating a new version of an association in the AWS Systems Manager User Guide. • For API details, see UpdateAssociation in AWS CLI Command Reference. Actions 2832 AWS Systems Manager PowerShell Tools for PowerShell User Guide Example 1: This example updates an association with a new document version. Update-SSMAssociation -AssociationId "93285663-92df-44cb-9f26-2292d4ecc439" - DocumentVersion "1" Output: Name : AWS-UpdateSSMAgent InstanceId : Date : 3/1/2017 6:22:21 PM Status.Name : Status.Date : Status.Message : Status.AdditionalInfo : • For API details, see UpdateAssociation in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use UpdateAssociationStatus with a CLI The following code examples show how to use UpdateAssociationStatus. CLI AWS CLI To update the association status The following update-association-status example updates the association status of the association between an instance and a document. aws ssm update-association-status \ --name "AWS-UpdateSSMAgent" \ Actions 2833 AWS Systems Manager User Guide --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 } } For more information, see Working with associations in Systems Manager in the AWS Systems Manager User Guide. Actions 2834 AWS Systems Manager User Guide • For API details, see UpdateAssociationStatus in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This example updates the association status of the association between an instance and a configuration document. Update-SSMAssociationStatus -Name "AWS-UpdateSSMAgent" -InstanceId "i-0000293ffd8c57862" -AssociationStatus_Date "2015-02-20T08:31:11Z" -AssociationStatus_Name "Pending" -AssociationStatus_Message "temporary_status_change" -AssociationStatus_AdditionalInfo "Additional-Config- Needed" Output: Name : AWS-UpdateSSMAgent InstanceId : i-0000293ffd8c57862 Date : 2/23/2017 6:55:22 PM Status.Name : Pending Status.Date : 2/20/2015 8:31:11 AM Status.Message : temporary_status_change Status.AdditionalInfo : Additional-Config-Needed • For API details, see UpdateAssociationStatus in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use UpdateDocument with a CLI The following code examples show how to use UpdateDocument. CLI AWS CLI To create a new version of a document Actions 2835 AWS Systems Manager User Guide The following update-document example creates a new version of a document when run on a Windows computer. The document specified by --document must be in JSON format. Note that file:// must be referenced followed by the path of the content file. Because of the $ at the beginning of the --document-version parameter, On Windows you must surround the value with double quotes. On Linux, MacOS, or at a PowerShell prompt, you must surround the value with single quotes. Windows version: aws ssm update-document \ --name "RunShellScript" \ --content "file://RunShellScript.json" \ --document-version "$LATEST" Linux/Mac version: aws ssm update-document \ --name "RunShellScript" \ --content "file://RunShellScript.json"
systems-manager-ug-801
systems-manager-ug.pdf
801
example creates a new version of a document when run on a Windows computer. The document specified by --document must be in JSON format. Note that file:// must be referenced followed by the path of the content file. Because of the $ at the beginning of the --document-version parameter, On Windows you must surround the value with double quotes. On Linux, MacOS, or at a PowerShell prompt, you must surround the value with single quotes. Windows version: aws ssm update-document \ --name "RunShellScript" \ --content "file://RunShellScript.json" \ --document-version "$LATEST" Linux/Mac version: 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", Actions 2836 AWS Systems Manager User Guide "CreatedDate": 1487899655.152, "Owner": "809632081692", "SchemaVersion": "2.0", "DefaultVersion": "1", "LatestVersion": "2", "Description": "Run an updated script" } } • For API details, see UpdateDocument in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This creates a new version of a document with the updated contents of the json file you specify. The document must be in JSON format. You can obtain the document version with the "Get-SSMDocumentVersionList" cmdlet. Update-SSMDocument -Name RunShellScript -DocumentVersion "1" -Content (Get- Content -Raw "c:\temp\RunShellScript.json") Output: CreatedDate : 3/1/2017 2:59:17 AM DefaultVersion : 1 Description : Run an updated script DocumentType : Command DocumentVersion : 2 Hash : 1d5ce820e999ff051eb4841ed887593daf77120fd76cae0d18a53cc42e4e22c1 HashType : Sha256 LatestVersion : 2 Name : RunShellScript Owner : 809632081692 Parameters : {commands} PlatformTypes : {Linux} SchemaVersion : 2.0 Sha1 : Status : Updating • For API details, see UpdateDocument in AWS Tools for PowerShell Cmdlet Reference. Actions 2837 AWS Systems Manager User Guide For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use UpdateDocumentDefaultVersion with a CLI The following code examples show how to use UpdateDocumentDefaultVersion. CLI AWS CLI To update the default version of a document The following update-document-default-version example updates the default version of a Systems Manager document. aws ssm update-document-default-version \ --name "Example" \ --document-version "2" Output: { "Description": { "Name": "Example", "DefaultVersion": "2" } } For more information, see Writing SSM Document Content in the AWS Systems Manager User Guide. • For API details, see UpdateDocumentDefaultVersion in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This updates the default version of a document. You can obtain the available document versions with the "Get-SSMDocumentVersionList" cmdlet. Actions 2838 AWS Systems Manager User Guide Update-SSMDocumentDefaultVersion -Name "RunShellScript" -DocumentVersion "2" Output: DefaultVersion Name -------------- ---- 2 RunShellScript • For API details, see UpdateDocumentDefaultVersion in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use UpdateMaintenanceWindow with an AWS SDK or CLI The following code examples show how to use UpdateMaintenanceWindow. CLI AWS CLI Example 1: To update a maintenance window The following update-maintenance-window example updates the name of a maintenance window. 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, Actions 2839 AWS Systems Manager User Guide "AllowUnassociatedTargets": true, "WindowId": "mw-1a2b3c4d5e6f7g8h9", "Duration": 4 } Example 2: To disable a maintenance window The following update-maintenance-window example disables a maintenance window. aws ssm update-maintenance-window \ --window-id "mw-1a2b3c4d5e6f7g8h9" \ --no-enabled Example 3: To enable a maintenance window The following update-maintenance-window example enables a maintenance window. aws ssm update-maintenance-window \ --window-id "mw-1a2b3c4d5e6f7g8h9" \ --enabled For more information, see Update a Maintenance Window (AWS CLI) in the AWS Systems Manager User Guide. • For API details, see UpdateMaintenanceWindow in AWS CLI Command Reference. Java SDK for Java 2.x Note There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository. /** * Updates an SSM maintenance window asynchronously. * Actions 2840 AWS Systems Manager User Guide * @param id The ID of the maintenance window to update. * @param name The new name for the maintenance window. * <p> * This method initiates an asynchronous request to update an SSM maintenance window. * If the request is successful, it prints a success message. * If an exception occurs, it handles the error appropriately. */ public void updateSSMMaintenanceWindow(String id, String name) throws SsmException { UpdateMaintenanceWindowRequest updateRequest = UpdateMaintenanceWindowRequest.builder() .windowId(id) .allowUnassociatedTargets(true) .duration(24) .enabled(true) .name(name) .schedule("cron(0 0 ? * MON *)") .build(); CompletableFuture<UpdateMaintenanceWindowResponse> future = getAsyncClient().updateMaintenanceWindow(updateRequest); future.whenComplete((response, ex) -> { if (response != null) { System.out.println("The SSM maintenance
systems-manager-ug-802
systems-manager-ug.pdf
802
Guide * @param id The ID of the maintenance window to update. * @param name The new name for the maintenance window. * <p> * This method initiates an asynchronous request to update an SSM maintenance window. * If the request is successful, it prints a success message. * If an exception occurs, it handles the error appropriately. */ public void updateSSMMaintenanceWindow(String id, String name) throws SsmException { UpdateMaintenanceWindowRequest updateRequest = UpdateMaintenanceWindowRequest.builder() .windowId(id) .allowUnassociatedTargets(true) .duration(24) .enabled(true) .name(name) .schedule("cron(0 0 ? * MON *)") .build(); CompletableFuture<UpdateMaintenanceWindowResponse> future = getAsyncClient().updateMaintenanceWindow(updateRequest); future.whenComplete((response, ex) -> { if (response != null) { System.out.println("The SSM maintenance window was successfully updated"); } else { Throwable cause = (ex instanceof CompletionException) ? ex.getCause() : ex; if (cause instanceof SsmException) { throw new CompletionException(cause); } else { throw new RuntimeException(cause); } } }).join(); } • For API details, see UpdateMaintenanceWindow in AWS SDK for Java 2.x API Reference. Actions 2841 AWS Systems Manager JavaScript SDK for JavaScript (v3) Note User Guide There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository. import { UpdateMaintenanceWindowCommand, SSMClient } from "@aws-sdk/client-ssm"; import { parseArgs } from "node:util"; /** * Update an SSM maintenance window. * @param {{ windowId: string, allowUnassociatedTargets?: boolean, duration?: number, enabled?: boolean, name?: string, schedule?: string }} */ export const main = async ({ windowId, allowUnassociatedTargets = undefined, //Allow the maintenance window to run on managed nodes, even if you haven't registered those nodes as targets. duration = undefined, //The duration of the maintenance window in hours. enabled = undefined, name = undefined, schedule = undefined, //The schedule of the maintenance window in the form of a cron or rate expression. }) => { const client = new SSMClient({}); try { const { opsItemArn, opsItemId } = await client.send( new UpdateMaintenanceWindowCommand({ WindowId: windowId, AllowUnassociatedTargets: allowUnassociatedTargets, Duration: duration, Enabled: enabled, Name: name, Schedule: schedule, }), ); console.log("Maintenance window updated."); return { OpsItemArn: opsItemArn, OpsItemId: opsItemId }; Actions 2842 AWS Systems Manager User Guide } catch (caught) { if (caught instanceof Error && caught.name === "ValidationError") { console.warn(`${caught.message}. Are these values correct?`); } else { throw caught; } } }; • For API details, see UpdateMaintenanceWindow in AWS SDK for JavaScript API Reference. PowerShell Tools for PowerShell Example 1: This example updates the name of a maintenance window. Update-SSMMaintenanceWindow -WindowId "mw-03eb9db42890fb82d" -Name "My-Renamed- MW" Output: AllowUnassociatedTargets : False Cutoff : 1 Duration : 2 Enabled : True Name : My-Renamed-MW Schedule : cron(0 */30 * * * ? *) WindowId : mw-03eb9db42890fb82d Example 2: This example enables a maintenance window. Update-SSMMaintenanceWindow -WindowId "mw-03eb9db42890fb82d" -Enabled $true Output: AllowUnassociatedTargets : False Cutoff : 1 Duration : 2 Enabled : True Actions 2843 AWS Systems Manager User Guide Name : My-Renamed-MW Schedule : cron(0 */30 * * * ? *) WindowId : mw-03eb9db42890fb82d Example 3: This example disables a maintenance window. Update-SSMMaintenanceWindow -WindowId "mw-03eb9db42890fb82d" -Enabled $false Output: AllowUnassociatedTargets : False Cutoff : 1 Duration : 2 Enabled : False Name : My-Renamed-MW Schedule : cron(0 */30 * * * ? *) WindowId : mw-03eb9db42890fb82d • For API details, see UpdateMaintenanceWindow in AWS Tools for PowerShell Cmdlet Reference. Python SDK for Python (Boto3) Note There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository. class MaintenanceWindowWrapper: """Encapsulates AWS Systems Manager maintenance window actions.""" def __init__(self, ssm_client): """ :param ssm_client: A Boto3 Systems Manager client. """ self.ssm_client = ssm_client self.window_id = None Actions 2844 AWS Systems Manager User Guide self.name = None @classmethod def from_client(cls): ssm_client = boto3.client("ssm") return cls(ssm_client) def update( self, name, enabled, schedule, duration, cutoff, allow_unassociated_targets ): """ Update an AWS Systems Manager maintenance window. :param name: The name of the maintenance window. :param enabled: Whether the maintenance window is enabled to run on managed nodes. :param schedule: The schedule of the maintenance window. :param duration: The duration of the maintenance window. :param cutoff: The cutoff time of the maintenance window. :param allow_unassociated_targets: Allow the maintenance window to run on managed nodes, even if you haven't registered those nodes as targets. """ try: self.ssm_client.update_maintenance_window( WindowId=self.window_id, Name=name, Enabled=enabled, Schedule=schedule, Duration=duration, Cutoff=cutoff, AllowUnassociatedTargets=allow_unassociated_targets, ) self.name = name logger.info("Updated maintenance window %s.", self.window_id) except ParamValidationError as error: logger.error( "Parameter validation error when trying to update maintenance window %s. Here's why: %s", self.window_id, error, Actions 2845 AWS Systems Manager User Guide ) raise except ClientError as err: logger.error( "Couldn't update maintenance window %s. Here's why: %s: %s", self.name, err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise • For API details, see UpdateMaintenanceWindow in AWS SDK for Python (Boto3) API Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use UpdateManagedInstanceRole with
systems-manager-ug-803
systems-manager-ug.pdf
803
self.window_id) except ParamValidationError as error: logger.error( "Parameter validation error when trying to update maintenance window %s. Here's why: %s", self.window_id, error, Actions 2845 AWS Systems Manager User Guide ) raise except ClientError as err: logger.error( "Couldn't update maintenance window %s. Here's why: %s: %s", self.name, err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise • For API details, see UpdateMaintenanceWindow in AWS SDK for Python (Boto3) API Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use UpdateManagedInstanceRole with a CLI The following code examples show how to use UpdateManagedInstanceRole. CLI AWS CLI To update the IAM role of a managed instance The following update-managed-instance-role example updates the IAM instance profile of a managed instance. aws ssm update-managed-instance-role \ --instance-id "mi-08ab247cdfEXAMPLE" \ --iam-role "ExampleRole" This command produces no output. For more information, see Step 4: Create an IAM Instance Profile for Systems Manager in the AWS Systems Manager User Guide. Actions 2846 AWS Systems Manager User Guide • For API details, see UpdateManagedInstanceRole in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This example updates the role of a managed instance. There is no output if the command succeeds. Update-SSMManagedInstanceRole -InstanceId "mi-08ab247cdf1046573" -IamRole "AutomationRole" • For API details, see UpdateManagedInstanceRole in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use UpdateOpsItem with an AWS SDK or CLI The following code examples show how to use UpdateOpsItem. Action examples are code excerpts from larger programs and must be run in context. You can see this action in context in the following code example: • Learn the basics CLI AWS CLI To update an OpsItem The following update-ops-item example updates the description, priority, and category for an OpsItem. In addition, the command specifies an SNS topic where the notifications are sent when this OpsItem is edited or changed. aws ssm update-ops-item \ --ops-item-id "oi-287b5EXAMPLE" \ Actions 2847 AWS Systems Manager User Guide --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. For more information, see Working with OpsItems in the AWS Systems Manager User Guide. • For API details, see UpdateOpsItem in AWS CLI Command Reference. Java SDK for Java 2.x Note There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository. /** * Resolves an AWS SSM OpsItem asynchronously. * * @param opsID The ID of the OpsItem to resolve. * <p> * This method initiates an asynchronous request to resolve an SSM OpsItem. * If an exception occurs, it handles the error appropriately. */ public void resolveOpsItem(String opsID) { UpdateOpsItemRequest opsItemRequest = UpdateOpsItemRequest.builder() .opsItemId(opsID) .status(OpsItemStatus.RESOLVED) .build(); CompletableFuture<Void> future = CompletableFuture.runAsync(() -> { getAsyncClient().updateOpsItem(opsItemRequest) .thenAccept(response -> { System.out.println("OpsItem resolved successfully."); }) Actions 2848 AWS Systems Manager User Guide .exceptionally(ex -> { throw new CompletionException(ex); }).join(); }).exceptionally(ex -> { Throwable cause = (ex instanceof CompletionException) ? ex.getCause() : ex; if (cause instanceof SsmException) { throw new RuntimeException("SSM error: " + cause.getMessage(), cause); } else { throw new RuntimeException("Unexpected error: " + cause.getMessage(), cause); } }); try { future.join(); } catch (CompletionException ex) { throw ex.getCause() instanceof RuntimeException ? (RuntimeException) ex.getCause() : ex; } } • For API details, see UpdateOpsItem in AWS SDK for Java 2.x API Reference. JavaScript SDK for JavaScript (v3) Note There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository. import { UpdateOpsItemCommand, SSMClient } from "@aws-sdk/client-ssm"; import { parseArgs } from "node:util"; /** * Update an SSM OpsItem. * @param {{ opsItemId: string, status?: OpsItemStatus }} Actions 2849 AWS Systems Manager */ export const main = async ({ opsItemId, User Guide status = undefined, // The OpsItem status. Status can be Open, In Progress, or Resolved }) => { const client = new SSMClient({}); try { await client.send( new UpdateOpsItemCommand({ OpsItemId: opsItemId, Status: status, }), ); console.log("Ops item updated."); return { Success: true }; } catch (caught) { if ( caught instanceof Error && caught.name === "OpsItemLimitExceededException" ) { console.warn( `Couldn't create ops item because you have exceeded your open OpsItem limit. ${caught.message}.`, ); } else { throw caught; } } }; • For API details, see UpdateOpsItem in AWS SDK for JavaScript API Reference. Python SDK for Python (Boto3) Note There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository. Actions 2850 AWS Systems Manager User Guide class OpsItemWrapper: """Encapsulates AWS Systems
systems-manager-ug-804
systems-manager-ug.pdf
804
); console.log("Ops item updated."); return { Success: true }; } catch (caught) { if ( caught instanceof Error && caught.name === "OpsItemLimitExceededException" ) { console.warn( `Couldn't create ops item because you have exceeded your open OpsItem limit. ${caught.message}.`, ); } else { throw caught; } } }; • For API details, see UpdateOpsItem in AWS SDK for JavaScript API Reference. Python SDK for Python (Boto3) Note There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository. Actions 2850 AWS Systems Manager User Guide class OpsItemWrapper: """Encapsulates AWS Systems Manager OpsItem actions.""" def __init__(self, ssm_client): """ :param ssm_client: A Boto3 Systems Manager client. """ self.ssm_client = ssm_client self.id = None @classmethod def from_client(cls): """ :return: A OpsItemWrapper instance. """ ssm_client = boto3.client("ssm") return cls(ssm_client) def update(self, title=None, description=None, status=None): """ Update an OpsItem. :param title: The new OpsItem title. :param description: The new OpsItem description. :param status: The new OpsItem status. :return: """ args = dict(OpsItemId=self.id) if title is not None: args["Title"] = title if description is not None: args["Description"] = description if status is not None: args["Status"] = status try: self.ssm_client.update_ops_item(**args) except ClientError as err: logger.error( "Couldn't update ops item %s. Here's why: %s: %s", self.id, err.response["Error"]["Code"], err.response["Error"]["Message"], Actions 2851 AWS Systems Manager User Guide ) raise • For API details, see UpdateOpsItem in AWS SDK for Python (Boto3) API Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Use UpdatePatchBaseline with a CLI The following code examples show how to use UpdatePatchBaseline. CLI AWS CLI Example 1: To update a patch baseline The following update-patch-baseline example adds the specified two patches as rejected and one patch as approved to the specified patch baseline. 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": [ { Actions 2852 AWS Systems Manager User Guide "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": [] } Example 2: To rename a patch baseline The following update-patch-baseline example renames the specified patch baseline. aws ssm update-patch-baseline \ --baseline-id "pb-0713accee01234567" \ --name "Windows-Server-2012-R2-Important-and-Critical-Security-Updates" For more information, see Update or Delete a Patch Baseline <https:// docs.aws.amazon.com/systems-manager/latest/userguide/patch-baseline-update-or- delete.html>`__ in the AWS Systems Manager User Guide. Actions 2853 AWS Systems Manager User Guide • For API details, see UpdatePatchBaseline in AWS CLI Command Reference. PowerShell Tools for PowerShell Example 1: This example adds two patches as rejected and one patch as approved to an existing patch baseline. Update-SSMPatchBaseline -BaselineId "pb-03da896ca3b68b639" -RejectedPatch "KB2032276","MS10-048" -ApprovedPatch "KB2124261" Output: ApprovalRules : Amazon.SimpleSystemsManagement.Model.PatchRuleGroup ApprovedPatches : {KB2124261} BaselineId : pb-03da896ca3b68b639 CreatedDate : 3/3/2017 5:02:19 PM Description : Baseline containing all updates approved for production systems GlobalFilters : Amazon.SimpleSystemsManagement.Model.PatchFilterGroup ModifiedDate : 3/3/2017 5:22:10 PM Name : Production-Baseline RejectedPatches : {KB2032276, MS10-048} • For API details, see UpdatePatchBaseline in AWS Tools for PowerShell Cmdlet Reference. For a complete list of AWS SDK developer guides and code examples, see Using this service with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions. Actions 2854 AWS Systems Manager User Guide Logging and monitoring in AWS Systems Manager Monitoring is an important part of maintaining the reliability, availability, and performance of AWS Systems Manager and your AWS solutions. You should collect monitoring data from all parts of your AWS solution so that you can debug a multipoint failure if one occurs. But before you start monitoring Systems Manager, create a monitoring plan that includes answers to the following questions: • What are your monitoring goals? • What resources will you monitor? • How often will you monitor these resources? • What monitoring tools will you use? • Who performs the monitoring tasks? • Who should be notified when something goes wrong? After you have defined your monitoring goals and have created your monitoring plan, the next step is to establish a baseline for normal Systems Manager performance in your environment. You should measure Systems Manager performance at various times and under different load conditions. As you monitor Systems Manager, you should store a history of monitoring data that you've collected. You can compare current Systems Manager performance to this historical data to help you to identify normal performance patterns and performance anomalies, and create methods to address them. For example, you can monitor the success or failure of operations such as Automation workflows, the
systems-manager-ug-805
systems-manager-ug.pdf
805
defined your monitoring goals and have created your monitoring plan, the next step is to establish a baseline for normal Systems Manager performance in your environment. You should measure Systems Manager performance at various times and under different load conditions. As you monitor Systems Manager, you should store a history of monitoring data that you've collected. You can compare current Systems Manager performance to this historical data to help you to identify normal performance patterns and performance anomalies, and create methods to address them. For example, you can monitor the success or failure of operations such as Automation workflows, the application of patch baselines, maintenance window events, and configuration compliance. Automation is a tool in AWS Systems Manager. You can also monitor CPU utilization, disk I/O, and network utilization of your managed nodes. When performance falls outside your established baseline, you might need to reconfigure or optimize the node to reduce CPU utilization, improve disk I/O, or reduce network traffic. For more information about monitoring EC2 instances, see Monitor Amazon EC2 in the Amazon EC2 User Guide. Topics • Monitoring tools • Sending node logs to unified CloudWatch Logs (CloudWatch agent) 2855 AWS Systems Manager User Guide • Sending SSM Agent logs to CloudWatch Logs • Monitoring your change request events • Monitoring your automations • Monitoring Run Command metrics using Amazon CloudWatch • Logging AWS Systems Manager API calls with AWS CloudTrail • Logging Automation action output with CloudWatch Logs • Configuring Amazon CloudWatch Logs for Run Command • Monitoring Systems Manager events with Amazon EventBridge • Monitoring Systems Manager status changes using Amazon SNS notifications Monitoring tools The content in this chapter provides information for using tools available for monitoring your Systems Manager and other AWS resources. For a more complete list of tools, see Logging and monitoring in AWS Systems Manager. Sending node logs to unified CloudWatch Logs (CloudWatch agent) You can configure and use the Amazon CloudWatch agent to collect metrics and logs from your nodes instead of using AWS Systems Manager Agent (SSM Agent) for these tasks. The CloudWatch agent allows you to gather more metrics on EC2 instances than are available using SSM Agent. In addition, you can gather metrics from on-premises servers using the CloudWatch agent. You can also store agent configuration settings in the Systems Manager Parameter Store for use with the CloudWatch agent. Parameter Store is a tool in AWS Systems Manager. Note AWS Systems Manager supports migrating from SSM Agent to the unified CloudWatch agent for collecting logs and metrics on 64-bit versions of Windows only. For information about setting up the unified CloudWatch agent on other operating systems, and for complete information about using the CloudWatch agent, see Collecting metrics and logs from Amazon EC2 instances and on-premises servers with the CloudWatch agent in the Amazon CloudWatch User Guide. Monitoring tools 2856 AWS Systems Manager User Guide You can use the CloudWatch agent on other supported operating systems, but you won't be able to use Systems Manager to perform a tool migration. SSM Agent writes information about executions, scheduled actions, errors, and health statuses to log files on each node. Manually connecting to a node to view log files and troubleshoot an issue with SSM Agent is time-consuming. For more efficient node monitoring, you can configure either SSM Agent itself or the CloudWatch agent to send this log data to Amazon CloudWatch Logs. Important The unified CloudWatch agent has replaced SSM Agent as the tool for sending log data to Amazon CloudWatch Logs. The SSM Agent aws:cloudWatch plugin is not supported. We recommend using only the unified CloudWatch agent for your log collection processes. For more information, see the following topics: • Sending node logs to unified CloudWatch Logs (CloudWatch agent) • Migrate Windows Server node log collection to the CloudWatch agent • Collecting metrics, logs, and traces with the CloudWatch agent in the Amazon CloudWatch User Guide. Using CloudWatch Logs, you can monitor log data in real time, search and filter log data by creating one or more metric filters, and archive and retrieve historical data when you need it. For more information about CloudWatch Logs, see the Amazon CloudWatch Logs User Guide. Configuring an agent to send log data to Amazon CloudWatch Logs provides the following benefits: • Centralized log file storage for all SSM Agent log files. • Quicker access to files to investigate errors. • Indefinite log file retention (configurable). • Logs can be maintained and accessed regardless of the status of the node. • Access to other CloudWatch features such as metrics and alarms. For information about monitoring Session Manager activity, see Logging session activity and Enabling and disabling session logging. Sending node logs to unified CloudWatch Logs (CloudWatch agent) 2857 AWS Systems Manager User Guide Migrate Windows Server node log collection to the
systems-manager-ug-806
systems-manager-ug.pdf
806
log data to Amazon CloudWatch Logs provides the following benefits: • Centralized log file storage for all SSM Agent log files. • Quicker access to files to investigate errors. • Indefinite log file retention (configurable). • Logs can be maintained and accessed regardless of the status of the node. • Access to other CloudWatch features such as metrics and alarms. For information about monitoring Session Manager activity, see Logging session activity and Enabling and disabling session logging. Sending node logs to unified CloudWatch Logs (CloudWatch agent) 2857 AWS Systems Manager User Guide Migrate Windows Server node log collection to the CloudWatch agent If you're using SSM Agent on supported Windows Server nodes to send SSM Agent log files to Amazon CloudWatch Logs, you can use Systems Manager to migrate from SSM Agent to the CloudWatch agent as your log collection tool, and migrate your configuration settings. The CloudWatch agent isn't supported on 32-bit versions of Windows Server. For 64-bit EC2 instances for Windows Server, you can perform the migration to the CloudWatch agent automatically or manually. For on-premises servers and virtual machines, the process must be performed manually. Note During the migration process, the data sent to CloudWatch might be interrupted or duplicated. Your metrics and log data will be recorded accurately again in CloudWatch after the migration is completed. We recommend testing the migration on a limited number of nodes before migrating an entire fleet to the CloudWatch agent. After migration, if you prefer log collection with SSM Agent, you can return to using it instead. Important In the following cases, you won’t be able to migrate to the CloudWatch agent using the steps described in this topic: • The existing configuration for SSM Agent specifies multiple Regions. • The existing configuration for SSM Agent specifies multiple sets of access/secret key credentials. In these cases, it will be necessary to turn off log collection in SSM Agent and install the CloudWatch agent without a migration process. For more information, see the following topics in the Amazon CloudWatch User Guide: • Installing the CloudWatch agent • Installing the CloudWatch agent on on-premises servers Migrate Windows Server node log collection to the CloudWatch agent 2858 AWS Systems Manager Before you begin User Guide Before you begin a migration to the CloudWatch agent for log collection, ensure that the nodes on which you will perform the migration meet these requirements: • The OS is a 64-bit version of Windows Server. • SSM Agent 2.2.93.0 or later is installed on the node. • SSM Agent is configured for monitoring on the node. Topics • Automatically migrating to the CloudWatch agent • Manually migrating to the CloudWatch agent Automatically migrating to the CloudWatch agent For EC2 instances for Windows Server only, you can use the AWS Systems Manager console or the AWS Command Line Interface (AWS CLI) to automatically migrate to the CloudWatch agent as your log collection tool. Note AWS Systems Manager supports migrating from SSM Agent to the unified CloudWatch agent for collecting logs and metrics on 64-bit versions of Windows only. For information about setting up the unified CloudWatch agent on other operating systems, and for complete information about using the CloudWatch agent, see Collecting metrics and logs from Amazon EC2 instances and on-premises servers with the CloudWatch agent in the Amazon CloudWatch User Guide. You can use the CloudWatch agent on other supported operating systems, but you won't be able to use Systems Manager to perform a tool migration. After the migration succeeds, check your results in CloudWatch to ensure you're receiving the metrics, logs, or Windows event logs you expect. If you're satisfied with the results, you can optionally Store CloudWatch agent configuration settings in Parameter Store. If the migration isn't successful or the results aren't as expected, you can try Rolling back to log collection with SSM Agent. Migrate Windows Server node log collection to the CloudWatch agent 2859 AWS Systems Manager Note User Guide If you want to migrate a source configuration file that includes a {hostname} entry, then be aware that the {hostname} entry can change the value of the field after the migration is complete. For example, say that the following "LogStream": "{hostname}" entry maps to a server named MyLogServer001. { "Id": "CloudWatchIISLogs", "FullName": "AWS.EC2.Windows.CloudWatch.CloudWatchLogsOutput,AWS.EC2.Windows.CloudWatch", "Parameters": { "AccessKey": "", "SecretKey": "", "Region": "us-east-1", "LogGroup": "Production-Windows-IIS", "LogStream": "{hostname}" } } After the migration, this entry maps to a domain, such as ip-11-1-1-11.production. ExampleCompany.com. To retain the local hostname value, specify {local_hostname} instead of {hostname}. To automatically migrate to the CloudWatch agent (console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. 3. 4. 5. In the navigation pane, choose Run Command, and then choose Run command. In the Command document list, choose AmazonCloudWatch-MigrateCloudWatchAgent. For Status, choose Enabled. In the Targets section, choose the managed
systems-manager-ug-807
systems-manager-ug.pdf
807
to a server named MyLogServer001. { "Id": "CloudWatchIISLogs", "FullName": "AWS.EC2.Windows.CloudWatch.CloudWatchLogsOutput,AWS.EC2.Windows.CloudWatch", "Parameters": { "AccessKey": "", "SecretKey": "", "Region": "us-east-1", "LogGroup": "Production-Windows-IIS", "LogStream": "{hostname}" } } After the migration, this entry maps to a domain, such as ip-11-1-1-11.production. ExampleCompany.com. To retain the local hostname value, specify {local_hostname} instead of {hostname}. To automatically migrate to the CloudWatch agent (console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. 3. 4. 5. In the navigation pane, choose Run Command, and then choose Run command. In the Command document list, choose AmazonCloudWatch-MigrateCloudWatchAgent. For Status, choose Enabled. In the Targets section, choose the managed nodes on which you want to run this operation by specifying tags, selecting instances or edge devices manually, or specifying a resource group. Migrate Windows Server node log collection to the CloudWatch agent 2860 AWS Systems Manager Tip User Guide If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. 6. For Rate control: • For Concurrency, specify either a number or a percentage of managed nodes on which to run the command at the same time. Note If you selected targets by specifying tags applied to managed nodes or by specifying AWS resource groups, and you aren't certain how many managed nodes are targeted, then restrict the number of targets that can run the document at the same time by specifying a percentage. • For Error threshold, specify when to stop running the command on other managed nodes after it fails on either a number or a percentage of nodes. For example, if you specify three errors, then Systems Manager stops sending the command when the fourth error is received. Managed nodes still processing the command might also send errors. 7. (Optional) For Output options, to save the command output to a file, select the Write command output to an S3 bucket box. Enter the bucket and prefix (folder) names in the boxes. Note The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile (for EC2 instances) or IAM service role (hybrid-activated machines) assigned to the instance, not those of the IAM user performing this task. For more information, see Configure instance permissions required for Systems Manager or Create an IAM service role for a hybrid environment. In addition, if the specified S3 bucket is in a different AWS account, make sure that the instance profile or IAM service role associated with the managed node has the necessary permissions to write to that bucket. Migrate Windows Server node log collection to the CloudWatch agent 2861 AWS Systems Manager User Guide 8. In the SNS notifications section, if you want notifications sent about the status of the command execution, select the Enable SNS notifications check box. For more information about configuring Amazon SNS notifications for Run Command, see Monitoring Systems Manager status changes using Amazon SNS notifications. 9. Choose Run. To automatically migrate to the CloudWatch agent (AWS CLI) • Run the following command. aws ssm send-command --document-name AmazonCloudWatch-MigrateCloudWatchAgent -- targets Key=instanceids,Values=ID1,ID2,ID3 ID1, ID2, and ID3 represent the IDs of nodes you want to update, such as i-02573cafcfEXAMPLE. Manually migrating to the CloudWatch agent For on-premises Windows Server nodes or EC2 instances for Windows Server, follow these steps to manually migrate log collection to the Amazon CloudWatch agent. Note If you want to migrate a source configuration file that includes a {hostname} entry, then be aware that the {hostname} entry can change the value of the field after the migration is complete. For example, say that the following "LogStream": "{hostname}" entry maps to a server named MyLogServer001. { "Id": "CloudWatchIISLogs", "FullName": "AWS.EC2.Windows.CloudWatch.CloudWatchLogsOutput,AWS.EC2.Windows.CloudWatch", "Parameters": { "AccessKey": "", "SecretKey": "", "Region": "us-east-1", "LogGroup": "Production-Windows-IIS", "LogStream": "{hostname}" Migrate Windows Server node log collection to the CloudWatch agent 2862 AWS Systems Manager } } User Guide After the migration, this entry maps to a domain, such as ip-11-1-1-11.production.ExampleCompany.com. To retain the local hostname value, specify {local_hostname} instead of {hostname}. One: To install the CloudWatch agent (console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. 3. 4. 5. 6. 7. In the navigation pane, choose Run Command, and then choose Run command. In the Command document list, choose AWS-ConfigureAWSPackage. For Action, choose Install. For Name, enter AmazonCloudWatchAgent. For Version, enter latest if it isn't already provided by default. In the Targets section, choose the managed nodes on which you want to run this operation by specifying tags, selecting instances or edge devices manually, or specifying a resource group. Tip If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. 8. For Rate control: • For Concurrency, specify either a number or a percentage of managed nodes on which to run the command at the same
systems-manager-ug-808
systems-manager-ug.pdf
808
the Command document list, choose AWS-ConfigureAWSPackage. For Action, choose Install. For Name, enter AmazonCloudWatchAgent. For Version, enter latest if it isn't already provided by default. In the Targets section, choose the managed nodes on which you want to run this operation by specifying tags, selecting instances or edge devices manually, or specifying a resource group. Tip If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. 8. For Rate control: • For Concurrency, specify either a number or a percentage of managed nodes on which to run the command at the same time. Note If you selected targets by specifying tags applied to managed nodes or by specifying AWS resource groups, and you aren't certain how many managed nodes are targeted, then restrict the number of targets that can run the document at the same time by specifying a percentage. Migrate Windows Server node log collection to the CloudWatch agent 2863 AWS Systems Manager User Guide • For Error threshold, specify when to stop running the command on other managed nodes after it fails on either a number or a percentage of nodes. For example, if you specify three errors, then Systems Manager stops sending the command when the fourth error is received. Managed nodes still processing the command might also send errors. 9. (Optional) For Output options, to save the command output to a file, select the Write command output to an S3 bucket box. Enter the bucket and prefix (folder) names in the boxes. Note The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile (for EC2 instances) or IAM service role (hybrid-activated machines) assigned to the instance, not those of the IAM user performing this task. For more information, see Configure instance permissions required for Systems Manager or Create an IAM service role for a hybrid environment. In addition, if the specified S3 bucket is in a different AWS account, make sure that the instance profile or IAM service role associated with the managed node has the necessary permissions to write to that bucket. 10. In the SNS notifications section, if you want notifications sent about the status of the command execution, select the Enable SNS notifications check box. For more information about configuring Amazon SNS notifications for Run Command, see Monitoring Systems Manager status changes using Amazon SNS notifications. 11. Choose Run. Two: To update config data JSON format • To update the JSON formatting of the existing config settings for the CloudWatch agent, use Run Command, a tool in AWS Systems Manager, or log in to the node directly with an RDP connection to run the following Windows PowerShell commands on the node, one at a time. cd ${Env:ProgramFiles}\\Amazon\\AmazonCloudWatchAgent .\\amazon-cloudwatch-agent-config-wizard.exe --isNonInteractiveWindowsMigration Migrate Windows Server node log collection to the CloudWatch agent 2864 AWS Systems Manager User Guide {Env:ProgramFiles} represents the location where the Amazon directory containing the CloudWatch agent can be found, typically C:\Program Files. Three: To configure and start the CloudWatch agent (console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. 3. 4. In the navigation pane, choose Run Command, and then choose Run command. In the Command document list, choose AWS-RunPowerShellScript. For Commands, enter the following two commands. cd ${Env:ProgramFiles}\Amazon\AmazonCloudWatchAgent .\amazon-cloudwatch-agent-ctl.ps1 -a fetch-config -m ec2 -c file:config.json -s {Env:ProgramFiles} represents the location where the Amazon directory containing the CloudWatch agent can be found, typically C:\Program Files. 5. In the Targets section, choose the managed nodes on which you want to run this operation by specifying tags, selecting instances or edge devices manually, or specifying a resource group. Tip If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. 6. For Rate control: • For Concurrency, specify either a number or a percentage of managed nodes on which to run the command at the same time. Note If you selected targets by specifying tags applied to managed nodes or by specifying AWS resource groups, and you aren't certain how many managed nodes are targeted, Migrate Windows Server node log collection to the CloudWatch agent 2865 AWS Systems Manager User Guide then restrict the number of targets that can run the document at the same time by specifying a percentage. • For Error threshold, specify when to stop running the command on other managed nodes after it fails on either a number or a percentage of nodes. For example, if you specify three errors, then Systems Manager stops sending the command when the fourth error is received. Managed nodes still processing the command might also send errors. 7. (Optional) For Output options, to save the command output to a file, select the Write command output to an S3 bucket box. Enter the bucket and prefix
systems-manager-ug-809
systems-manager-ug.pdf
809
of targets that can run the document at the same time by specifying a percentage. • For Error threshold, specify when to stop running the command on other managed nodes after it fails on either a number or a percentage of nodes. For example, if you specify three errors, then Systems Manager stops sending the command when the fourth error is received. Managed nodes still processing the command might also send errors. 7. (Optional) For Output options, to save the command output to a file, select the Write command output to an S3 bucket box. Enter the bucket and prefix (folder) names in the boxes. Note The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile (for EC2 instances) or IAM service role (hybrid-activated machines) assigned to the instance, not those of the IAM user performing this task. For more information, see Configure instance permissions required for Systems Manager or Create an IAM service role for a hybrid environment. In addition, if the specified S3 bucket is in a different AWS account, make sure that the instance profile or IAM service role associated with the managed node has the necessary permissions to write to that bucket. 8. In the SNS notifications section, if you want notifications sent about the status of the command execution, select the Enable SNS notifications check box. For more information about configuring Amazon SNS notifications for Run Command, see Monitoring Systems Manager status changes using Amazon SNS notifications. 9. Choose Run. Four: To turn off log collection in SSM Agent (console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. 3. 4. In the navigation pane, choose Run Command, and then choose Run command. In the Command document list, choose AWS-ConfigureCloudWatch. For Status, choose Disabled. Migrate Windows Server node log collection to the CloudWatch agent 2866 AWS Systems Manager User Guide 5. In the Targets section, choose the managed nodes on which you want to run this operation by specifying tags, selecting instances or edge devices manually, or specifying a resource group. Tip If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. 6. 7. For Status, choose Disabled. For Rate control: • For Concurrency, specify either a number or a percentage of managed nodes on which to run the command at the same time. Note If you selected targets by specifying tags applied to managed nodes or by specifying AWS resource groups, and you aren't certain how many managed nodes are targeted, then restrict the number of targets that can run the document at the same time by specifying a percentage. • For Error threshold, specify when to stop running the command on other managed nodes after it fails on either a number or a percentage of nodes. For example, if you specify three errors, then Systems Manager stops sending the command when the fourth error is received. Managed nodes still processing the command might also send errors. 8. (Optional) For Output options, to save the command output to a file, select the Write command output to an S3 bucket box. Enter the bucket and prefix (folder) names in the boxes. Note The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile (for EC2 instances) or IAM service role (hybrid-activated machines) assigned to the instance, not those of the IAM user performing this task. For more information, see Configure instance permissions required for Systems Manager or Create an IAM service role for a hybrid environment. In addition, if the specified S3 bucket is in a different AWS account, make sure that the instance profile or IAM service Migrate Windows Server node log collection to the CloudWatch agent 2867 AWS Systems Manager User Guide role associated with the managed node has the necessary permissions to write to that bucket. 9. In the SNS notifications section, if you want notifications sent about the status of the command execution, select the Enable SNS notifications check box. For more information about configuring Amazon SNS notifications for Run Command, see Monitoring Systems Manager status changes using Amazon SNS notifications. 10. Choose Run. After completing these steps, check your logs in CloudWatch to verify you are receiving the metrics, logs, or Windows event logs you expect. If the results are satisfactory, you can optionally Store CloudWatch agent configuration settings in Parameter Store. If the migration isn't successful or the results aren't as expected, you can Rolling back to log collection with SSM Agent. Store CloudWatch agent configuration settings in Parameter Store You can store the contents of an CloudWatch agent configuration file in Parameter Store. By maintaining this configuration data in a parameter, multiple nodes can derive their configuration
systems-manager-ug-810
systems-manager-ug.pdf
810
notifications. 10. Choose Run. After completing these steps, check your logs in CloudWatch to verify you are receiving the metrics, logs, or Windows event logs you expect. If the results are satisfactory, you can optionally Store CloudWatch agent configuration settings in Parameter Store. If the migration isn't successful or the results aren't as expected, you can Rolling back to log collection with SSM Agent. Store CloudWatch agent configuration settings in Parameter Store You can store the contents of an CloudWatch agent configuration file in Parameter Store. By maintaining this configuration data in a parameter, multiple nodes can derive their configuration settings from it, and you avoid having to create or manually update configuration files on your nodes. For example, you can use Run Command to write the contents of the parameter to configuration files on multiple nodes, or use State Manager, a tool in AWS Systems Manager, to help avoid configuration drift in the CloudWatch agent configuration settings across a fleet of nodes. When you run the CloudWatch agent configuration wizard, you can choose to let the wizard save your configuration settings as a new parameter in Parameter Store. For information about running the CloudWatch agent configuration wizard, see Create the CloudWatch agent configuration file with the wizard in the Amazon CloudWatch User Guide. If you ran the wizard but didn't choose the option to save the settings as a parameter, or you created the CloudWatch agent configuration file manually, you can retrieve the data to save as a parameter on your node in the following file. ${Env:ProgramFiles}\Amazon\AmazonCloudWatchAgent\config.json Store CloudWatch agent configuration settings in Parameter Store 2868 AWS Systems Manager User Guide {Env:ProgramFiles} represents the location where the Amazon directory containing the CloudWatch agent can be found, typically C:\Program Files. We recommend keeping a backup of the JSON in this file on a location other than the node itself. For information about creating a parameter, see Creating Parameter Store parameters in Systems Manager. For more information about the CloudWatch agent, see Collecting metrics and logs from Amazon EC2 instances and on-premises servers with the CloudWatch agent in the Amazon CloudWatch User Guide. Rolling back to log collection with SSM Agent If you want to return to using SSM Agent for log collection, follow these steps. One: To retrieve config data from SSM Agent 1. On the node where you want to return to collecting logs with the SSM Agent, locate the contents of the SSM Agent config file. This JSON file is typically found in the following location: ${Env:ProgramFiles}\\Amazon\\SSM\\Plugins\\awsCloudWatch\ \AWS.EC2.Windows.CloudWatch.json {Env:ProgramFiles} represents the location where the Amazon directory can be found, typically C:\Program Files. 2. Copy this data into a text file for use in a later step. We recommend storing a backup of the JSON on a location other than the node itself. Two: To uninstall the CloudWatch agent (console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. 3. 4. In the navigation pane, choose Run Command, and then choose Run command. In the Command document list, choose AWS-ConfigureAWSPackage. For Action, choose Uninstall. Rolling back to log collection with SSM Agent 2869 AWS Systems Manager User Guide 5. 6. For Name, enter AmazonCloudWatchAgent. In the Targets section, choose the managed nodes on which you want to run this operation by specifying tags, selecting instances or edge devices manually, or specifying a resource group. Tip If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. 7. For Rate control: • For Concurrency, specify either a number or a percentage of managed nodes on which to run the command at the same time. Note If you selected targets by specifying tags applied to managed nodes or by specifying AWS resource groups, and you aren't certain how many managed nodes are targeted, then restrict the number of targets that can run the document at the same time by specifying a percentage. • For Error threshold, specify when to stop running the command on other managed nodes after it fails on either a number or a percentage of nodes. For example, if you specify three errors, then Systems Manager stops sending the command when the fourth error is received. Managed nodes still processing the command might also send errors. 8. (Optional) For Output options, to save the command output to a file, select the Write command output to an S3 bucket box. Enter the bucket and prefix (folder) names in the boxes. Note The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile (for EC2 instances) or IAM service role (hybrid-activated machines) assigned to the instance, not those of the IAM user performing this task. For more information, see Configure instance permissions required for Systems Manager or Create an IAM service
systems-manager-ug-811
systems-manager-ug.pdf
811
processing the command might also send errors. 8. (Optional) For Output options, to save the command output to a file, select the Write command output to an S3 bucket box. Enter the bucket and prefix (folder) names in the boxes. Note The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile (for EC2 instances) or IAM service role (hybrid-activated machines) assigned to the instance, not those of the IAM user performing this task. For more information, see Configure instance permissions required for Systems Manager or Create an IAM service role for a hybrid environment. In addition, if the specified S3 bucket is in a different AWS account, make sure that the instance profile or IAM service Rolling back to log collection with SSM Agent 2870 AWS Systems Manager User Guide role associated with the managed node has the necessary permissions to write to that bucket. 9. In the SNS notifications section, if you want notifications sent about the status of the command execution, select the Enable SNS notifications check box. For more information about configuring Amazon SNS notifications for Run Command, see Monitoring Systems Manager status changes using Amazon SNS notifications. 10. Choose Run. Three: To turn log collection back on in SSM Agent (console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. 3. 4. 5. 6. In the navigation pane, choose Run Command, and then choose Run command. In the Command document list, choose AWS-ConfigureCloudWatch. For Status, choose Enabled. For Properties, paste the contents of the old config data you saved to the text file. In the Targets section, choose the managed nodes on which you want to run this operation by specifying tags, selecting instances or edge devices manually, or specifying a resource group. Tip If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. 7. For Rate control: • For Concurrency, specify either a number or a percentage of managed nodes on which to run the command at the same time. Note If you selected targets by specifying tags applied to managed nodes or by specifying AWS resource groups, and you aren't certain how many managed nodes are targeted, Rolling back to log collection with SSM Agent 2871 AWS Systems Manager User Guide then restrict the number of targets that can run the document at the same time by specifying a percentage. • For Error threshold, specify when to stop running the command on other managed nodes after it fails on either a number or a percentage of nodes. For example, if you specify three errors, then Systems Manager stops sending the command when the fourth error is received. Managed nodes still processing the command might also send errors. 8. (Optional) For Output options, to save the command output to a file, select the Write command output to an S3 bucket box. Enter the bucket and prefix (folder) names in the boxes. Note The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile (for EC2 instances) or IAM service role (hybrid-activated machines) assigned to the instance, not those of the IAM user performing this task. For more information, see Configure instance permissions required for Systems Manager or Create an IAM service role for a hybrid environment. In addition, if the specified S3 bucket is in a different AWS account, make sure that the instance profile or IAM service role associated with the managed node has the necessary permissions to write to that bucket. 9. In the SNS notifications section, if you want notifications sent about the status of the command execution, select the Enable SNS notifications check box. For more information about configuring Amazon SNS notifications for Run Command, see Monitoring Systems Manager status changes using Amazon SNS notifications. 10. Choose Run. Sending SSM Agent logs to CloudWatch Logs AWS Systems Manager Agent (SSM Agent) is Amazon software that runs on your EC2 instances, edge devices, on-premises servers, and virtual machines (VMs) that are configured for Systems Manager. SSM Agent processes requests from the Systems Manager service in the cloud and configures your machine as specified in the request. For more information about SSM Agent, see Working with SSM Agent. Sending SSM Agent logs to CloudWatch Logs 2872 AWS Systems Manager User Guide In addition, using the following steps, you can configure SSM Agent to send log data to Amazon CloudWatch Logs. Before you begin Create a log group in CloudWatch Logs. For more information, see Getting started with CloudWatch Logs in the Amazon CloudWatch Logs User Guide. To configure SSM Agent to send logs to CloudWatch 1. Log into a node and locate the following file: Linux On most Linux node types: /etc/amazon/ssm/seelog.xml.template.
systems-manager-ug-812
systems-manager-ug.pdf
812
as specified in the request. For more information about SSM Agent, see Working with SSM Agent. Sending SSM Agent logs to CloudWatch Logs 2872 AWS Systems Manager User Guide In addition, using the following steps, you can configure SSM Agent to send log data to Amazon CloudWatch Logs. Before you begin Create a log group in CloudWatch Logs. For more information, see Getting started with CloudWatch Logs in the Amazon CloudWatch Logs User Guide. To configure SSM Agent to send logs to CloudWatch 1. Log into a node and locate the following file: Linux On most Linux node types: /etc/amazon/ssm/seelog.xml.template. On Ubuntu Server 20.10 STR & 20.04, 18.04, and 16.04 LTS: /snap/amazon-ssm-agent/ current/seelog.xml.template macOS /opt/aws/ssm/seelog.xml.template Windows %ProgramFiles%\Amazon\SSM\seelog.xml.template 2. Change the file name from seelog.xml.template to seelog.xml Note On Ubuntu Server 20.10 STR & 20.04, 18.04, and 16.04 LTS, the file seelog.xml must be created in the directory /etc/amazon/ssm/. You can create this directory and file by running the following commands. sudo mkdir -p /etc/amazon/ssm sudo cp -pr /snap/amazon-ssm-agent/current/* /etc/amazon/ssm sudo cp -p /etc/amazon/ssm/seelog.xml.template /etc/amazon/ssm/seelog.xml Sending SSM Agent logs to CloudWatch Logs 2873 AWS Systems Manager User Guide 3. Open the seelog.xml file in a text editor, and locate the following section. Linux and macOS <outputs formatid="fmtinfo"> <console formatid="fmtinfo"/> <rollingfile type="size" filename="/var/log/amazon/ssm/amazon-ssm-agent.log" maxsize="30000000" maxrolls="5"/> <filter levels="error,critical" formatid="fmterror"> <rollingfile type="size" filename="/var/log/amazon/ssm/errors.log" maxsize="10000000" maxrolls="5"/> </filter> </outputs> Windows <outputs formatid="fmtinfo"> <console formatid="fmtinfo"/> <rollingfile type="size" maxrolls="5" maxsize="30000000" filename="{{LOCALAPPDATA}}\Amazon\SSM\Logs\amazon-ssm-agent.log"/> <filter formatid="fmterror" levels="error,critical"> <rollingfile type="size" maxrolls="5" maxsize="10000000" filename="{{LOCALAPPDATA}}\Amazon\SSM\Logs\errors.log"/> </filter> </outputs> 4. Edit the file, and add a custom name element after the closing </filter> tag. In the following example, the custom name as been specified as cloudwatch_receiver. Linux and macOS <outputs formatid="fmtinfo"> <console formatid="fmtinfo"/> <rollingfile type="size" filename="/var/log/amazon/ssm/amazon-ssm-agent.log" maxsize="30000000" maxrolls="5"/> <filter levels="error,critical" formatid="fmterror"> <rollingfile type="size" filename="/var/log/amazon/ssm/errors.log" maxsize="10000000" maxrolls="5"/> </filter> <custom name="cloudwatch_receiver" formatid="fmtdebug" data-log-group="your- CloudWatch-log-group-name"/> </outputs> Sending SSM Agent logs to CloudWatch Logs 2874 AWS Systems Manager Windows User Guide <outputs formatid="fmtinfo"> <console formatid="fmtinfo"/> <rollingfile type="size" maxrolls="5" maxsize="30000000" filename="{{LOCALAPPDATA}}\Amazon\SSM\Logs\amazon-ssm-agent.log"/> <filter formatid="fmterror" levels="error,critical"> <rollingfile type="size" maxrolls="5" maxsize="10000000" filename="{{LOCALAPPDATA}}\Amazon\SSM\Logs\errors.log"/> </filter> <custom name="cloudwatch_receiver" formatid="fmtdebug" data-log-group="your- CloudWatch-log-group-name"/> </outputs> 5. Save your changes, and then restart SSM Agent or the node. 6. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 7. In the navigation pane, choose Log groups, and then choose the name of your log group. Tip The log stream for SSM Agent log file data is organized by node ID. Monitoring your change request events After turning on integration with AWS CloudTrail Lake and creating an event data store, you can view auditable details about the change requests that are run in your account or organization. This includes details such as the following: • The identity of the user that initiated the change request • The AWS Regions where the changes were made • The source IP address for the request • The AWS access key used for the request • The API actions run for the change request • The request parameters included for those actions • The resources updated during the process Monitoring your change request events 2875 AWS Systems Manager User Guide The following are samples of event details you can view for a change request after creating the event data store in AWS CloudTrail Lake. Details The following image shows the high-level information about a change request available on the Details tab. These details include information such as the time the change request operation began, the ID of the user that initiated the change request, the impacted AWS Region, and the event ID and request ID associated with the request. Event record The following image shows the structure of the JSON content provided by CloudTrail Lake for a change request event. This data is provided on the Event record tab in a change request. Monitoring your change request events 2876 AWS Systems Manager User Guide Important If you're using Change Manager for an organization, you can complete the following procedure while signed in to either the management account or the delegated administrator account for Change Manager. However, to use the delegated administrator account to complete these steps, the same delegated administrator account must be specified for both CloudTrail and Change Manager. When you sign in to the management account for Change Manager, you can add or change the delegated administrator account for CloudTrail on the CloudTrail Settings page. This must be done before the delegated administrator account can create an event data store for use by the entire organization. To turn on CloudTrail Lake event tracking from Change Manager 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Change Manager. Monitoring your change request events 2877 AWS Systems Manager 3. Choose the Requests tab. User Guide 4. Choose any existing change request, and then choose the Associated events tab. 5. Choose Enable CloudTrail Lake. 6. Follow the steps in Create an event data
systems-manager-ug-813
systems-manager-ug.pdf
813
account for CloudTrail on the CloudTrail Settings page. This must be done before the delegated administrator account can create an event data store for use by the entire organization. To turn on CloudTrail Lake event tracking from Change Manager 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Change Manager. Monitoring your change request events 2877 AWS Systems Manager 3. Choose the Requests tab. User Guide 4. Choose any existing change request, and then choose the Associated events tab. 5. Choose Enable CloudTrail Lake. 6. Follow the steps in Create an event data store for CloudTrail events in the AWS CloudTrail User Guide. To ensure that event data for your change requests is stored, make the following selections as you complete the procedure: • For Event type, leave the defaults AWS events and CloudTrail events selected. • If you're using Change Manager with an organization, select Enable for all accounts in my organization. • For Management events, do not clear the Write check box. Other options you choose when creating your event data store don't affect the storage of event data for your change requests. Monitoring your automations Metrics are the fundamental concept in Amazon CloudWatch. A metric represents a time-ordered set of data points that are published to CloudWatch. Think of a metric as a variable to monitor and the data points as representing the values of that variable over time. Automation is a tool in AWS Systems Manager. Systems Manager publishes metrics about Automation usage to CloudWatch. This allows you to set alarms based on those metrics. To view Automation metrics in the CloudWatch console 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Metrics. 3. Choose SSM. 4. On the Metrics tab, choose Usage, and then choose By AWS Resource. 5. In the search box near the list of metrics, enter SSM. To view Automation metrics using the AWS CLI Monitoring your automations 2878 AWS Systems Manager User Guide Open a command prompt, and use the following command. aws cloudwatch list-metrics \ --namespace "AWS/Usage" Automation metrics Systems Manager sends the following Automation metrics to CloudWatch. Metric Description ConcurrentAutomationUsage QueuedAutomationUsage The number of automations running at the same time in the current AWS account and AWS Region. The number of automations currently queued that have not started and have a status of Pending. For more information about working with CloudWatch metrics, see the following topics in the Amazon CloudWatch User Guide: • Metrics • Using Amazon CloudWatch metrics • Using Amazon CloudWatch alarms Monitoring Run Command metrics using Amazon CloudWatch Metrics are the fundamental concept in Amazon CloudWatch. A metric represents a time-ordered set of data points that are published to CloudWatch. Think of a metric as a variable to monitor, and the data points as representing the values of that variable over time. AWS Systems Manager publishes metrics about the status of Run Command commands to CloudWatch, allowing you to set alarms based on those metrics. Run Command is a tool in AWS Systems Manager. These statistics are recorded for an extended period so you can access historical information and gain a better perspective on the success rate of commands run in your AWS account. Automation metrics 2879 AWS Systems Manager User Guide The terminal status values for commands for which you can track metrics include Success, Failed, and Delivery Timed Out. For example, for an SSM Command document set to run every hour, you can configure an alarm to notify you when a status of Success isn't reported for any of those hours. For more information about command status values, see Understanding command statuses. To view metrics in the CloudWatch console 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. In the navigation pane, choose Metrics. In the Alarms by AWS service area, for Services, choose SSM-Run Command. To view metrics using the AWS CLI Open a command prompt, and use the following command. aws cloudwatch list-metrics --namespace "AWS/SSM-RunCommand" To list all available metrics, use the following command. aws cloudwatch list-metrics Systems Manager Run Command metrics and dimensions Systems Manager sends Run Command command metrics to CloudWatch one time every minute. Systems Manager sends the following command metrics to CloudWatch. Note These metrics use Count as the unit, so Sum and SampleCount are the most useful statistics. Metric Description CommandsDeliveryTimedOut The number of commands that have a terminal status of Delivery Timed Out. Systems Manager Run Command metrics and dimensions 2880 AWS Systems Manager Metric CommandsFailed User Guide Description The number of commands that have a terminal status of Failed. CommandsSucceeded The number of commands that have a terminal status of Success. For more information about working with CloudWatch metrics, see the following topics in the Amazon CloudWatch User Guide: • Metrics • Using Amazon
systems-manager-ug-814
systems-manager-ug.pdf
814
following command metrics to CloudWatch. Note These metrics use Count as the unit, so Sum and SampleCount are the most useful statistics. Metric Description CommandsDeliveryTimedOut The number of commands that have a terminal status of Delivery Timed Out. Systems Manager Run Command metrics and dimensions 2880 AWS Systems Manager Metric CommandsFailed User Guide Description The number of commands that have a terminal status of Failed. CommandsSucceeded The number of commands that have a terminal status of Success. For more information about working with CloudWatch metrics, see the following topics in the Amazon CloudWatch User Guide: • Metrics • Using Amazon CloudWatch metrics • Using Amazon CloudWatch alarms Logging AWS Systems Manager API calls with AWS CloudTrail AWS Systems Manager is integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service. CloudTrail captures all API calls for Systems Manager as events. The calls captured include calls from the Systems Manager console and code calls to the Systems Manager API operations. Using the information collected by CloudTrail, you can determine the request that was made to Systems Manager, the IP address from which the request was made, when it was made, and additional details. Every event or log entry contains information about who generated the request. The identity information helps you determine the following: • Whether the request was made with root user or user credentials. • Whether the request was made on behalf of an IAM Identity Center user. • Whether the request was made with temporary security credentials for a role or federated user. • Whether the request was made by another AWS service. CloudTrail is active in your AWS account when you create the account and you automatically have access to the CloudTrail Event history. The CloudTrail Event history provides a viewable, searchable, downloadable, and immutable record of the past 90 days of recorded management Logging AWS Systems Manager API calls with AWS CloudTrail 2881 AWS Systems Manager User Guide events in an AWS Region. For more information, see Working with CloudTrail Event history in the AWS CloudTrail User Guide. There are no CloudTrail charges for viewing the Event history. For an ongoing record of events in your AWS account past 90 days, create a trail or a CloudTrail Lake event data store. CloudTrail trails A trail enables CloudTrail to deliver log files to an Amazon S3 bucket. All trails created using the AWS Management Console are multi-Region. You can create a single-Region or a multi-Region trail by using the AWS CLI. Creating a multi-Region trail is recommended because you capture activity in all AWS Regions in your account. If you create a single-Region trail, you can view only the events logged in the trail's AWS Region. For more information about trails, see Creating a trail for your AWS account and Creating a trail for an organization in the AWS CloudTrail User Guide. You can deliver one copy of your ongoing management events to your Amazon S3 bucket at no charge from CloudTrail by creating a trail, however, there are Amazon S3 storage charges. For more information about CloudTrail pricing, see AWS CloudTrail Pricing. For information about Amazon S3 pricing, see Amazon S3 Pricing. CloudTrail Lake event data stores CloudTrail Lake lets you run SQL-based queries on your events. CloudTrail Lake converts existing events in row-based JSON format to Apache ORC format. ORC is a columnar storage format that is optimized for fast retrieval of data. Events are aggregated into event data stores, which are immutable collections of events based on criteria that you select by applying advanced event selectors. The selectors that you apply to an event data store control which events persist and are available for you to query. For more information about CloudTrail Lake, see Working with AWS CloudTrail Lake in the AWS CloudTrail User Guide. CloudTrail Lake event data stores and queries incur costs. When you create an event data store, you choose the pricing option you want to use for the event data store. The pricing option determines the cost for ingesting and storing events, and the default and maximum retention period for the event data store. For more information about CloudTrail pricing, see AWS CloudTrail Pricing. Logging AWS Systems Manager API calls with AWS CloudTrail 2882 AWS Systems Manager User Guide Systems Manager data events in CloudTrail Data events provide information about the resource operations performed on or in a resource (for example, creating or opening a control channel). These are also known as data plane operations. Data events are often high-volume activities. By default, CloudTrail doesn’t log data events. The CloudTrail Event history doesn't record data events. Additional charges apply for data events. For more information about CloudTrail pricing, see AWS CloudTrail Pricing. You can log data events for the Systems
systems-manager-ug-815
systems-manager-ug.pdf
815
see AWS CloudTrail Pricing. Logging AWS Systems Manager API calls with AWS CloudTrail 2882 AWS Systems Manager User Guide Systems Manager data events in CloudTrail Data events provide information about the resource operations performed on or in a resource (for example, creating or opening a control channel). These are also known as data plane operations. Data events are often high-volume activities. By default, CloudTrail doesn’t log data events. The CloudTrail Event history doesn't record data events. Additional charges apply for data events. For more information about CloudTrail pricing, see AWS CloudTrail Pricing. You can log data events for the Systems Manager resource types by using the CloudTrail console, AWS CLI, or CloudTrail API operations. For more information about how to log data events, see Logging data events with the AWS Management Console and Logging data events with the AWS Command Line Interface in the AWS CloudTrail User Guide. The following table lists the Systems Manager resource types for which you can log data events. The Data event type (console) column shows the value to choose from the Data event type list on the CloudTrail console. The resources.type value column shows the resources.type value, which you would specify when configuring advanced event selectors using the AWS CLI or CloudTrail APIs. The Data APIs logged to CloudTrail column shows the API calls logged to CloudTrail for the resource type. Data event type (console) resources.type value Data APIs logged to CloudTrail Systems Manager AWS::SSMMessages:: • CreateControlChann ControlChannel el • OpenControlChannel For more information about these operations, see Actions defined by Amazon Message Gateway Service in the Service Authorization Reference. Systems Manager managed node AWS::SSM::ManagedN • RequestManagedInst ode anceRoleToken – This Systems Manager data events in CloudTrail 2883 AWS Systems Manager User Guide Data event type (console) resources.type value Data APIs logged to CloudTrail event is generated when the AWS Systems Manager Agent (SSM Agent) running on a node managed by Systems Manager requests credentials from the Systems Manager credentia l service. For more information about the RequestManagedInst anceRoleToken , see Validating hybrid-ac operation tivated machines using a hardware fingerprint You can configure advanced event selectors to filter on the eventName, readOnly, and resources.ARN fields to log only those events that are important to you. For more information about these fields, see AdvancedFieldSelector in the AWS CloudTrail API Reference. Systems Manager management events in CloudTrail Management events provide information about management operations that are performed on resources in your AWS account. These are also known as control plane operations. By default, CloudTrail logs management events. Systems Manager logs all control plane operations to CloudTrail as management events. Systems Manager API operations are documented in the AWS Systems Manager API Reference. For example, calls to the CreateMaintenanceWindows, PutInventory, SendCommand, and StartSession actions generate entries in the CloudTrail log files. For an example of setting up CloudTrail to monitor a Systems Manager API call, see Monitoring session activity using Amazon EventBridge (console). Systems Manager management events in CloudTrail 2884 AWS Systems Manager User Guide Systems Manager event examples An event represents a single request from any source and includes information about the requested API operation, the date and time of the operation, request parameters, and so on. CloudTrail log files aren't an ordered stack trace of the public API calls, so events don't appear in any specific order. Examples: • Management event examples • Data event examples Management event examples Example 1: DeleteDocument The following example shows a CloudTrail event that demonstrates the DeleteDocument operation on a document named example-Document in the US East (Ohio) Region (us-east-2). { "eventVersion": "1.04", "userIdentity": { "type": "AssumedRole", "principalId": "AKIAI44QH8DHBEXAMPLE:203.0.113.11", "arn": "arn:aws:sts::123456789012:assumed-role/example-role/203.0.113.11", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "attributes": { "mfaAuthenticated": "false", "creationDate": "2018-03-06T20:19:16Z" }, "sessionIssuer": { "type": "Role", "principalId": "AKIAI44QH8DHBEXAMPLE", "arn": "arn:aws:iam::123456789012:role/example-role", "accountId": "123456789012", "userName": "example-role" } } }, Systems Manager event examples 2885 AWS Systems Manager User Guide "eventTime": "2018-03-06T20:30:12Z", "eventSource": "ssm.amazonaws.com", "eventName": "DeleteDocument", "awsRegion": "us-east-2", "sourceIPAddress": "203.0.113.11", "userAgent": "example-user-agent-string", "requestParameters": { "name": "example-Document" }, "responseElements": null, "requestID": "86168559-75e9-11e4-8cf8-75d18EXAMPLE", "eventID": "832b82d5-d474-44e8-a51d-093ccEXAMPLE", "resources": [ { "ARN": "arn:aws:ssm:us-east-2:123456789012:document/example-Document", "accountId": "123456789012" } ], "eventType": "AwsApiCall", "recipientAccountId": "123456789012", "eventCategory": "Management" } Example 2: StartConnection The following example shows a CloudTrail event for a user who starts an RDP connection using Fleet Manager in the US East (Ohio) Region (us-east-2). The underlying API action is StartConnection. { "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "AKIAI44QH8DHBEXAMPLE", "arn": "arn:aws:sts::123456789012:assumed-role/exampleRole", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AKIAI44QH8DHBEXAMPLE", "arn": "arn:aws:sts::123456789012:assumed-role/exampleRole", "accountId": "123456789012", Systems Manager event examples 2886 AWS Systems Manager User Guide "userName": "exampleRole" }, "webIdFederationData": {}, "attributes": { "creationDate": "2021-12-13T14:57:05Z", "mfaAuthenticated": "false" } } }, "eventTime": "2021-12-13T16:50:41Z", "eventSource": "ssm-guiconnect.amazonaws.com", "eventName": "StartConnection", "awsRegion": "us-east-2", "sourceIPAddress": "34.230.45.60", "userAgent": "example-user-agent-string", "requestParameters": { "AuthType": "Credentials", "Protocol": "RDP", "ConnectionType": "SessionManager", "InstanceId": "i-02573cafcfEXAMPLE" }, "responseElements": { "ConnectionArn": "arn:aws:ssm-guiconnect:us-east-2:123456789012:connection/ fcb810cd-241f-4aae-9ee4-02d59EXAMPLE", "ConnectionKey": "71f9629f-0f9a-4b35-92f2-2d253EXAMPLE", "ClientToken": "49af0f92-d637-4d47-9c54-ea51aEXAMPLE", "requestId": "d466710f-2adf-4e87-9464-055b2EXAMPLE" }, "requestID":
systems-manager-ug-816
systems-manager-ug.pdf
816
in the US East (Ohio) Region (us-east-2). The underlying API action is StartConnection. { "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "AKIAI44QH8DHBEXAMPLE", "arn": "arn:aws:sts::123456789012:assumed-role/exampleRole", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AKIAI44QH8DHBEXAMPLE", "arn": "arn:aws:sts::123456789012:assumed-role/exampleRole", "accountId": "123456789012", Systems Manager event examples 2886 AWS Systems Manager User Guide "userName": "exampleRole" }, "webIdFederationData": {}, "attributes": { "creationDate": "2021-12-13T14:57:05Z", "mfaAuthenticated": "false" } } }, "eventTime": "2021-12-13T16:50:41Z", "eventSource": "ssm-guiconnect.amazonaws.com", "eventName": "StartConnection", "awsRegion": "us-east-2", "sourceIPAddress": "34.230.45.60", "userAgent": "example-user-agent-string", "requestParameters": { "AuthType": "Credentials", "Protocol": "RDP", "ConnectionType": "SessionManager", "InstanceId": "i-02573cafcfEXAMPLE" }, "responseElements": { "ConnectionArn": "arn:aws:ssm-guiconnect:us-east-2:123456789012:connection/ fcb810cd-241f-4aae-9ee4-02d59EXAMPLE", "ConnectionKey": "71f9629f-0f9a-4b35-92f2-2d253EXAMPLE", "ClientToken": "49af0f92-d637-4d47-9c54-ea51aEXAMPLE", "requestId": "d466710f-2adf-4e87-9464-055b2EXAMPLE" }, "requestID": "d466710f-2adf-4e87-9464-055b2EXAMPLE", "eventID": "fc514f57-ba19-4e8b-9079-c2913EXAMPLE", "readOnly": false, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" } Data event examples Example 1: CreateControlChannel The following example shows a CloudTrail event that demonstrates the CreateControlChannel operation. Systems Manager event examples 2887 AWS Systems Manager User Guide { "eventVersion":"1.08", "userIdentity":{ "type":"AssumedRole", "principalId":"AKIAI44QH8DHBEXAMPLE", "arn":"arn:aws:sts::123456789012:assumed-role/exampleRole", "accountId":"123456789012", "accessKeyId":"AKIAI44QH8DHBEXAMPLE", "sessionContext":{ "sessionIssuer":{ "type":"Role", "principalId":"AKIAI44QH8DHBEXAMPLE", "arn":"arn:aws:iam::123456789012:role/exampleRole", "accountId":"123456789012", "userName":"exampleRole" }, "attributes":{ "creationDate":"2023-05-04T23:14:50Z", "mfaAuthenticated":"false" } } }, "eventTime":"2023-05-04T23:53:55Z", "eventSource":"ssm.amazonaws.com", "eventName":"CreateControlChannel", "awsRegion":"us-east-1", "sourceIPAddress":"192.0.2.0", "userAgent":"example-agent", "requestParameters":{ "channelId":"44295c1f-49d2-48b6-b218-96823EXAMPLE", "messageSchemaVersion":"1.0", "requestId":"54993150-0e8f-4142-aa54-3438EXAMPLE", "userAgent":"example-agent" }, "responseElements":{ "messageSchemaVersion":"1.0", "tokenValue":"Value hidden due to security reasons.", "url":"example-url" }, "requestID":"54993150-0e8f-4142-aa54-3438EXAMPLE", "eventID":"a48a28de-7996-4ca1-a3a0-a51fEXAMPLE", "readOnly":false, "resources":[ Systems Manager event examples 2888 AWS Systems Manager { "accountId":"123456789012", "type":"AWS::SSMMessages::ControlChannel", "ARN":"arn:aws:ssmmessages:us-east-1:123456789012:control- channel/44295c1f-49d2-48b6-b218-96823EXAMPLE" User Guide } ], "eventType":"AwsApiCall", "managementEvent":false, "recipientAccountId":"123456789012", "eventCategory":"Data" } Example 2: RequestManagedInstanceRoleToken The following example shows a CloudTrail event that demonstrates the RequestManagedInstanceRoleToken operation. { "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "123456789012:aws:ec2-instance:i-02854e4bEXAMPLE", "arn": "arn:aws:sts::123456789012:assumed-role/aws:ec2-instance/ i-02854e4bEXAMPLE", "accountId": "123456789012", "accessKeyId": "AKIAI44QH8DHBEXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "123456789012:aws:ec2-instance", "arn": "arn:aws:iam::123456789012:role/aws:ec2-instance", "accountId": "123456789012", "userName": "aws:ec2-instance" }, "attributes": { "creationDate": "2023-08-27T03:34:46Z", "mfaAuthenticated": "false" }, "ec2RoleDelivery": "2.0" } }, "eventTime": "2023-08-27T03:37:15Z", Systems Manager event examples 2889 AWS Systems Manager User Guide "eventSource": "ssm.amazonaws.com", "eventName": "RequestManagedInstanceRoleToken", "awsRegion": "us-east-1", "sourceIPAddress": "192.0.2.0", "userAgent": "Apache-HttpClient/UNAVAILABLE (Java/1.8.0_362)", "requestParameters": { "fingerprint": "i-02854e4bf85EXAMPLE" }, "responseElements": null, "requestID": "2582cced-455b-4189-9b82-7b48EXAMPLE", "eventID": "7f200508-e547-4c27-982d-4da0EXAMLE", "readOnly": true, "resources": [ { "accountId": "123456789012", "type": "AWS::SSM::ManagedNode", "ARN": "arn:aws:ec2:us-east-1:123456789012:instance/i-02854e4bEXAMPLE" } ], "eventType": "AwsApiCall", "managementEvent": false, "recipientAccountId": "123456789012", "eventCategory": "Data" } For information about CloudTrail record contents, see CloudTrail record contents in the AWS CloudTrail User Guide. Logging Automation action output with CloudWatch Logs Automation, a tool in AWS Systems Manager, integrates with Amazon CloudWatch Logs. You can send the output from aws:executeScript actions in your runbooks to the log group you specify. Systems Manager doesn't create a log group or any log streams for documents that don't use aws:executeScript actions. If the document does use aws:executeScript, the output sent to CloudWatch Logs only pertains to those actions. You can use the aws:executeScript action output stored in your CloudWatch Logs log group for debugging and troubleshooting purposes. If you choose a log group that is encrypted, the aws:executeScript action output is also encrypted. Logging output from aws:executeScript actions is an account-level setting. To send action output to CloudWatch Logs for Amazon owned runbooks, the user or role that runs the automation must have permissions for the following operations: Logging Automation action output with CloudWatch Logs 2890 AWS Systems Manager • logs:CreateLogGroup • logs:CreateLogStream • logs:DescribeLogGroups • logs:DescribeLogStreams • logs:PutLogEvents User Guide For runbooks that you own, the same permissions must be added to the IAM service role (or AssumeRole) you use to run the runbook. To send action output to CloudWatch Logs (console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Automation. 3. Choose the Preferences tab, and then choose Edit. 4. 5. Select the check box next to Send output to CloudWatch Logs. (Recommended) Select the check box next to Encrypt log data. With this option turned on, log data is encrypted using the server-side encryption key specified for the log group. If you don't want to encrypt the log data that is sent to CloudWatch Logs, clear the check box. Clear the check box if encryption isn't allowed on the log group. 6. For CloudWatch Logs log group, to specify the existing CloudWatch Logs log group in your AWS account that you want to send action output to, select one of the following: • Send output to the default log group – If the default log group doesn't exist (/aws/ssm/ automation/executeScript), Automation creates it for you. • Choose from a list of log groups – Select a log group that has already been created in your account to store action output. • Enter a log group name – Enter the name of a log group in the text box that has already been created in your account to store action output. 7. Choose Save. To send action output to CloudWatch Logs (command line) 1. Open your preferred command line tool and run the following command to update the action output destination. Logging Automation action output with CloudWatch Logs 2891 AWS Systems Manager Linux & macOS User Guide aws ssm update-service-setting \ --setting-id arn:aws:ssm:region:account-id:servicesetting/ssm/automation/ customer-script-log-destination \ --setting-value
systems-manager-ug-817
systems-manager-ug.pdf
817
a log group that has already been created in your account to store action output. • Enter a log group name – Enter the name of a log group in the text box that has already been created in your account to store action output. 7. Choose Save. To send action output to CloudWatch Logs (command line) 1. Open your preferred command line tool and run the following command to update the action output destination. Logging Automation action output with CloudWatch Logs 2891 AWS Systems Manager Linux & macOS User Guide aws ssm update-service-setting \ --setting-id arn:aws:ssm:region:account-id:servicesetting/ssm/automation/ customer-script-log-destination \ --setting-value CloudWatch Windows aws ssm update-service-setting ^ --setting-id arn:aws:ssm:region:account-id:servicesetting/ssm/automation/ customer-script-log-destination ^ --setting-value CloudWatch PowerShell Update-SSMServiceSetting ` -SettingId "arn:aws:ssm:region:account-id:servicesetting/ssm/automation/ customer-script-log-destination" ` -SettingValue "CloudWatch" There is no output if the command succeeds. 2. Run the following command to specify the log group you want to send action output to. Linux & macOS aws ssm update-service-setting \ --setting-id arn:aws:ssm:region:account-id:servicesetting/ssm/automation/ customer-script-log-group-name \ --setting-value my-log-group Windows aws ssm update-service-setting ^ --setting-id arn:aws:ssm:region:account-id:servicesetting/ssm/automation/ customer-script-log-group-name ^ --setting-value my-log-group Logging Automation action output with CloudWatch Logs 2892 AWS Systems Manager PowerShell User Guide Update-SSMServiceSetting ` -SettingId "arn:aws:ssm:region:account-id:servicesetting/ssm/automation/ customer-script-log-group-name" ` -SettingValue "my-log-group" There is no output if the command succeeds. 3. Run the following command to view the current service settings for Automation action logging preferences in the current AWS account and AWS Region. Linux & macOS aws ssm get-service-setting \ --setting-id arn:aws:ssm:region:account-id:servicesetting/ssm/automation/ customer-script-log-destination Windows aws ssm get-service-setting ^ --setting-id arn:aws:ssm:region:account-id:servicesetting/ssm/automation/ customer-script-log-destination PowerShell Get-SSMServiceSetting ` -SettingId "arn:aws:ssm:region:account-id:servicesetting/ssm/automation/ customer-script-log-destination" The command returns information like the following. { "ServiceSetting": { "Status": "Customized", "LastModifiedDate": 1613758617.036, "SettingId": "/ssm/automation/customer-script-log-destination", "LastModifiedUser": "arn:aws:sts::123456789012:assumed-role/Administrator/ User_1", Logging Automation action output with CloudWatch Logs 2893 AWS Systems Manager User Guide "SettingValue": "CloudWatch", "ARN": "arn:aws:ssm:us-east-2:123456789012:servicesetting/ssm/automation/ customer-script-log-destination" } } Configuring Amazon CloudWatch Logs for Run Command When you send a command by using Run Command, a tool in AWS Systems Manager, you can specify where you want to send the command output. By default, Systems Manager returns only the first 24,000 characters of the command output. If you want to view the full details of the command output, you can specify an Amazon Simple Storage Service (Amazon S3) bucket. Or you can specify Amazon CloudWatch Logs. If you specify CloudWatch Logs, Run Command periodically sends all command output and error logs to CloudWatch Logs. You can monitor output logs in near real-time, search for specific phrases, values, or patterns, and create alarms based on the search. If you configured your managed node to use the AWS Identity and Access Management (IAM) managed policies AmazonSSMManagedInstanceCore and CloudWatchAgentServerPolicy, then your node requires no additional configuration to send output to CloudWatch Logs. Choose this option if sending commands from the console, or add the cloud-watch-output-config section and CloudWatchOutputEnabled parameter if using the AWS Command Line Interface (AWS CLI), AWS Tools for Windows PowerShell, or an API operation. The cloud-watch-output- config section and CloudWatchOutputEnabled parameter are described in more detail later in this topic. For information about adding policies to an instance profile for EC2 instances, see Configure instance permissions required for Systems Manager. For information about adding policies to a service role for on-premises servers and virtual machines that you plan to use as managed nodes, see Create the IAM service role required for Systems Manager in hybrid and multicloud environments. If you're using a custom policy on your nodes, update the policy on each node to allow Systems Manager to send output and logs to CloudWatch Logs. Add the following policy objects to your custom policy. For more information about updating an IAM policy, see Editing IAM policies in the IAM User Guide. { "Effect": "Allow", Configuring Amazon CloudWatch Logs for Run Command 2894 AWS Systems Manager User Guide "Action": "logs:DescribeLogGroups", "Resource": "*" }, { "Effect":"Allow", "Action":[ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:DescribeLogStreams", "logs:PutLogEvents" ], "Resource":"arn:aws:logs:*:*:log-group:/aws/ssm/*" }, Specifying CloudWatch Logs when you send commands To specify CloudWatch Logs as the output when you send a command from the AWS Management Console, choose CloudWatch Output in the Output options section. Optionally, you can specify the name of CloudWatch Logs group where you want to send command output. If you don't specify a group name, Systems Manager automatically creates a log group for you. The log group uses the following naming format: /aws/ssm/SystemsManagerDocumentName If you run commands by using the AWS CLI, specify the cloud-watch-output-config section in your command. This section allows you to specify the CloudWatchOutputEnabled parameter, and optionally, the CloudWatchLogGroupName parameter. Here is an example. Linux & macOS aws ssm send-command \ --instance-ids "instance ID" \ --document-name "AWS-RunShellScript" \ --parameters "commands=echo helloWorld" \ --cloud-watch-output-config "CloudWatchOutputEnabled=true,CloudWatchLogGroupName=log group name" Windows aws ssm send-command ^ --document-name "AWS-RunPowerShellScript" ^ --parameters commands=["echo helloWorld"] ^ --targets "Key=instanceids,Values=an instance ID” ^ Specifying CloudWatch Logs when you send commands 2895 AWS Systems Manager User Guide --cloud-watch-output-config '{"CloudWatchLogGroupName":"log group name","CloudWatchOutputEnabled":true}' Viewing command output in CloudWatch Logs
systems-manager-ug-818
systems-manager-ug.pdf
818
following naming format: /aws/ssm/SystemsManagerDocumentName If you run commands by using the AWS CLI, specify the cloud-watch-output-config section in your command. This section allows you to specify the CloudWatchOutputEnabled parameter, and optionally, the CloudWatchLogGroupName parameter. Here is an example. Linux & macOS aws ssm send-command \ --instance-ids "instance ID" \ --document-name "AWS-RunShellScript" \ --parameters "commands=echo helloWorld" \ --cloud-watch-output-config "CloudWatchOutputEnabled=true,CloudWatchLogGroupName=log group name" Windows aws ssm send-command ^ --document-name "AWS-RunPowerShellScript" ^ --parameters commands=["echo helloWorld"] ^ --targets "Key=instanceids,Values=an instance ID” ^ Specifying CloudWatch Logs when you send commands 2895 AWS Systems Manager User Guide --cloud-watch-output-config '{"CloudWatchLogGroupName":"log group name","CloudWatchOutputEnabled":true}' Viewing command output in CloudWatch Logs As soon as the command starts to run, Systems Manager sends output to CloudWatch Logs in near- real time. The output in CloudWatch Logs uses the following format: CommandID/InstanceID/PluginID/stdout CommandID/InstanceID/PluginID/stderr Output from the execution is uploaded every 30 seconds or when the buffer exceeds 200 KB, whichever happens first. Note Log streams are only created when output data is available. For example, if there is no error data for an execution, the stderr stream isn't created. Here is an example of the command output as it is displayed in CloudWatch Logs. Group - /aws/ssm/AWS-RunShellScript Streams – 1234-567-8910/i-abcd-efg-hijk/AWS-RunPowerShellScript/stdout 24/1234-567-8910/i-abcd-efg-hijk/AWS-RunPowerShellScript/stderr Monitoring Systems Manager events with Amazon EventBridge Amazon EventBridge is a serverless event bus service that allows you to connect your applications with data from a variety of sources. EventBridge delivers a stream of real-time data from your own applications, software-as-a-service (SaaS) applications, and AWS services and routes that data to targets such as AWS Lambda. You can set up routing rules to determine where to send your data to build application architectures that react in real time to all of your data sources. EventBridge allows you to build event driven architectures, which are loosely coupled and distributed. EventBridge was formerly called Amazon CloudWatch Events. EventBridge includes new features that allow you to receive events from SaaS partners and your own applications. Viewing command output in CloudWatch Logs 2896 AWS Systems Manager User Guide Existing CloudWatch Events users can access their existing default bus, rules, and events in the new EventBridge console and in the CloudWatch Events console. EventBridge uses the same CloudWatch Events API, so all of your existing CloudWatch Events API usage remains the same. EventBridge can add events from dozens of AWS services to your rules, and targets from over 20 AWS services. EventBridge provides support for both AWS Systems Manager events and Systems Manager targets. Supported Systems Manager event types Among the many types of Systems Manager events that EventBridge can detect are: • A just-in-time node access request status update for manual approvals. • A failed just-in-time node access request. • A maintenance window being turned off. • An Automation workflow completing successfully. Automation is a tool in AWS Systems Manager. • A managed node being out of patch compliance. • A parameter value being updated. EventBridge supports events from the following AWS Systems Manager tools: • Just-in-time node access (Events are emitted on a best effort basis.) • Automation (Events are emitted on a best effort basis.) • Change Calendar (Events are emitted on a best effort basis.) • Compliance • Inventory (Events are emitted on a best effort basis.) • Maintenance Windows (Events are emitted on a best effort basis.) • Parameter Store (Events are emitted on a best effort basis.) • Run Command (Events are emitted on a best effort basis.) • State Manager (Events are emitted on a best effort basis.) For complete details about supported Systems Manager event types, see Reference: Amazon EventBridge event patterns and types for Systems Manager and Amazon EventBridge event examples for Systems Manager. Monitoring with Amazon EventBridge 2897 AWS Systems Manager User Guide Supported Systems Manager target types EventBridge supports the following three Systems Manager tools as targets of an event rule: • Running an Automation workflow • Running a Run Command Command document (Events are emitted on a best effort basis.) • Creating an OpsCenter OpsItem For suggested ways you might use these targets, see Sample scenarios: Systems Manager targets in Amazon EventBridge rules. For more information about how to get started with EventBridge and set up rules, see Getting started with Amazon EventBridge in the Amazon EventBridge User Guide. For complete information about working with EventBridge, see the Amazon EventBridge User Guide. Topics • Configuring EventBridge for Systems Manager events • Amazon EventBridge event examples for Systems Manager • Sample scenarios: Systems Manager targets in Amazon EventBridge rules Configuring EventBridge for Systems Manager events You can use Amazon EventBridge to perform a target event when supported AWS Systems Manager status changes, state changes, or other conditions occur. You can create a rule that runs whenever there is a state or status transition, or when there is a transition to one or more states that are
systems-manager-ug-819
systems-manager-ug.pdf
819
Amazon EventBridge User Guide. For complete information about working with EventBridge, see the Amazon EventBridge User Guide. Topics • Configuring EventBridge for Systems Manager events • Amazon EventBridge event examples for Systems Manager • Sample scenarios: Systems Manager targets in Amazon EventBridge rules Configuring EventBridge for Systems Manager events You can use Amazon EventBridge to perform a target event when supported AWS Systems Manager status changes, state changes, or other conditions occur. You can create a rule that runs whenever there is a state or status transition, or when there is a transition to one or more states that are of interest. The following procedure provides general steps for creating an EventBridge rule that engages when a specified event is emitted by Systems Manager. For a list of procedures in this user guide that address specific scenarios, see More info at the end of this topic. Note When a service in your AWS account emits an event, it always goes to your account’s default event bus. To write a rule that responds to events from AWS services in your account, associate it with the default event bus. You can create a rule on a custom event bus that looks for events from AWS services, but this rule only engages when you receive Configuring EventBridge for Systems Manager events 2898 AWS Systems Manager User Guide such an event from another account through cross-account event delivery. For more information, see Sending and receiving Amazon EventBridge events between AWS accounts in the Amazon EventBridge User Guide. To configure EventBridge for Systems Manager events 1. Open the Amazon EventBridge console at https://console.aws.amazon.com/events/. 2. In the navigation pane, choose Rules. 3. Choose Create rule. 4. Enter a name and description for the rule. A rule can't have the same name as another rule in the same AWS Region and on the same event bus. 5. For Event bus, choose the event bus that you want to associate with this rule. If you want this rule to respond to matching events that come from your own AWS account, select default. When an AWS service in your account emits an event, it always goes to your account’s default event bus. 6. For Rule type, choose Rule with an event pattern. 7. Choose Next. 8. 9. For Event source, choose AWS events or EventBridge partner events. In the Event pattern section, choose Event pattern form. 10. For Event source, choose AWS services. 11. For AWS service, choose Systems Manager. 12. For Event type, do one of the following: • Choose All Events. If you choose All Events, all events emitted by Systems Manager will match the rule. Be aware that this option can result in many event target actions. • Choose the type of Systems Manager event to use for this rule. EventBridge supports events from the following AWS Systems Manager tools: • Automation • Change Calendar • Compliance Configuring EventBridge for Systems Manager events 2899 AWS Systems Manager • Inventory • Maintenance Windows • Parameter Store • Run Command • State Manager Note User Guide For Systems Manager actions that aren't supported by EventBridge, you can choose an AWS API call through CloudTrail to create an event rule that is based on an API call, which are recorded by CloudTrail. For an example, see Monitoring session activity using Amazon EventBridge (console). 13. (Optional) To make the rule more specific, add filter values. For example, if you chose State Manager and want to limit the rule to the state of a single managed instance that is targeted by an Association, for Specific type(s), choose EC2 State Manager Instance Association State Change. For complete details about supported detail types, see Reference: Amazon EventBridge event patterns and types for Systems Manager. Some detail types have other supported options such as status. The available options depend on the tool you selected. 14. Choose Next. 15. For Target types, choose AWS service. 16. For Select a target, choose a target such as an Amazon SNS topic or AWS Lambda function. The target is triggered when an event is received that matches the event pattern defined in the rule. 17. For many target types, EventBridge needs permissions to send events to the target. In these cases, EventBridge can create the AWS Identity and Access Management (IAM) role needed for your rule to run: • To create an IAM role automatically, choose Create a new role for this specific resource. • To use an IAM role that you created earlier, choose Use existing role. 18. (Optional) Choose Add another target to add another target for this rule. 19. Choose Next. Configuring EventBridge for Systems Manager events 2900 AWS Systems Manager User Guide 20. (Optional) Enter one or more tags for the rule. For more information, see Amazon EventBridge tags in the Amazon EventBridge User
systems-manager-ug-820
systems-manager-ug.pdf
820
In these cases, EventBridge can create the AWS Identity and Access Management (IAM) role needed for your rule to run: • To create an IAM role automatically, choose Create a new role for this specific resource. • To use an IAM role that you created earlier, choose Use existing role. 18. (Optional) Choose Add another target to add another target for this rule. 19. Choose Next. Configuring EventBridge for Systems Manager events 2900 AWS Systems Manager User Guide 20. (Optional) Enter one or more tags for the rule. For more information, see Amazon EventBridge tags in the Amazon EventBridge User Guide. 21. Choose Next. 22. Review the details of the rule and choose Create rule. More info • Creating an EventBridge event that uses a runbook (console) • Passing data to Automation using input transformers • Remediating compliance issues using EventBridge • Viewing inventory delete actions in EventBridge • Configure EventBridge rules to create OpsItems • Configuring EventBridge rules for parameters and parameter policies Amazon EventBridge event examples for Systems Manager The following are examples, in JSON format, of supported EventBridge events for AWS Systems Manager. Systems Manager event types • AWS Systems Manager Automation Events • AWS Systems Manager Change Calendar Events • AWS Systems Manager Change Manager Events • AWS Systems Manager Compliance Events • AWS Systems Manager Maintenance Windows Events • AWS Systems Manager Parameter Store Events • AWS Systems Manager OpsCenter Events • AWS Systems Manager Run Command Events • AWS Systems Manager State Manager Events AWS Systems Manager Automation Events Automation Step Status-change Notification Amazon EventBridge event examples for Systems Manager 2901 AWS Systems Manager { "version": "0", User Guide "id": "eeca120b-a321-433e-9635-dab369006a6b", "detail-type": "EC2 Automation Step Status-change Notification", "source": "aws.ssm", "account": "123456789012", "time": "2024-11-29T19:43:35Z", "region": "us-east-1", "resources": ["arn:aws:ssm:us-east-2:123456789012:automation- execution/333ba70b-2333-48db-b17e-a5e69c6f4d1c", "arn:aws:ssm:us-east-2:123456789012:automation-definition/runcommand1:1"], "detail": { "ExecutionId": "333ba70b-2333-48db-b17e-a5e69c6f4d1c", "Definition": "runcommand1", "DefinitionVersion": 1.0, "Status": "Success", "EndTime": "Nov 29, 2024 7:43:25 PM", "StartTime": "Nov 29, 2024 7:43:23 PM", "Time": 2630.0, "StepName": "runFixedCmds", "Action": "aws:runCommand" } } Automation Execution Status-change Notification { "version": "0", "id": "d290ece9-1088-4383-9df6-cd5b4ac42b99", "detail-type": "EC2 Automation Execution Status-change Notification", "source": "aws.ssm", "account": "123456789012", "time": "2024-11-29T19:43:35Z", "region": "us-east-2", "resources": ["arn:aws:ssm:us-east-2:123456789012:automation- execution/333ba70b-2333-48db-b17e-a5e69c6f4d1c", "arn:aws:ssm:us-east-2:123456789012:automation-definition/runcommand1:1"], "detail": { "ExecutionId": "333ba70b-2333-48db-b17e-a5e69c6f4d1c", "Definition": "runcommand1", "DefinitionVersion": 1.0, "Status": "Success", "StartTime": "Nov 29, 2024 7:43:20 PM", Amazon EventBridge event examples for Systems Manager 2902 AWS Systems Manager User Guide "EndTime": "Nov 29, 2024 7:43:26 PM", "Time": 5753.0, "ExecutedBy": "arn:aws:iam::123456789012:user/userName" } } AWS Systems Manager Change Calendar Events The following are examples of the events for AWS Systems Manager Change Calendar. Note State changes for calendars shared from other AWS accounts are not currently supported. Calendar OPEN { "version": "0", "id": "47a3f03a-f30d-1011-ac9a-du3bdEXAMPLE", "detail-type": "Calendar State Change", "source": "aws.ssm", "account": "123456789012", "time": "2024-09-19T18:00:07Z", "region": "us-east-2", "resources": [ "arn:aws:ssm:us-east-2:123456789012:document/MyCalendar" ], "detail": { "state": "OPEN", "atTime": "2024-09-19T18:00:07Z", "nextTransitionTime": "2024-10-11T18:00:07Z" } } Calendar CLOSED { "version": "0", "id": "f30df03a-1011-ac9a-47a3-f761eEXAMPLE", "detail-type": "Calendar State Change", "source": "aws.ssm", Amazon EventBridge event examples for Systems Manager 2903 AWS Systems Manager User Guide "account": "123456789012", "time": "2024-09-17T21:40:02Z", "region": "us-east-2", "resources": [ "arn:aws:ssm:us-east-2:123456789012:document/MyCalendar" ], "detail": { "state": "CLOSED", "atTime": "2024-08-17T21:40:00Z", "nextTransitionTime": "2024-09-19T18:00:07Z" } } AWS Systems Manager Change Manager Events Change request status update notification - example 1 { "version": "0", "id": "feab80c1-a8ff-c721-b8b1-96ce70939696", "detail-type": "Change Request Status Update", "source": "aws.ssm", "account": "123456789012", "time": "2024-10-24T10:51:52Z", "region": "us-east-1", "resources": [ "arn:aws:ssm:us-west-2:123456789012:opsitem/oi-12345abcdef", "arn:aws:ssm:us-west-2:123456789012:document/MyRunbook1" ], "detail": { "change-request-id": "d0585556-80f6-4522-8dad-dada6d45b67d", "change-request-title": "A change request title", "ops-item-id": "oi-12345abcdef", "ops-item-created-by": "arn:aws:iam::123456789012:user/JohnDoe", "ops-item-created-time": "2024-10-24T10:50:33.180334Z", "ops-item-modified-by": "arn:aws:iam::123456789012:user/JohnDoe", "ops-item-modified-time": "2024-10-24T10:50:33.180340Z", "ops-item-status": "InProgress", "change-template-document-name": "MyChangeTemplate", "runbook-document-arn": "arn:aws:ssm:us-west-2:123456789012:document/MyRunbook1", "runbook-document-version": "1", "auto-approve": true, "approvers": [ Amazon EventBridge event examples for Systems Manager 2904 AWS Systems Manager User Guide "arn:aws:iam::123456789012:user/JaneDoe" ] } } Change request status update notification - example 2 { "version": "0", "id": "25ce6b03-2e4e-1a2b-2a8f-6c9de8d278d2", "detail-type": "Change Request Status Update", "source": "aws.ssm", "account": "123456789012", "time": "2024-10-24T10:51:52Z", "region": "us-east-1", "resources": [ "arn:aws:ssm:us-west-2:123456789012:opsitem/oi-abcdef12345", "arn:aws:ssm:us-west-2:123456789012:document/MyRunbook1" ], "detail": { "change-request-id": "d0585556-80f6-4522-8dad-dada6d45b67d", "change-request-title": "A change request title", "ops-item-id": "oi-abcdef12345", "ops-item-created-by": "arn:aws:iam::123456789012:user/JohnDoe", "ops-item-created-time": "2024-10-24T10:50:33.180334Z", "ops-item-modified-by": "arn:aws:iam::123456789012:user/JohnDoe", "ops-item-modified-time": "2024-10-24T10:50:33.997163Z", "ops-item-status": "Rejected", "change-template-document-name": "MyChangeTemplate", "runbook-document-arn": "arn:aws:ssm:us-west-2:123456789012:document/MyRunbook1", "runbook-document-version": "1", "auto-approve": true, "approvers": [ "arn:aws:iam::123456789012:user/JaneDoe" ] } } AWS Systems Manager Compliance Events The following are examples of the events for AWS Systems Manager Compliance. Association Compliant Amazon EventBridge event examples for Systems Manager 2905 AWS Systems Manager { "version": "0", User Guide "id": "01234567-0123-0123-0123-012345678901", "detail-type": "Configuration Compliance State Change", "source": "aws.ssm", "account": "123456789012", "time": "2024-07-17T19:03:26Z", "region": "us-east-2", "resources": [ "arn:aws:ssm:us-east-2:123456789012:managed-instance/i-01234567890abcdef" ], "detail": { "last-runtime": "2024-01-01T10:10:10Z", "compliance-status": "compliant", "resource-type": "managed-instance", "resource-id": "i-01234567890abcdef", "compliance-type": "Association" } } Association Non-Compliant { "version": "0", "id": "01234567-0123-0123-0123-012345678901", "detail-type": "Configuration Compliance State Change", "source": "aws.ssm", "account": "123456789012", "time": "2024-07-17T19:02:31Z", "region": "us-east-2", "resources": [ "arn:aws:ssm:us-east-2:123456789012:managed-instance/i-01234567890abcdef" ], "detail": { "last-runtime": "2024-01-01T10:10:10Z", "compliance-status": "non_compliant", "resource-type": "managed-instance", "resource-id": "i-01234567890abcdef", "compliance-type": "Association" } } Amazon EventBridge event examples for Systems Manager 2906 User Guide AWS Systems Manager Patch Compliant { "version": "0", "id": "01234567-0123-0123-0123-012345678901", "detail-type": "Configuration Compliance State Change", "source": "aws.123456789012", "account": "123456789012", "time": "2024-07-17T19:03:26Z", "region": "us-east-2", "resources": [ "arn:aws:ssm:us-east-2:123456789012:managed-instance/i-01234567890abcdef" ], "detail":
systems-manager-ug-821
systems-manager-ug.pdf
821
"account": "123456789012", "time": "2024-07-17T19:03:26Z", "region": "us-east-2", "resources": [ "arn:aws:ssm:us-east-2:123456789012:managed-instance/i-01234567890abcdef" ], "detail": { "last-runtime": "2024-01-01T10:10:10Z", "compliance-status": "compliant", "resource-type": "managed-instance", "resource-id": "i-01234567890abcdef", "compliance-type": "Association" } } Association Non-Compliant { "version": "0", "id": "01234567-0123-0123-0123-012345678901", "detail-type": "Configuration Compliance State Change", "source": "aws.ssm", "account": "123456789012", "time": "2024-07-17T19:02:31Z", "region": "us-east-2", "resources": [ "arn:aws:ssm:us-east-2:123456789012:managed-instance/i-01234567890abcdef" ], "detail": { "last-runtime": "2024-01-01T10:10:10Z", "compliance-status": "non_compliant", "resource-type": "managed-instance", "resource-id": "i-01234567890abcdef", "compliance-type": "Association" } } Amazon EventBridge event examples for Systems Manager 2906 User Guide AWS Systems Manager Patch Compliant { "version": "0", "id": "01234567-0123-0123-0123-012345678901", "detail-type": "Configuration Compliance State Change", "source": "aws.123456789012", "account": "123456789012", "time": "2024-07-17T19:03:26Z", "region": "us-east-2", "resources": [ "arn:aws:ssm:us-east-2:123456789012:managed-instance/i-01234567890abcdef" ], "detail": { "resource-type": "managed-instance", "resource-id": "i-01234567890abcdef", "compliance-status": "compliant", "compliance-type": "Patch", "patch-baseline-id": "PB789", "severity": "critical" } } Patch Non-Compliant { "version": "0", "id": "01234567-0123-0123-0123-012345678901", "detail-type": "Configuration Compliance State Change", "source": "aws.ssm", "account": "123456789012", "time": "2024-07-17T19:02:31Z", "region": "us-east-2", "resources": [ "arn:aws:ssm:us-east-2:123456789012:managed-instance/i-01234567890abcdef" ], "detail": { "resource-type": "managed-instance", "resource-id": "i-01234567890abcdef", "compliance-status": "non_compliant", "compliance-type": "Patch", "patch-baseline-id": "PB789", "severity": "critical" Amazon EventBridge event examples for Systems Manager 2907 AWS Systems Manager } } User Guide AWS Systems Manager Maintenance Windows Events The following are examples of the events for Systems Manager Maintenance Windows. Register a Target The other valid status value is DEREGISTERED. { "version":"0", "id":"01234567-0123-0123-0123-0123456789ab", "detail-type":"Maintenance Window Target Registration Notification", "source":"aws.ssm", "account":"123456789012", "time":"2024-11-16T00:58:37Z", "region":"us-east-2", "resources":[ "arn:aws:ssm:us-east-2:123456789012:maintenancewindow/mw-0ed7251d3fcf6e0c2", "arn:aws:ssm:us-east-2:123456789012:windowtarget/ e7265f13-3cc5-4f2f-97a9-7d3ca86c32a6" ], "detail":{ "window-target-id":"e7265f13-3cc5-4f2f-97a9-7d3ca86c32a6", "window-id":"mw-0ed7251d3fcf6e0c2", "status":"REGISTERED" } } Window Execution Type The other valid status values are PENDING, IN_PROGRESS, SUCCESS, FAILED, TIMED_OUT, and SKIPPED_OVERLAPPING. { "version":"0", "id":"01234567-0123-0123-0123-0123456789ab", "detail-type":"Maintenance Window Execution State-change Notification", "source":"aws.ssm", "account":"123456789012", "time":"2024-11-16T01:00:57Z", Amazon EventBridge event examples for Systems Manager 2908 AWS Systems Manager "region":"us-east-2", User Guide "resources":[ "arn:aws:ssm:us-east-2:123456789012:maintenancewindow/mw-0c50858d01EXAMPLE" ], "detail":{ "start-time":"2024-11-16T01:00:56.427Z", "end-time":"2024-11-16T01:00:57.070Z", "window-id":"mw-0ed7251d3fcf6e0c2", "window-execution-id":"14bea65d-5ccc-462d-a2f3-e99c8EXAMPLE", "status":"TIMED_OUT" } } Task Execution Type The other valid status values are IN_PROGRESS, SUCCESS, FAILED, and TIMED_OUT. { "version":"0", "id":"01234567-0123-0123-0123-0123456789ab", "detail-type":"Maintenance Window Task Execution State-change Notification", "source":"aws.ssm", "account":"123456789012", "time":"2024-11-16T01:00:56Z", "region":"us-east-2", "resources":[ "arn:aws:ssm:us-east-2:123456789012:maintenancewindow/mw-0c50858d01EXAMPLE" ], "detail":{ "start-time":"2024-11-16T01:00:56.759Z", "task-execution-id":"6417e808-7f35-4d1a-843f-123456789012", "end-time":"2024-11-16T01:00:56.847Z", "window-id":"mw-0ed7251d3fcf6e0c2", "window-execution-id":"14bea65d-5ccc-462d-a2f3-e99c8EXAMPLE", "status":"TIMED_OUT" } } Task Target Processed The other valid status values are IN_PROGRESS, SUCCESS, FAILED, and TIMED_OUT. { Amazon EventBridge event examples for Systems Manager 2909 AWS Systems Manager "version":"0", User Guide "id":"01234567-0123-0123-0123-0123456789ab", "detail-type":"Maintenance Window Task Target Invocation State-change Notification", "source":"aws.ssm", "account":"123456789012", "time":"2024-11-16T01:00:57Z", "region":"us-east-2", "resources":[ "arn:aws:ssm:us-east-2:123456789012:maintenancewindow/mw-123456789012345678" ], "detail":{ "start-time":"2024-11-16T01:00:56.427Z", "end-time":"2024-11-16T01:00:57.070Z", "window-id":"mw-0ed7251d3fcf6e0c2", "window-execution-id":"791b72e0-f0da-4021-8b35-f95dfEXAMPLE", "task-execution-id":"c9b05aba-197f-4d8d-be34-e73fbEXAMPLE", "window-target-id":"e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE", "status":"TIMED_OUT", "owner-information":"Owner" } } Window State Change The valid status values are ENABLED and DISABLED. { "version":"0", "id":"01234567-0123-0123-0123-0123456789ab", "detail-type":"Maintenance Window State-change Notification", "source":"aws.ssm", "account":"123456789012", "time":"2024-11-16T00:58:37Z", "region":"us-east-2", "resources":[ "arn:aws:ssm:us-east-2:123456789012:maintenancewindow/mw-0c50858d01EXAMPLE" ], "detail":{ "window-id":"mw-0c50858d01EXAMPLE", "status":"DISABLED" } } Amazon EventBridge event examples for Systems Manager 2910 AWS Systems Manager User Guide AWS Systems Manager Parameter Store Events The following are examples of the events for Systems Manager Parameter Store. Create Parameter { "version": "0", "id": "6a7e4feb-b491-4cf7-a9f1-bf3703497718", "detail-type": "Parameter Store Change", "source": "aws.ssm", "account": "123456789012", "time": "2024-05-22T16:43:48Z", "region": "us-east-2", "resources": [ "arn:aws:ssm:us-east-2:123456789012:parameter/MyExampleParameter" ], "detail": { "operation": "Create", "name": "MyExampleParameter", "type": "String", "description": "Sample Parameter" } } Update Parameter { "version": "0", "id": "9547ef2d-3b7e-4057-b6cb-5fdf09ee7c8f", "detail-type": "Parameter Store Change", "source": "aws.ssm", "account": "123456789012", "time": "2024-05-22T16:44:48Z", "region": "us-east-2", "resources": [ "arn:aws:ssm:us-east-2:123456789012:parameter/MyExampleParameter" ], "detail": { "operation": "Update", "name": "MyExampleParameter", "type": "String", Amazon EventBridge event examples for Systems Manager 2911 AWS Systems Manager User Guide "description": "Sample Parameter" } } Delete Parameter { "version": "0", "id": "80e9b391-6a9b-413c-839a-453b528053af", "detail-type": "Parameter Store Change", "source": "aws.ssm", "account": "123456789012", "time": "2024-05-22T16:45:48Z", "region": "us-east-2", "resources": [ "arn:aws:ssm:us-east-2:123456789012:parameter/MyExampleParameter" ], "detail": { "operation": "Delete", "name": "MyExampleParameter", "type": "String", "description": "Sample Parameter" } } AWS Systems Manager OpsCenter Events OpsCenter OpsItem create notification { "version": "0", "id": "aae66adc-7aac-f0c0-7854-7691e8c079b8", "detail-type": "OpsItem Create", "source": "aws.ssm", "account": "123456789012", "time": "2024-10-19T02:48:11Z", "region": "us-east-1", "resources": [ "arn:aws:ssm:us-west-2:123456789012:opsitem/oi-123456abcdef" ], "detail": { "created-by": "arn:aws:iam::123456789012:user/JohnDoe", Amazon EventBridge event examples for Systems Manager 2912 AWS Systems Manager User Guide "created-time": "2024-10-19T02:46:53.629361Z", "source": "aws.ssm", "status": "Open", "ops-item-id": "oi-123456abcdef", "title": "An issue title", "ops-item-type": "/aws/issue", "description": "A long description may appear here" } } OpsCenter OpsItem update notification { "version": "0", "id": "2fb5b168-b725-41dd-a890-29311200089c", "detail-type": "OpsItem Update", "source": "aws.ssm", "account": "123456789012", "time": "2024-10-19T02:48:11Z", "region": "us-east-1", "resources": [ "arn:aws:ssm:us-west-2:123456789012:opsitem/oi-123456abcdef" ], "detail": { "created-by": "arn:aws:iam::123456789012:user/JohnDoe", "created-time": "2024-10-19T02:46:54.049271Z", "modified-by": "arn:aws:iam::123456789012:user/JohnDoe", "modified-time": "2024-10-19T02:46:54.337354Z", "source": "aws.ssm", "status": "Open", "ops-item-id": "oi-123456abcdef", "title": "An issue title", "ops-item-type": "/aws/issue", "description": "A long description may appear here" } } AWS Systems Manager Run Command Events Run Command Status-change Notification { "version": "0", Amazon EventBridge event examples for Systems Manager 2913 AWS Systems Manager User Guide "id": "51c0891d-0e34-45b1-83d6-95db273d1602", "detail-type": "EC2 Command Status-change Notification", "source": "aws.ssm", "account": "123456789012", "time": "2024-07-10T21:51:32Z", "region": "us-east-2", "resources": ["arn:aws:ec2:us-east-2:123456789012:instance/i-02573cafcfEXAMPLE"], "detail": { "command-id": "e8d3c0e4-71f7-4491-898f-c9b35bee5f3b", "document-name": "AWS-RunPowerShellScript", "expire-after": "2024-07-14T22:01:30.049Z", "parameters": { "executionTimeout": ["3600"], "commands": ["date"] }, "requested-date-time": "2024-07-10T21:51:30.049Z", "status": "Success" } } Run Command Invocation Status-change Notification { "version": "0", "id": "4780e1b8-f56b-4de5-95f2-95dbEXAMPLE", "detail-type": "EC2 Command Invocation Status-change Notification", "source": "aws.ssm", "account": "123456789012", "time": "2024-07-10T21:51:32Z", "region": "us-east-2", "resources": ["arn:aws:ec2:us-east-2:123456789012:instance/i-02573cafcfEXAMPLE"], "detail": { "command-id": "e8d3c0e4-71f7-4491-898f-c9b35bee5f3b", "document-name": "AWS-RunPowerShellScript", "instance-id": "i-02573cafcfEXAMPLE", "requested-date-time": "2024-07-10T21:51:30.049Z", "status": "Success" } } AWS Systems Manager State Manager Events State Manager Association State Change Amazon EventBridge event examples for Systems Manager 2914 User Guide AWS Systems Manager {
systems-manager-ug-822
systems-manager-ug.pdf
822
"EC2 Command Status-change Notification", "source": "aws.ssm", "account": "123456789012", "time": "2024-07-10T21:51:32Z", "region": "us-east-2", "resources": ["arn:aws:ec2:us-east-2:123456789012:instance/i-02573cafcfEXAMPLE"], "detail": { "command-id": "e8d3c0e4-71f7-4491-898f-c9b35bee5f3b", "document-name": "AWS-RunPowerShellScript", "expire-after": "2024-07-14T22:01:30.049Z", "parameters": { "executionTimeout": ["3600"], "commands": ["date"] }, "requested-date-time": "2024-07-10T21:51:30.049Z", "status": "Success" } } Run Command Invocation Status-change Notification { "version": "0", "id": "4780e1b8-f56b-4de5-95f2-95dbEXAMPLE", "detail-type": "EC2 Command Invocation Status-change Notification", "source": "aws.ssm", "account": "123456789012", "time": "2024-07-10T21:51:32Z", "region": "us-east-2", "resources": ["arn:aws:ec2:us-east-2:123456789012:instance/i-02573cafcfEXAMPLE"], "detail": { "command-id": "e8d3c0e4-71f7-4491-898f-c9b35bee5f3b", "document-name": "AWS-RunPowerShellScript", "instance-id": "i-02573cafcfEXAMPLE", "requested-date-time": "2024-07-10T21:51:30.049Z", "status": "Success" } } AWS Systems Manager State Manager Events State Manager Association State Change Amazon EventBridge event examples for Systems Manager 2914 User Guide AWS Systems Manager { "version":"0", "id":"db839caf-6f6c-40af-9a48-25b2ae2b7774", "detail-type":"EC2 State Manager Association State Change", "source":"aws.ssm", "account":"123456789012", "time":"2024-05-16T23:01:10Z", "region":"us-east-2", "resources":[ "arn:aws:ssm:us-east-2::document/AWS-RunPowerShellScript" ], "detail":{ "association-id":"6e37940a-23ba-4ab0-9b96-5d0a1a05464f", "document-name":"AWS-RunPowerShellScript", "association-version":"1", "document-version":"Optional.empty", "targets":"[{\"key\":\"InstanceIds\",\"values\":[\"i-12345678\"]}]", "creation-date":"2024-02-13T17:22:54.458Z", "last-successful-execution-date":"2024-05-16T23:00:01Z", "last-execution-date":"2024-05-16T23:00:01Z", "last-updated-date":"2024-02-13T17:22:54.458Z", "status":"Success", "association-status-aggregated-count":"{\"Success\":1}", "schedule-expression":"cron(0 */30 * * * ? *)", "association-cwe-version":"1.0" } } State Manager Instance Association State Change { "version":"0", "id":"6a7e8feb-b491-4cf7-a9f1-bf3703467718", "detail-type":"EC2 State Manager Instance Association State Change", "source":"aws.ssm", "account":"123456789012", "time":"2024-02-23T15:23:48Z", "region":"us-east-2", "resources":[ "arn:aws:ec2:us-east-2:123456789012:instance/i-12345678", "arn:aws:ssm:us-east-2:123456789012:document/my-custom-document" ], "detail":{ Amazon EventBridge event examples for Systems Manager 2915 AWS Systems Manager User Guide "association-id":"34fcb7e0-9a14-4984-9989-0e04e3f60bd8", "instance-id":"i-02573cafcfEXAMPLE", "document-name":"my-custom-document", "document-version":"1", "targets":"[{\"key\":\"instanceids\",\"values\":[\"i-02573cafcfEXAMPLE\"]}]", "creation-date":"2024-02-23T15:23:48Z", "last-successful-execution-date":"2024-02-23T16:23:48Z", "last-execution-date":"2024-02-23T16:23:48Z", "status":"Success", "detailed-status":"", "error-code":"testErrorCode", "execution-summary":"testExecutionSummary", "output-url":"sampleurl", "instance-association-cwe-version":"1" } } Sample scenarios: Systems Manager targets in Amazon EventBridge rules When you specify the target to invoke in an Amazon EventBridge rule, you can choose from over 20 target types and add up to five targets to each rule. Of the various targets, you can choose from Automation, OpsCenter, and Run Command, which are tools in AWS Systems Manager, as target actions when an EventBridge event occurs. The following are several examples of ways you can use these tools as the target of an EventBridge rule. Automation examples You can configure an EventBridge rule to start Automation workflows when events such as the following occur: • When an Amazon CloudWatch alarm reports that a managed node has failed a status check (StatusCheckFailed_Instance=1), run the AWSSupport-ExecuteEC2Rescue Automation runbook on the node. • When an EC2 Instance State-change Notification event occurs because a new Amazon Elastic Compute Cloud (Amazon EC2) instance is running, run the AWS-AttachEBSVolume Automation runbook on the instance. Sample scenarios: Systems Manager targets in Amazon EventBridge rules 2916 AWS Systems Manager User Guide • When an Amazon Elastic Block Store (Amazon EBS) volume is created and available, run the AWS-CreateSnapshot Automation runbook on the volume. OpsCenter examples You can configure an EventBridge rule to create a new OpsItem when incidents such as the following occur: • A throttling event for Amazon DynamoDB occurs, or Amazon EBS volume performance has degraded. • An Amazon EC2 Auto Scaling group fails to launch a node, or a Systems Manager Automation workflow fails. • An EC2 instance changes state from Running to Stopped. Run Command examples You can configure an EventBridge rule to run a Systems Manager Command document in Run Command when events such as the following occur: • When an Auto Scaling group is about to end, a Run Command script could capture the log files from the node before it is ended. • When a new node is created in an Auto Scaling group, a Run Command target action could turn on the web server role or install software on the node. • When a managed node is found to be out of compliance, a Run Command target action could update patches on the node by running the AWS-RunPatchBaseline document. Monitoring Systems Manager status changes using Amazon SNS notifications You can configure Amazon Simple Notification Service (Amazon SNS) to send notifications about the status of commands that you send using Run Command or Maintenance Windows, which are tools in AWS Systems Manager. Amazon SNS coordinates and manages sending and delivering notifications to clients or endpoints that are subscribed to Amazon SNS topics. You can receive a notification whenever a command changes to a new state or to a specific state, such as Failed or Timed Out. In cases where you send a command to multiple nodes, you can receive a notification for each copy of the command sent to a specific node. Each copy is called an invocation. Monitoring Systems Manager status changes using Amazon SNS notifications 2917 AWS Systems Manager User Guide Amazon SNS can deliver notifications as HTTP or HTTPS POST, email (SMTP, either plaintext or in JSON format), or as a message posted to an Amazon Simple Queue Service (Amazon SQS) queue. For more information, see What is Amazon SNS in the Amazon Simple Notification Service Developer Guide. For examples of the structure of the JSON data included in the Amazon SNS notification provided by Run Command and Maintenance Windows, see Example Amazon SNS notifications for AWS Systems Manager. Important Note the following important information. • Amazon Simple Notification Service FIFO topics aren't supported. • Amazon Q Developer in chat applications isn't supported for monitoring Systems Manager
systems-manager-ug-823
systems-manager-ug.pdf
823
or HTTPS POST, email (SMTP, either plaintext or in JSON format), or as a message posted to an Amazon Simple Queue Service (Amazon SQS) queue. For more information, see What is Amazon SNS in the Amazon Simple Notification Service Developer Guide. For examples of the structure of the JSON data included in the Amazon SNS notification provided by Run Command and Maintenance Windows, see Example Amazon SNS notifications for AWS Systems Manager. Important Note the following important information. • Amazon Simple Notification Service FIFO topics aren't supported. • Amazon Q Developer in chat applications isn't supported for monitoring Systems Manager with Amazon SNS. If you wish to use Amazon Q Developer in chat applications to monitor Systems Manager, you must use it with Amazon EventBridge. For information about monitoring Systems Manager using EventBridge, see Monitoring Systems Manager events with Amazon EventBridge. For information about Amazon EventBridge and Amazon Q Developer in chat applications, see Tutorial: Creating an EventBridge rule that sends notifications to Amazon Q Developer in chat applications in the Amazon Q Developer in chat applications Administrator Guide. Configure Amazon SNS notifications for AWS Systems Manager Run Command and Maintenance Windows tasks that are registered to a maintenance window can send Amazon SNS notifications for command tasks that enter the following statuses: • In Progress • Success • Failed • Timed Out • Cancelled For information about the conditions that cause a command to enter one of these statuses, see Understanding command statuses. Configure Amazon SNS notifications for AWS Systems Manager 2918 AWS Systems Manager Note User Guide Commands sent using Run Command also report Canceling and Pending status. These statuses aren't captured by Amazon SNS notifications. Command summary Amazon SNS notifications If you configure Run Command or a Run Command task in your maintenance window for Amazon SNS notifications, Amazon SNS sends summary messages that include the following information. Field eventTime Type String documentName String commandId String expiresAfter Date outputS3BucketName String Description The time that the event was initiated. The timestamp is important because Amazon SNS doesn't guarantee message delivery order. Example: 2016-04-2 6T13:15:30Z The name of the SSM document used to run this command. The ID generated by Run Command after the command was sent. If this time is reached and the command hasn't already started executing, it won't run. The Amazon Simple Storage Service (Amazon S3) bucket where the responses to the Configure Amazon SNS notifications for AWS Systems Manager 2919 AWS Systems Manager User Guide Field Type Description outputS3KeyPrefix String requestedDateTime String instanceIds StringList command execution should be stored. The Amazon S3 directory path inside the bucket where the responses to the command execution should be stored. The time and date that the request was sent to this specific node. The nodes that were targeted by the command. Note Instance IDs are only included in the summary message if the Run Command task targeted instance IDs directly. Instance IDs aren't included in the summary message if the Run Command task was issued using tag-based targeting. status String Command status for the command. Configure Amazon SNS notifications for AWS Systems Manager 2920 AWS Systems Manager User Guide Invocation-based Amazon SNS notifications If you send a command to multiple nodes, Amazon SNS can send messages about each copy or invocation of the command. The messages include the following information. Field eventTime Type String documentName String requestedDateTime String commandId String instanceId status String String Description The time that the event was initiated. The timestamp is important because Amazon SNS doesn't guarantee message delivery order. Example: 2016-04-2 6T13:15:30Z The name of the Systems Manager document (SSM document) used to run this command. The time and date that the request was sent to this specific node. The ID generated by Run Command after the command was sent. The instance that was targeted by the command. Command status for this invocation. To set up Amazon SNS notifications when a command changes status, complete the following tasks. Configure Amazon SNS notifications for AWS Systems Manager 2921 AWS Systems Manager Note User Guide If you aren't configuring Amazon SNS notifications for your maintenance window, then you can skip Task 5 later in this topic. Topics • Task 1: Create and subscribe to an Amazon SNS topic • Task 2: Create an IAM policy for Amazon SNS notifications • Task 3: Create an IAM role for Amazon SNS notifications • Task 4: Configure user access • Task 5: Attach the iam:PassRole policy to your maintenance window role Task 1: Create and subscribe to an Amazon SNS topic An Amazon SNS topic is a communication channel that Run Command and Run Command tasks that are registered to a maintenance window use to send notifications about the status of your commands. Amazon SNS supports different communication protocols, including HTTP/S, email, and other AWS services like Amazon
systems-manager-ug-824
systems-manager-ug.pdf
824
Amazon SNS topic • Task 2: Create an IAM policy for Amazon SNS notifications • Task 3: Create an IAM role for Amazon SNS notifications • Task 4: Configure user access • Task 5: Attach the iam:PassRole policy to your maintenance window role Task 1: Create and subscribe to an Amazon SNS topic An Amazon SNS topic is a communication channel that Run Command and Run Command tasks that are registered to a maintenance window use to send notifications about the status of your commands. Amazon SNS supports different communication protocols, including HTTP/S, email, and other AWS services like Amazon Simple Queue Service (Amazon SQS). To get started, we recommend that you start with the email protocol. For information about how to create a topic, see Creating an Amazon SNS topic in the Amazon Simple Notification Service Developer Guide. Note After you create the topic, copy or make a note of the Topic ARN. You specify this ARN when you send a command that is configured to return status notifications. After you create the topic, subscribe to it by specifying an Endpoint. If you chose the Email protocol, the endpoint is the email address where you want to receive notifications. For more information about how to subscribe to a topic, see Subscribing to an Amazon SNS topic in the Amazon Simple Notification Service Developer Guide. Amazon SNS sends a confirmation email from AWS Notifications to the email address that you specify. Open the email and choose the Confirm subscription link. Configure Amazon SNS notifications for AWS Systems Manager 2922 AWS Systems Manager User Guide You will receive an acknowledgement message from AWS. Amazon SNS is now configured to receive notifications and send the notification as an email to the email address that you specified. Task 2: Create an IAM policy for Amazon SNS notifications Use the following procedure to create a custom AWS Identity and Access Management (IAM) policy that provides permissions for inititating Amazon SNS notifications. To create a custom IAM policy for Amazon SNS notifications 1. Open the IAM console at https://console.aws.amazon.com/iam/. 2. In the navigation pane, choose Policies, and then choose Create Policy. (If a Get Started button is shown, choose it, and then choose Create Policy.) 3. Choose the JSON tab. 4. Replace the default content with one of the following, depending on whether the Amazon SNS topic uses AWS KMS encryption: SNS topic not encrypted { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sns:Publish" ], "Resource": "arn:aws:sns:region:account-id:sns-topic-name" } ] } region represents the identifier for an AWS Region supported by AWS Systems Manager, such as us-east-2 for the US East (Ohio) Region. For a list of supported region values, see the Region column in Systems Manager service endpoints in the Amazon Web Services General Reference. account-id represents the 12-digit identifier for your AWS account, in the format 123456789012. Configure Amazon SNS notifications for AWS Systems Manager 2923 AWS Systems Manager User Guide sns-topic-name represents the name of the Amazon SNS topic you want to use for publishing notifications. SNS topic encrypted { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "sns:Publish" ], "Resource": "arn:aws:sns:region:account-id:sns-topic-name" }, { "Effect": "Allow", "Action": [ "kms:GenerateDataKey", "kms:Decrypt" ], "Resource": "arn:aws:kms:region:account-id:key/kms-key-id" } ] } region represents the identifier for an AWS Region supported by AWS Systems Manager, such as us-east-2 for the US East (Ohio) Region. For a list of supported region values, see the Region column in Systems Manager service endpoints in the Amazon Web Services General Reference. account-id represents the 12-digit identifier for your AWS account, in the format 123456789012. sns-topic-name represents the name of the Amazon SNS topic you want to use for publishing notifications. kms-key-id represents the ID of the symmetric encryption KMS key in AWS KMS to use for encrypting and decrypting the topic, in the format 1234abcd-12ab-34cd-56ef-12345EXAMPLE. Configure Amazon SNS notifications for AWS Systems Manager 2924 AWS Systems Manager User Guide Note There is a charge for using AWS KMS encryption. For more information, see Managing Amazon SNS encryption keys and costs in the AWS Key Management Service Developer Guide. 5. Choose Next: Tags. 6. (Optional) Add one or more tag-key value pairs to organize, track, or control access for this policy. 7. Choose Next: Review. 8. On the Review policy page, for Name, enter a name for the inline policy. For example: my- sns-publish-permissions. 9. (Optional) For Description, enter a description for the policy. 10. Choose Create policy. Task 3: Create an IAM role for Amazon SNS notifications Use the following procedure to create an IAM role for Amazon SNS notifications. This service role is used by Systems Manager to initiate Amazon SNS notifications. In all subsequent procedures, this role is referred to as the Amazon SNS IAM role. To create an IAM service role for Amazon SNS notifications 1. Sign
systems-manager-ug-825
systems-manager-ug.pdf
825
7. Choose Next: Review. 8. On the Review policy page, for Name, enter a name for the inline policy. For example: my- sns-publish-permissions. 9. (Optional) For Description, enter a description for the policy. 10. Choose Create policy. Task 3: Create an IAM role for Amazon SNS notifications Use the following procedure to create an IAM role for Amazon SNS notifications. This service role is used by Systems Manager to initiate Amazon SNS notifications. In all subsequent procedures, this role is referred to as the Amazon SNS IAM role. To create an IAM service role for Amazon SNS notifications 1. Sign in to the AWS Management Console and open the IAM console at https:// console.aws.amazon.com/iam/. 2. In the navigation pane of the IAM console, choose Roles, and then choose Create role. 3. Choose the AWS service role type, and then choose Systems Manager. 4. Choose the Systems Manager use case. Then, choose Next. 5. On the Attach permissions policies page, select the box to the left of the name of the custom policy you created in Task 2. For example: my-sns-publish-permissions. 6. (Optional) Set a permissions boundary. This is an advanced feature that is available for service roles, but not service-linked roles. Expand the Permissions boundary section and choose Use a permissions boundary to control the maximum role permissions. IAM includes a list of the AWS managed and Configure Amazon SNS notifications for AWS Systems Manager 2925 AWS Systems Manager User Guide customer managed policies in your account. Select the policy to use for the permissions boundary or choose Create policy to open a new browser tab and create a new policy from scratch. For more information, see Creating IAM policies in the IAM User Guide. After you create the policy, close that tab and return to your original tab to select the policy to use for the permissions boundary. 7. Choose Next. 8. If possible, enter a role name or role name suffix to help you identify the purpose of this role. Role names must be unique within your AWS account. They are not distinguished by case. For example, you cannot create roles named both PRODROLE and prodrole. Because various entities might reference the role, you cannot edit the name of the role after it has been created. 9. (Optional) For Description, enter a description for the new role. 10. Choose Edit in the Step 1: Select trusted entities or Step 2: Select permissions sections to edit the use cases and permissions for the role. 11. (Optional) Add metadata to the user by attaching tags as key-value pairs. For more information about using tags in IAM, see Tagging IAM resources in the IAM User Guide. 12. Review the role and then choose Create role. 13. Choose the name of the role, and then copy or make a note of the Role ARN value. This Amazon Resource Name (ARN) for the role is used when you send a command that is configured to return Amazon SNS notifications. 14. Keep the Summary page open. Task 4: Configure user access If an IAM entity (user, role, or group) is assigned administrator permissions, then the user or role has access to Run Command and Maintenance Windows, tools in AWS Systems Manager. For entities without administrator permissions, an administrator must grant the following permissions to the IAM entity: • The AmazonSSMFullAccess managed policy, or a policy that provides comparable permissions. • iam:PassRole permissions for the role created in Task 3: Create an IAM role for Amazon SNS notifications. For example: Configure Amazon SNS notifications for AWS Systems Manager 2926 AWS Systems Manager User Guide { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "iam:PassRole", "Resource": "arn:aws:iam::account-id:role/sns-role-name" } ] } To provide access, add permissions to your users, groups, or roles: • Users and groups in AWS IAM Identity Center: Create a permission set. Follow the instructions in Create a permission set in the AWS IAM Identity Center User Guide. • Users managed in IAM through an identity provider: Create a role for identity federation. Follow the instructions in Create a role for a third-party identity provider (federation) in the IAM User Guide. • IAM users: • Create a role that your user can assume. Follow the instructions in Create a role for an IAM user in the IAM User Guide. • (Not recommended) Attach a policy directly to a user or add a user to a user group. Follow the instructions in Adding permissions to a user (console) in the IAM User Guide. To configure user access and attach the iam:PassRole policy to a user account 1. In the IAM navigation pane, choose Users, and then choose the user account that you want to configure. 2. On the Permissions tab, in the policies list, verify that either the AmazonSSMFullAccess policy is listed or that there
systems-manager-ug-826
systems-manager-ug.pdf
826
the instructions in Create a role for an IAM user in the IAM User Guide. • (Not recommended) Attach a policy directly to a user or add a user to a user group. Follow the instructions in Adding permissions to a user (console) in the IAM User Guide. To configure user access and attach the iam:PassRole policy to a user account 1. In the IAM navigation pane, choose Users, and then choose the user account that you want to configure. 2. On the Permissions tab, in the policies list, verify that either the AmazonSSMFullAccess policy is listed or that there is a comparable policy that gives the account permissions to access Systems Manager. 3. Choose Add inline policy. 4. On the Create policy page, choose the Visual editor tab. 5. Choose Choose a service, and then choose IAM. Configure Amazon SNS notifications for AWS Systems Manager 2927 AWS Systems Manager User Guide 6. 7. 8. For Actions, in the Filter actions text box, enter PassRole, and then select the check box next to PassRole. For Resources, verify that Specific is selected, and then choose Add ARN. In the Specify ARN for role field, paste the Amazon SNS IAM role ARN that you copied at the end of Task 3. The system automatically populates the Account and Role name with path fields. 9. Choose Add. 10. Choose Review policy. 11. On the Review Policy page, enter a name and then choose Create policy. Task 5: Attach the iam:PassRole policy to your maintenance window role When you register a Run Command task with a maintenance window, you specify a service role Amazon Resource Name (ARN). This service role is used by Systems Manager to run tasks registered to the maintenance window. To configure Amazon SNS notifications for a registered Run Command task, attach an iam:PassRole policy to the maintenance window service role specified. If you don't intend to configure the registered task for Amazon SNS notifications, then you can skip this task. The iam:PassRole policy allows the Maintenance Windows service role to pass the Amazon SNS IAM role created in Task 3 to the Amazon SNS service. The following procedure shows how to attach the iam:PassRole policy to the Maintenance Windows service role. Note Use a custom service role for your maintenance window to send notifications related to the Run Command tasks registered. For information, see Setting up Maintenance Windows. If you need to create a custom service role for maintenance window tasks, see Setting up Maintenance Windows. To attach the iam:PassRole policy to your Maintenance Windows role 1. Open the IAM console at https://console.aws.amazon.com/iam/. 2. In the navigation pane, choose Roles and select the Amazon SNS IAM role created in Task 3. 3. Copy or make a note of the Role ARN and return to the Roles section of the IAM console. Configure Amazon SNS notifications for AWS Systems Manager 2928 AWS Systems Manager User Guide 4. Select the custom Maintenance Windows service role you created from the Role name list. 5. On the Permissions tab, verify that either the AmazonSSMMaintenanceWindowRole policy is listed or there is a comparable policy that gives maintenance windows permission to the Systems Manager API. If it is not, choose Add permissions, Attach policies to attach it. 6. Choose Add permissions, Create inline policy. 7. Choose the Visual editor tab. 8. 9. For Service, choose IAM. For Actions, in the Filter actions text box, enter PassRole, and then select the check box next to PassRole. 10. For Resources, choose Specific, and then choose Add ARN. 11. In the Specify ARN for role box, paste the ARN of the Amazon SNS IAM role created in Task 3, and then choose Add. 12. Choose Review policy. 13. On the Review policy page, specify a name for the PassRole policy, and then choose Create policy. Example Amazon SNS notifications for AWS Systems Manager You can configure Amazon Simple Notification Service (Amazon SNS) to send notifications about the status of commands that you send using Run Command or Maintenance Windows, which are tools in AWS Systems Manager. Note This guide doesn't address how to configure notifications for Run Command or Maintenance Windows. For information about configuring Run Command or Maintenance Windows to send Amazon SNS notifications about the status of commands, see Configure Amazon SNS notifications for AWS Systems Manager. The following examples show the structure of the JSON output returned by Amazon SNS notifications when configured for Run Command or Maintenance Windows. Sample JSON Output for Command summary messages using instance ID targeting Example Amazon SNS notifications for AWS Systems Manager 2929 AWS Systems Manager User Guide { "commandId": "a8c7e76f-15f1-4c33-9052-0123456789ab", "documentName": "AWS-RunPowerShellScript", "instanceIds": [ "i-1234567890abcdef0", "i-9876543210abcdef0" ], "requestedDateTime": "2019-04-25T17:57:09.17Z", "expiresAfter": "2019-04-25T19:07:09.17Z", "outputS3BucketName": "amzn-s3-demo-bucket", "outputS3KeyPrefix": "runcommand", "status": "InProgress", "eventTime": "2019-04-25T17:57:09.236Z" } Sample JSON Output for Command summary messages using tag-based
systems-manager-ug-827
systems-manager-ug.pdf
827
Windows to send Amazon SNS notifications about the status of commands, see Configure Amazon SNS notifications for AWS Systems Manager. The following examples show the structure of the JSON output returned by Amazon SNS notifications when configured for Run Command or Maintenance Windows. Sample JSON Output for Command summary messages using instance ID targeting Example Amazon SNS notifications for AWS Systems Manager 2929 AWS Systems Manager User Guide { "commandId": "a8c7e76f-15f1-4c33-9052-0123456789ab", "documentName": "AWS-RunPowerShellScript", "instanceIds": [ "i-1234567890abcdef0", "i-9876543210abcdef0" ], "requestedDateTime": "2019-04-25T17:57:09.17Z", "expiresAfter": "2019-04-25T19:07:09.17Z", "outputS3BucketName": "amzn-s3-demo-bucket", "outputS3KeyPrefix": "runcommand", "status": "InProgress", "eventTime": "2019-04-25T17:57:09.236Z" } Sample JSON Output for Command summary messages using tag-based targeting { "commandId": "9e92c686-ddc7-4827-b040-0123456789ab", "documentName": "AWS-RunPowerShellScript", "instanceIds": [], "requestedDateTime": "2019-04-25T18:01:03.888Z", "expiresAfter": "2019-04-25T19:11:03.888Z", "outputS3BucketName": "", "outputS3KeyPrefix": "", "status": "InProgress", "eventTime": "2019-04-25T18:01:05.825Z" } Sample JSON Output for Invocation messages { "commandId": "ceb96b84-16aa-4540-91e3-925a9a278b8c", "documentName": "AWS-RunPowerShellScript", "instanceId": "i-1234567890abcdef0", "requestedDateTime": "2019-04-25T18:06:05.032Z", "status": "InProgress", "eventTime": "2019-04-25T18:06:05.099Z" } Example Amazon SNS notifications for AWS Systems Manager 2930 AWS Systems Manager User Guide Use Run Command to send a command that returns status notifications The following procedures show how to use the AWS Command Line Interface (AWS CLI) or AWS Systems Manager console to send a command through Run Command, a tool in AWS Systems Manager, that is configured to return status notifications. Sending a Run Command that returns notifications (console) Use the following procedure to send a command through Run Command that is configured to return status notifications using the Systems Manager console. To send a command that returns notifications (console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Run Command. 3. Choose Run command. 4. 5. 6. In the Command document list, choose a Systems Manager document. In the Command parameters section, specify values for required parameters. In the Targets section, choose the managed nodes on which you want to run this operation by specifying tags, selecting instances or edge devices manually, or specifying a resource group. Tip If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. 7. For Other parameters: • For Comment, enter information about this command. • For Timeout (seconds), specify the number of seconds for the system to wait before failing the overall command execution. 8. For Rate control: • For Concurrency, specify either a number or a percentage of managed nodes on which to run the command at the same time. Use Run Command to send a command that returns status notifications 2931 AWS Systems Manager Note User Guide If you selected targets by specifying tags applied to managed nodes or by specifying AWS resource groups, and you aren't certain how many managed nodes are targeted, then restrict the number of targets that can run the document at the same time by specifying a percentage. • For Error threshold, specify when to stop running the command on other managed nodes after it fails on either a number or a percentage of nodes. For example, if you specify three errors, then Systems Manager stops sending the command when the fourth error is received. Managed nodes still processing the command might also send errors. 9. (Optional) For Output options, to save the command output to a file, select the Write command output to an S3 bucket box. Enter the bucket and prefix (folder) names in the boxes. Note The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile (for EC2 instances) or IAM service role (hybrid-activated machines) assigned to the instance, not those of the IAM user performing this task. For more information, see Configure instance permissions required for Systems Manager or Create an IAM service role for a hybrid environment. In addition, if the specified S3 bucket is in a different AWS account, make sure that the instance profile or IAM service role associated with the managed node has the necessary permissions to write to that bucket. 10. In the SNS Notifications section, choose Enable SNS notifications. 11. For IAM role, choose the Amazon SNS IAM role ARN you created in Task 3 in Monitoring Systems Manager status changes using Amazon SNS notifications. 12. For SNS topic, enter the Amazon SNS topic ARN to be used. 13. For Event notifications, choose the events for which you want to receive notifications. 14. For Change notifications, choose to receive notifications for the command summary only (Command status changes) or for each copy of a command sent to multiple nodes (Command status on each instance changes) . 15. Choose Run. Use Run Command to send a command that returns status notifications 2932 AWS Systems Manager User Guide 16. Check your email for a message from Amazon SNS and open the email message. Amazon SNS can take several minutes to send the email message. Sending a Run Command
systems-manager-ug-828
systems-manager-ug.pdf
828
be used. 13. For Event notifications, choose the events for which you want to receive notifications. 14. For Change notifications, choose to receive notifications for the command summary only (Command status changes) or for each copy of a command sent to multiple nodes (Command status on each instance changes) . 15. Choose Run. Use Run Command to send a command that returns status notifications 2932 AWS Systems Manager User Guide 16. Check your email for a message from Amazon SNS and open the email message. Amazon SNS can take several minutes to send the email message. Sending a Run Command that returns notifications (CLI) Use the following procedure to send a command through Run Command that is configured to return status notifications using the AWS CLI. To send a command that returns notifications (CLI) 1. Open the AWS CLI. 2. Specify parameters in the following command to target based on managed node IDs. aws ssm send-command --instance-ids "ID-1, ID-2" --document-name "Name" --parameters '{"commands":["input"]}' --service-role "SNSRoleARN" -- notification-config '{"NotificationArn":"SNSTopicName","NotificationEvents": ["All"],"NotificationType":"Command"}' Following is an example. aws ssm send-command --instance-ids "i-02573cafcfEXAMPLE, i-0471e04240EXAMPLE" --document-name "AWS-RunPowerShellScript" --parameters '{"commands": ["Get-Process"]}' --service-role "arn:aws:iam::111122223333:role/ SNS_Role" --notification-config '{"NotificationArn":"arn:aws:sns:us- east-1:111122223333:SNSTopic","NotificationEvents": ["All"],"NotificationType":"Command"}' Alternative commands Specify parameters in the following command to target managed instances using tags. aws ssm send-command --targets "Key=tag:TagName,Values=TagKey" --document-name "Name" --parameters '{"commands":["input"]}' --service-role "SNSRoleARN" -- notification-config '{"NotificationArn":"SNSTopicName","NotificationEvents": ["All"],"NotificationType":"Command"}' Following is an example. Use Run Command to send a command that returns status notifications 2933 AWS Systems Manager User Guide aws ssm send-command --targets "Key=tag:Environment,Values=Dev" -- document-name "AWS-RunPowerShellScript" --parameters '{"commands": ["Get-Process"]}' --service-role "arn:aws:iam::111122223333:role/ SNS_Role" --notification-config '{"NotificationArn":"arn:aws:sns:us- east-1:111122223333:SNSTopic","NotificationEvents": ["All"],"NotificationType":"Command"}' 3. Press Enter. 4. Check your email for a message from Amazon SNS and open the email message. Amazon SNS can take several minutes to send the email message. For more information, see send-command in the AWS CLI Command Reference. Use a maintenance window to send a command that returns status notifications The following procedures show how to register a Run Command task with your maintenance window using the AWS Systems Manager console or the AWS Command Line Interface (AWS CLI). Run Command is a tool in AWS Systems Manager. The procedures also describe how to configure the Run Command task to return status notifications. Before you begin If you haven't created a maintenance window or registered targets, see Create and manage maintenance windows using the console for steps on how to create a maintenance window and register targets. To receive notifications from the Amazon Simple Notification Service (Amazon SNS) service, attach an iam:PassRole policy to the Maintenance Windows service role specified in the registered task. If you haven't added iam:PassRole permissions to your Maintenance Windows service role, see Task 5: Attach the iam:PassRole policy to your maintenance window role. Registering a Run Command task to a maintenance window that returns notifications (console) Use the following procedure to register a Run Command task that is configured to return status notifications to your maintenance window using the Systems Manager console. Use a maintenance window to send a command that returns status notifications 2934 AWS Systems Manager User Guide To register a Run Command task with your maintenance window that returns notifications (console) 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- 2. 3. manager/. In the navigation pane, choose Maintenance Windows. Select the maintenance window for which you would like to register a Run Command task configured to send Amazon Simple Notification Service (Amazon SNS) notifications. 4. Choose Actions and then choose Register Run command task. 5. 6. 7. 8. (Optional) In the Name field, enter a name for the task. (Optional) In the Description field, enter a description. For Command document, choose a Command document. For Task priority, specify a priority for this task. Zero (0) is the highest priority. Tasks in a maintenance window are scheduled in priority order. Tasks that have the same priority are scheduled in parallel. 9. In the Targets section, select a registered target group or select unregistered targets. 10. For Rate control: • For Concurrency, specify either a number or a percentage of managed nodes on which to run the command at the same time. Note If you selected targets by specifying tags applied to managed nodes or by specifying AWS resource groups, and you aren't certain how many managed nodes are targeted, then restrict the number of targets that can run the document at the same time by specifying a percentage. • For Error threshold, specify when to stop running the command on other managed nodes after it fails on either a number or a percentage of nodes. For example, if you specify three errors, then Systems Manager stops sending the command when the fourth error is received. Managed nodes still processing the command might also send errors. 11. In the IAM service role area, choose the Maintenance Windows service role that has iam:PassRole
systems-manager-ug-829
systems-manager-ug.pdf
829
aren't certain how many managed nodes are targeted, then restrict the number of targets that can run the document at the same time by specifying a percentage. • For Error threshold, specify when to stop running the command on other managed nodes after it fails on either a number or a percentage of nodes. For example, if you specify three errors, then Systems Manager stops sending the command when the fourth error is received. Managed nodes still processing the command might also send errors. 11. In the IAM service role area, choose the Maintenance Windows service role that has iam:PassRole permissions to the SNS role. Use a maintenance window to send a command that returns status notifications 2935 AWS Systems Manager Note User Guide Add iam:PassRole permissions to the Maintenance Windows role to allow Systems Manager to pass the SNS role to Amazon SNS. If you haven't added iam:PassRole permissions, see Task 5 in the topic Monitoring Systems Manager status changes using Amazon SNS notifications. 12. (Optional) For Output options, to save the command output to a file, select the Enable writing output to S3 box. Enter the bucket and prefix (folder) names in the boxes. Note The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile assigned to the managed node, not those of the IAM user performing this task. For more information, see Configure instance permissions required for Systems Manager or Create an IAM service role for a hybrid environment. In addition, if the specified S3 bucket is in a different AWS account, verify that the instance profile or IAM service role associated with the managed node has the necessary permissions to write to that bucket. 13. In the SNS notifications section, do the following: • Choose Enable SNS Notifications. • For IAM role, choose the Amazon SNS IAM role Amazon Resource Name (ARN) you created in Task 3 in Monitoring Systems Manager status changes using Amazon SNS notifications to initiate Amazon SNS. • For SNS topic, enter the Amazon SNS topic ARN to be used. • For Event type, choose the events for which you want to receive notifications. • For Notification type, choose to receive notifications for each copy of a command sent to multiple nodes (invocations) or the command summary. 14. In the Parameters section, enter the required parameters based on the Command document you chose. 15. Choose Register Run command task. Use a maintenance window to send a command that returns status notifications 2936 AWS Systems Manager User Guide 16. After the next time your maintenance window runs, check your email for a message from Amazon SNS and open the email message. Amazon SNS can take a few minutes to send the email message. Registering a Run Command task to a maintenance window that returns notifications (CLI) Use the following procedure to register a Run Command task that is configured to return status notifications to your maintenance window using the AWS CLI. To register a Run Command task with your maintenance window that returns notifications (CLI) Note To better manage your task options, this procedure uses the command option --cli- input-json, with option values stored in a JSON file. 1. On your local machine, create a file named RunCommandTask.json. 2. Paste the following contents into the file. { "Name": "Name", "Description": "Description", "WindowId": "mw-0c50858d01EXAMPLE", "ServiceRoleArn": "arn:aws:iam::account-id:role/MaintenanceWindowIAMRole", "MaxConcurrency": "1", "MaxErrors": "1", "Priority": 3, "Targets": [ { "Key": "WindowTargetIds", "Values": [ "e32eecb2-646c-4f4b-8ed1-205fbEXAMPLE" ] } ], "TaskType": "RUN_COMMAND", "TaskArn": "CommandDocumentName", "TaskInvocationParameters": { Use a maintenance window to send a command that returns status notifications 2937 AWS Systems Manager User Guide "RunCommand": { "Comment": "Comment", "TimeoutSeconds": 3600, "NotificationConfig": { "NotificationArn": "arn:aws:sns:region:account-id:SNSTopicName", "NotificationEvents": [ "All" ], "NotificationType": "Command" }, "ServiceRoleArn": "arn:aws:iam::account-id:role/SNSIAMRole" } } } 3. Replace the example values with information about your own resources. You can also restore options we've omitted from this example if you want to use them. For example, you can save command output to an S3 bucket. For more information, see register-task-with-maintenance-window in the AWS CLI Command 4. 5. Reference. Save the file. In the directory on your local machine where you saved the file, run the following command. aws ssm register-task-with-maintenance-window --cli-input-json file:// RunCommandTask.json Important Be sure to include file:// before the file name. It's required in this command. If successful, the command returns information similar to the following. { "WindowTaskId": "j2l8d5b5c-mw66-tk4d-r3g9-1d4d1EXAMPLE" } Use a maintenance window to send a command that returns status notifications 2938 AWS Systems Manager User Guide 6. After the next execution of your maintenance window, check your email for a message from Amazon SNS and open the email message. Amazon SNS can take a few minutes to send the email message. For more information about registering tasks for a maintenance window from the command line, see Register
systems-manager-ug-830
systems-manager-ug.pdf
830
file:// RunCommandTask.json Important Be sure to include file:// before the file name. It's required in this command. If successful, the command returns information similar to the following. { "WindowTaskId": "j2l8d5b5c-mw66-tk4d-r3g9-1d4d1EXAMPLE" } Use a maintenance window to send a command that returns status notifications 2938 AWS Systems Manager User Guide 6. After the next execution of your maintenance window, check your email for a message from Amazon SNS and open the email message. Amazon SNS can take a few minutes to send the email message. For more information about registering tasks for a maintenance window from the command line, see Register tasks with the maintenance window. Use a maintenance window to send a command that returns status notifications 2939 AWS Systems Manager User Guide Product and service integrations with Systems Manager By default, AWS Systems Manager integrates with AWS services and other products and services. The following information can help you configure Systems Manager to integrate with the products and services you use. • Integration with AWS services • Integration with other products and services Integration with AWS services Through the use of Systems Manager Command documents (SSM documents) and Automation runbooks, you can use AWS Systems Manager to integrate with AWS services. For more information about these resources, see AWS Systems Manager Documents. Systems Manager is integrated with the following AWS services. Compute Amazon Elastic Compute Cloud (Amazon EC2) Amazon EC2 provides scalable computing capacity in the AWS Cloud. Using Amazon EC2 eliminates your need to invest in hardware up front, so you can develop and deploy applications faster. You can use Amazon EC2 to launch as many or as few virtual servers as you need, configure security and networking, and manage storage. Systems Manager allows you to perform several tasks on EC2 instances. For example you can launch, configure, manage, maintain, troubleshoot, and securely connect to your EC2 instances. You can also use Systems Manager to deploy software, determine compliance status, and gather inventory from your EC2 instances. Integration with AWS services 2940 AWS Systems Manager User Guide Amazon EC2 Auto Scaling Learn more • Working with managed nodes • AWS Systems Manager State Manager • AWS Systems Manager Run Command • AWS Systems Manager Patch Manager • AWS Systems Manager Session Manager • AWS Systems Manager Distributor • AWS Systems Manager Compliance • AWS Systems Manager Inventory Auto Scaling helps you ensure that you have the correct number of EC2 instances available to handle the load for your application. You create collections of EC2 instances, called Auto Scaling groups. Systems Manager allows you to automate common procedures like patching the Amazon Machine Image (AMI) used in your Auto Scaling template for your Auto Scaling group. Learn more Updating AMIs for Auto Scaling groups Compute 2941 AWS Systems Manager User Guide Amazon Elastic Container Service (Amazon ECS) Amazon ECS is a highly scalable, fast, container management service that allows you to run, stop, and manage Docker containers on a cluster. Systems Manager allows you to manage container instances remotely and inject sensitive data into your containers by storing your sensitive data in parameters in Parameter Store, a tool in Systems Manager, and then referencing them in your container definition. Learn more • Manage container instances remotely using AWS Systems Manager • Specifying sensitive data using Systems Manager Parameter Store Compute 2942 AWS Systems Manager AWS Lambda Internet of Things (IoT) AWS IoT Greengrass core devices User Guide Lambda is a compute service that allows you to run code without provisioning or managing servers. Lambda runs your code only when needed and scales automatically, from a few requests per day to thousands per second. Systems Manager allows you to use Lambda functions within Automation runbook content by using the aws:invokeLambdaFu nction action. To use parameters from Parameter Store in AWS Lambda functions, you can use the AWS Parameters and Secrets Lambda Extension to retrieve parameter values and cache them for future use. Learn more Update a golden AMI using Automation, AWS Lambda, and Parameter Store Using Parameter Store parameters in AWS Lambda functions AWS IoT Greengrass is an open source IoT edge runtime and cloud service that helps you build, deploy and manage IoT applications on your devices. Systems Manager offers native support for AWS IoT Greengrass core devices. Learn more Managing edge devices with Systems Manager Internet of Things (IoT) 2943 AWS Systems Manager AWS IoT core devices Storage Amazon Simple Storage Service (Amazon S3) User Guide AWS IoT provides the cloud services that connect your IoT devices to other devices and AWS cloud services. AWS IoT provides device software that can help you integrate your IoT devices into AWS IoT-based solutions. If your devices can connect to AWS IoT, AWS IoT can connect them to the cloud services that AWS provides. Systems Manager supports AWS IoT core devices
systems-manager-ug-831
systems-manager-ug.pdf
831
offers native support for AWS IoT Greengrass core devices. Learn more Managing edge devices with Systems Manager Internet of Things (IoT) 2943 AWS Systems Manager AWS IoT core devices Storage Amazon Simple Storage Service (Amazon S3) User Guide AWS IoT provides the cloud services that connect your IoT devices to other devices and AWS cloud services. AWS IoT provides device software that can help you integrate your IoT devices into AWS IoT-based solutions. If your devices can connect to AWS IoT, AWS IoT can connect them to the cloud services that AWS provides. Systems Manager supports AWS IoT core devices as long as those devices are configured as managed nodes in a hybrid and multicloud environment. Learn more Managing nodes in hybrid and multicloud environments with Systems Manager Amazon S3 is storage for the Internet. It's designed to make web-scale computing easier for developers. Amazon S3 has a simple web services interface that you can use to store and retrieve any amount of data, at any time, from anywhere on the web. Systems Manager allows you to run remote scripts and SSM documents that are stored in Amazon S3. Distributor, a tool in AWS Systems Manager, uses Amazon S3 to store packages. You can also send output to Amazon S3 for Run Command and Session Manager, tools in AWS Systems Manager. Learn more • Running scripts from Amazon S3 Storage 2944 AWS Systems Manager User Guide Developer Tools AWS CodeBuild AWS CDK • Running documents from remote locations • AWS Systems Manager Distributor • Logging session data using Amazon S3 (console) CodeBuild is a fully managed build service in the cloud. CodeBuild compiles your source code, runs unit tests, and produces artifacts that are ready to deploy. CodeBuild eliminates the need to provision, manage, and scale your own build servers. Parameter Store allows you to store sensitive information for your build specifications and projects. Learn more • Build specification reference for CodeBuild • Create a build project in AWS CodeBuild The AWS Cloud Development Kit (AWS CDK) is a framework for defining cloud infrastructure as code, with programming languages, and deploying it through AWS CloudFormation. Application Manager allows you to view your CDK constructs grouped as applications, view the application structure including the underlying resources, view alerts, investigate and remediate operational issues, and track costs in the Application Manager console. Developer Tools 2945 AWS Systems Manager User Guide Security, Identity, and Compliance AWS Identity and Access Management (IAM) AWS Secrets Manager Learn more • Viewing overview information about an application • Viewing application resources IAM is a web service that helps you securely control access to AWS resources. You use IAM to control who is authenticated (signed in) and authorized (has permissions) to use resources. Systems Manager allows you to control access to services using IAM. Learn more • How AWS Systems Manager works with IAM • Actions, resources, and condition keys for AWS Systems Manager • Configure instance permissions required for Systems Manager Secrets Manager provides easier managemen t of secrets. Secrets can be database credentia ls, passwords, third-party API keys, and even arbitrary text. Parameter Store allows you to retrieve Secrets Manager secrets when using other AWS services that already support references to Parameter Store parameters. Learn more Security, Identity, and Compliance 2946 AWS Systems Manager User Guide Referencing AWS Secrets Manager secrets from Parameter Store parameters Security, Identity, and Compliance 2947 AWS Systems Manager AWS Security Hub User Guide Security Hub gives you a comprehensive view of your high-priority security alerts and compliance status across AWS accounts. Security Hub aggregates, organizes, and prioritizes your security alerts, or findings, from multiple AWS services. When you turn on integration between Security Hub and Patch Manager, a tool in AWS Systems Manager, Security Hub monitors the patching status of your fleets from a security standpoint. Patch compliance details are automatically exported to Security Hub. This allows you to use a single view to centrally monitor your patch compliance status and to track other security findings. You can receive alerts when nodes in your fleet go out of patch compliance and review patch compliance findings in the Security Hub console. You can also integrate Security Hub with Explorer and OpsCenter, tools in AWS Systems Manager. Integration with Security Hub allows you to receive findings from Security Hub in Explorer and OpsCenter. Security Hub findings provide security information that you can use in Explorer and OpsCenter to aggregate and take action on your security, performance, and operational issues in AWS Systems Manager. There is a charge to use Security Hub. For more information, see Security Hub pricing. Learn more • Receiving findings from AWS Security Hub in Explorer Security, Identity, and Compliance 2948 AWS Systems Manager User Guide Cryptography and PKI AWS Key Management Service (AWS KMS) Management and Governance AWS CloudFormation
systems-manager-ug-832
systems-manager-ug.pdf
832
in AWS Systems Manager. Integration with Security Hub allows you to receive findings from Security Hub in Explorer and OpsCenter. Security Hub findings provide security information that you can use in Explorer and OpsCenter to aggregate and take action on your security, performance, and operational issues in AWS Systems Manager. There is a charge to use Security Hub. For more information, see Security Hub pricing. Learn more • Receiving findings from AWS Security Hub in Explorer Security, Identity, and Compliance 2948 AWS Systems Manager User Guide Cryptography and PKI AWS Key Management Service (AWS KMS) Management and Governance AWS CloudFormation • Understanding OpsCenter integration with AWS Security Hub • Integrating Patch Manager with AWS Security Hub AWS KMS is a managed service that allows you to create and control customer managed keys, the encryption keys used to encrypt your data. Systems Manager allows you to use AWS KMS to create SecureString parameters and encrypt Session Manager session data. Learn more • AWS KMS encryption for AWS Systems Manager Parameter Store SecureString parameters • Turn on KMS key encryption of session data (console) AWS CloudFormation is a service that helps you model and set up your Amazon Web Services resources so that you can spend less time managing those resources and more time focusing on your applications that run in AWS. Parameter Store is a source for dynamic references. Dynamic references provide a compact, powerful way for you to specify external values that are stored and managed Cryptography and PKI 2949 AWS Systems Manager User Guide AWS CloudTrail in other services in your AWS CloudFormation stack templates. Learn more Using dynamic references to specify template values CloudTrail is an AWS service that helps you authorize governance, compliance, and operational and risk auditing of your AWS account. Actions taken by a user, role, or an AWS service are recorded as events in CloudTrail. Events include actions taken in the AWS Management Console, AWS Command Line Interface (AWS CLI), and AWS SDKs and APIs. Systems Manager integrates with CloudTrai l which captures most Systems Manager API calls as events. These include API calls initiated from the Systems Manager console and calls made to the Systems Manager APIs. Learn more Logging AWS Systems Manager API calls with AWS CloudTrail Management and Governance 2950 AWS Systems Manager User Guide Amazon CloudWatch Logs Amazon CloudWatch Logs allows you to centralize the logs from all of your systems, applications, and AWS services that you use. You can then view them, search them for specific error codes or patterns, filter them based on specific fields, or archive them securely for future analysis. Systems Manager supports sending logs for the SSM Agent, Run Command, and Session Manager to CloudWatch Logs. Learn more • Sending node logs to unified CloudWatch Logs (CloudWatch agent) • Configuring Amazon CloudWatch Logs for Run Command • Logging session data using Amazon CloudWatch Logs (console) Management and Governance 2951 AWS Systems Manager Amazon EventBridge User Guide EventBridge delivers a near real-time stream of system events that describes changes in Amazon Web Services resources. Using simple rules that you can quickly set up, you can match events and route them to one or more target functions or streams. EventBridge becomes aware of operational changes as they occur. EventBridge responds to these operational changes and takes corrective action as necessary. These actions include sending messages to respond to the environment, activating functions, and capturing state information. Systems Manager has multiple events that are supported by EventBridge allowing you to take actions based on the content of those events. Learn more Monitoring Systems Manager events with Amazon EventBridge Note Amazon EventBridge is the preferred way to manage your events. CloudWatch Events and EventBrid ge are the same underlying service and API, but EventBridge provides more features. Changes you make in either CloudWatch or EventBridge are reflected in each console. For more information, see the Amazon EventBrid ge User Guide. Management and Governance 2952 AWS Systems Manager AWS Config AWS Trusted Advisor User Guide AWS Config provides a detailed view of the configuration of AWS resources in your AWS account. This includes how the resources are related to one another and how they were configured. This allows you to see how the configurations and relationships change over time. Systems Manager is integrated with AWS Config, providing multiple rules that help you gain visibility into your EC2 instances. These rules help you identify which EC2 instances are managed by Systems Manager, operating system configurations, system-level updates, installed applications, network configurations, and more. Learn more • AWS Config supported resource types • Recording software configuration for managed instances • Viewing inventory history and change tracking Trusted Advisor is an online tool that provides real-time guidance to help you provision your resources following AWS best practices. Systems Manager hosts Trusted Advisor and
systems-manager-ug-833
systems-manager-ug.pdf
833
see how the configurations and relationships change over time. Systems Manager is integrated with AWS Config, providing multiple rules that help you gain visibility into your EC2 instances. These rules help you identify which EC2 instances are managed by Systems Manager, operating system configurations, system-level updates, installed applications, network configurations, and more. Learn more • AWS Config supported resource types • Recording software configuration for managed instances • Viewing inventory history and change tracking Trusted Advisor is an online tool that provides real-time guidance to help you provision your resources following AWS best practices. Systems Manager hosts Trusted Advisor and you can view Trusted Advisor data in Explorer. Learn more • AWS Systems Manager Explorer • Getting started with AWS Trusted Advisor Management and Governance 2953 AWS Systems Manager AWS Organizations Networking and Content Delivery AWS PrivateLink User Guide Organizations is an account management service that allows you to consolidate multiple AWS accounts into an organization that you create and centrally manage. Organizations includes account management and consolida ted billing capabilities that allow you to better meet the budgetary, security, and compliance needs of your business. Integration between Change Manager, a tool in AWS Systems Manager, with Organizat ions makes it possible to use a delegated administrator account to manage change requests, change templates, and approvals for your entire organization through this single account. Organizations integration with Inventory, a tool in AWS Systems Manager, and Explorer allows you to aggregate inventory and operations data (OpsData) from multiple AWS Regions and AWS accounts. Integration between Quick Setup , a tool in AWS Systems Manager, and Organizations automates common service setup tasks, and deploys service configurations based on best practices across your organizational units (OUs). AWS PrivateLink allows you to privately connect your virtual private cloud (VPC) to supported AWS services and VPC endpoint services without requiring an internet Networking and Content Delivery 2954 AWS Systems Manager User Guide Analytics Amazon Athena gateway, NAT device, VPN connection, or AWS Direct Connect connection. Systems Manager supports managed nodes connecting to Systems Manager APIs using AWS PrivateLink. This improves the security posture of your managed nodes because AWS PrivateLink restricts all network traffic between your managed nodes, Systems Manager, and Amazon EC2 to the Amazon network. This means that managed nodes aren't required to have access to the internet. Learn more Improve the security of EC2 instances by using VPC endpoints for Systems Manager Athena is an interactive query service that allows you to analyze data directly in Amazon Simple Storage Service (Amazon S3) using standard SQL. With a few actions in the AWS Management Console, you can point Athena at your data stored in Amazon S3 and begin using standard SQL to run one-time queries and get results in seconds. Systems Manager Inventory integrates with Athena to help you query inventory data from multiple AWS Regions and AWS accounts. Athena integration uses resource data sync so that you can view inventory data from all managed nodes on the Detailed View page in the Systems Manager Inventory console. Analytics 2955 AWS Systems Manager User Guide AWS Glue Amazon QuickSight Learn more • Querying inventory data from multiple Regions and accounts • Walkthrough: Using resource data sync to aggregate inventory data AWS Glue is a fully managed ETL (extract, transform, and load) service that makes it simple and cost-effective to categorize your data, clean it, enrich it, and move it reliably between various data stores and data streams. Systems Manager uses AWS Glue to crawl the Inventory data in your S3 bucket. Learn more Querying inventory data from multiple Regions and accounts QuickSight is a business analytics service you can use to build visualizations, perform one- time analysis, and get business insights from your data. It can automatically discover AWS data sources and also works with your data sources. Systems Manager resource data sync sends inventory data collected from all of your managed nodes to a single S3 bucket. You can use QuickSight to query and analyze the aggregated data. Learn more • Creating a resource data sync for Inventory • Walkthrough: Using resource data sync to aggregate inventory data Analytics 2956 AWS Systems Manager Application Integration User Guide Amazon Simple Notification Service (Amazon SNS) Amazon SNS is a web service that coordinat es and manages the delivery or sending of AWS Management Console AWS Resource Groups messages to subscribing endpoints or clients. Systems Manager generates statuses for multiple services that can be captured by Amazon SNS notifications. Learn more • Monitoring Systems Manager status changes using Amazon SNS notifications • Setting up notifications or triggering actions based on Parameter Store events Resource Groups organize your AWS resources . Resource groups make it easier to manage, monitor, and automate tasks on large numbers of resources at one time. Systems Manager resource types like managed nodes,
systems-manager-ug-834
systems-manager-ug.pdf
834
Amazon SNS is a web service that coordinat es and manages the delivery or sending of AWS Management Console AWS Resource Groups messages to subscribing endpoints or clients. Systems Manager generates statuses for multiple services that can be captured by Amazon SNS notifications. Learn more • Monitoring Systems Manager status changes using Amazon SNS notifications • Setting up notifications or triggering actions based on Parameter Store events Resource Groups organize your AWS resources . Resource groups make it easier to manage, monitor, and automate tasks on large numbers of resources at one time. Systems Manager resource types like managed nodes, SSM documents, maintenance windows, Parameter Store parameters, and patch baselines can be added to resource groups. Learn more What are AWS Resource Groups? Topics • Running scripts from Amazon S3 Application Integration 2957 AWS Systems Manager User Guide • Referencing AWS Secrets Manager secrets from Parameter Store parameters • AWS KMS encryption for AWS Systems Manager Parameter Store SecureString parameters • Use Parameter Store parameters in Amazon Elastic Kubernetes Service • Using Parameter Store parameters in AWS Lambda functions Running scripts from Amazon S3 This section describes how to download and run scripts from Amazon Simple Storage Service (Amazon S3). The following topic includes information and terminology relating to Amazon S3. To learn more about Amazon S3, see What is Amazon S3? You can run different types of scripts, including Ansible Playbooks, Python, Ruby, Shell, and PowerShell. You can also download a directory that includes multiple scripts. When you run the primary script in the directory, AWS Systems Manager also runs any referenced scripts that are included in the directory. Note the following important details about running scripts from Amazon S3: • Systems Manager doesn't verify that your script is capable of running on an node. Before you download and run the script, verify that the required software is installed on the node. Or, you can create a composite document that installs the software by using either Run Command or State Manager, tools in AWS Systems Manager, and then downloads and runs the script. • Verify that your user, role, or group has been granted the AWS Identity and Access Management (IAM) permissions needed to read from the S3 bucket. • Ensure that the instance profile on your Amazon Elastic Compute Cloud (Amazon EC2) instances has s3:ListBucket and s3:GetObject permissions. If the instance profile doesn't have these permissions, the system fails to download your script from the S3 bucket. For more information, see Using instance profiles in the IAM User Guide. Run shell scripts from Amazon S3 This following information includes procedures to help you run scripts from Amazon Simple Storage Service (Amazon S3) by using either the AWS Systems Manager console or the AWS Command Line Interface (AWS CLI). Though shell scripts are used in the examples, other types of scripts can be substituted. Running scripts from Amazon S3 2958 AWS Systems Manager User Guide Run a shell script from Amazon S3 (console) Run a shell script from Amazon S3 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Run Command. 3. Choose Run command. 4. 5. In the Command document list, choose AWS-RunRemoteScript. In Command parameters, do the following: • In Source Type, select S3. • In the Source Info text box, enter the required information to access the source in the following format. Replace each example resource placeholder with your own information. Note Replace https://s3.aws-api-domain with the URL for your bucket. You can copy your bucket URL in Amazon S3 on the Objects tab. {"path":"https://s3.aws-api-domain/path to script"} The following is an example. {"path":"https://amzn-s3-demo-bucket.s3.us-east-2.amazonaws.com/scripts/shell/ helloWorld.sh"} • In the Command Line field, enter parameters for the script execution. Here is an example. helloWorld.sh argument-1 argument-2 • (Optional) In the Working Directory field, enter the name of a directory on the node where you want to download and run the script. • (Optional) In Execution Timeout, specify the number of seconds for the system to wait before failing the script command execution. Running scripts from Amazon S3 2959 AWS Systems Manager User Guide 6. In the Targets section, choose the managed nodes on which you want to run this operation by specifying tags, selecting instances or edge devices manually, or specifying a resource group. Tip If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. 7. For Other parameters: • For Comment, enter information about this command. • For Timeout (seconds), specify the number of seconds for the system to wait before failing the overall command execution. 8. For Rate control: • For Concurrency, specify either a number or a percentage of managed nodes on which to run the command at the same time. Note If you selected targets by specifying tags applied to managed
systems-manager-ug-835
systems-manager-ug.pdf
835
selecting instances or edge devices manually, or specifying a resource group. Tip If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. 7. For Other parameters: • For Comment, enter information about this command. • For Timeout (seconds), specify the number of seconds for the system to wait before failing the overall command execution. 8. For Rate control: • For Concurrency, specify either a number or a percentage of managed nodes on which to run the command at the same time. Note If you selected targets by specifying tags applied to managed nodes or by specifying AWS resource groups, and you aren't certain how many managed nodes are targeted, then restrict the number of targets that can run the document at the same time by specifying a percentage. • For Error threshold, specify when to stop running the command on other managed nodes after it fails on either a number or a percentage of nodes. For example, if you specify three errors, then Systems Manager stops sending the command when the fourth error is received. Managed nodes still processing the command might also send errors. 9. (Optional) For Output options, to save the command output to a file, select the Write command output to an S3 bucket box. Enter the bucket and prefix (folder) names in the boxes. Note The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile (for EC2 instances) or IAM service role (hybrid-activated machines) assigned to the instance, not those of the IAM user performing this task. For more Running scripts from Amazon S3 2960 AWS Systems Manager User Guide information, see Configure instance permissions required for Systems Manager or Create an IAM service role for a hybrid environment. In addition, if the specified S3 bucket is in a different AWS account, make sure that the instance profile or IAM service role associated with the managed node has the necessary permissions to write to that bucket. 10. In the SNS notifications section, if you want notifications sent about the status of the command execution, select the Enable SNS notifications check box. For more information about configuring Amazon SNS notifications for Run Command, see Monitoring Systems Manager status changes using Amazon SNS notifications. 11. Choose Run. Run a shell script from Amazon S3 (command line) 1. Install and configure the AWS Command Line Interface (AWS CLI), if you haven't already. For information, see Installing or updating the latest version of the AWS CLI. 2. Run the following command. Replace each example resource placeholder with your own information. Note Replace https://s3.aws-api-domain/script path with the URL for your bucket. You can copy your bucket URL in Amazon S3 on the Objects tab. Linux & macOS aws ssm send-command \ --document-name "AWS-RunRemoteScript" \ --output-s3-bucket-name "amzn-s3-demo-bucket" \ --output-s3-key-prefix "key-prefix" \ --targets "Key=InstanceIds,Values=instance-id" \ --parameters '{"sourceType":["S3"],"sourceInfo":["{\"path\":\"https:// s3.aws-api-domain/script path\"}"],"commandLine":["script name and arguments"]}' Running scripts from Amazon S3 2961 AWS Systems Manager Windows User Guide aws ssm send-command ^ --document-name "AWS-RunRemoteScript" ^ --output-s3-bucket-name "amzn-s3-demo-bucket" ^ --output-s3-key-prefix "key-prefix" ^ --targets "Key=InstanceIds,Values=instance-id" ^ --parameters "sourceType"="S3",sourceInfo='{\"path\":\"https://s3.aws-api- domain/script path\"}',"commandLine"="script name and arguments" PowerShell Send-SSMCommand ` -DocumentName "AWS-RunRemoteScript" ` -OutputS3BucketName "amzn-s3-demo-bucket" ` -OutputS3KeyPrefix "key-prefix" ` -Target @{Key="InstanceIds";Values=@("instance-id")} ` -Parameter @{ sourceType = "S3"; sourceInfo = '{"path": "s3://bucket-name/path/to/script"}'; commandLine = "script name and arguments" } Referencing AWS Secrets Manager secrets from Parameter Store parameters AWS Secrets Manager helps you organize and manage important configuration data such as credentials, passwords, and license keys. Parameter Store, a tool in AWS Systems Manager, is integrated with Secrets Manager so that you can retrieve Secrets Manager secrets when using other AWS services that already support references to Parameter Store parameters. These services include Amazon Elastic Compute Cloud (Amazon EC2), Amazon Elastic Container Service (Amazon ECS), AWS Lambda, AWS CloudFormation, AWS CodeBuild, AWS CodeDeploy, and other Systems Manager tools. By using Parameter Store to reference Secrets Manager secrets, you create a consistent and secure process for calling and using secrets and reference data in your code and configuration scripts. For more information about Secrets Manager, see What Is AWS Secrets Manager? in the AWS Secrets Manager User Guide. Referencing AWS Secrets Manager secrets from Parameter Store parameters 2962 AWS Systems Manager Restrictions User Guide Note the following restrictions when using Parameter Store to reference Secrets Manager secrets: • You can only retrieve Secrets Manager secrets by using the GetParameter and GetParameters API operations. Modification operations and advance querying API operations, such as DescribeParameters and GetParametersByPath, aren't supported for Secrets Manager. • You can use the AWS Command Line Interface (AWS CLI), AWS Tools for Windows PowerShell, and the SDKs to retrieve a secret by using Parameter Store. • Secrets Manager secrets in Parameter Store must have a prefix of /aws/reference/ secretsmanager. The following are examples: /aws/reference/secretsmanager/CFCreds1
systems-manager-ug-836
systems-manager-ug.pdf
836
parameters 2962 AWS Systems Manager Restrictions User Guide Note the following restrictions when using Parameter Store to reference Secrets Manager secrets: • You can only retrieve Secrets Manager secrets by using the GetParameter and GetParameters API operations. Modification operations and advance querying API operations, such as DescribeParameters and GetParametersByPath, aren't supported for Secrets Manager. • You can use the AWS Command Line Interface (AWS CLI), AWS Tools for Windows PowerShell, and the SDKs to retrieve a secret by using Parameter Store. • Secrets Manager secrets in Parameter Store must have a prefix of /aws/reference/ secretsmanager. The following are examples: /aws/reference/secretsmanager/CFCreds1 /aws/reference/secretsmanager/myapp/db/password • Parameter Store honors AWS Identity and Access Management (IAM) policies attached to Secrets Manager secrets. For example, if User 1 doesn't have access to Secret A, then User 1 can't retrieve Secret A by using Parameter Store. • Parameters that reference Secrets Manager secrets can't use the Parameter Store versioning or history features. • Parameter Store honors Secrets Manager version stages. If you reference a version stage, it uses letters, numbers, a period (.), a hyphen (-), or an underscore (_). All other symbols specified in the version stage cause the reference to fail. How to reference a Secrets Manager secret by using Parameter Store The following procedure describes how to reference a Secrets Manager secret by using Parameter Store APIs. The procedure references other procedures in the AWS Secrets Manager User Guide. Note Before you begin, verify that you have permission to reference Secrets Manager secrets in Parameter Store parameters. If you have administrator permissions in Secrets Manager and Systems Manager, then you can reference or retrieve secrets by using Parameter Store APIs. If you reference a Secrets Manager secret in a Parameter Store parameter, and you don't have permission to access that secret, then the reference fails. For more information, see Referencing AWS Secrets Manager secrets from Parameter Store parameters 2963 AWS Systems Manager User Guide Authentication and access control for AWS Secrets Manager in the AWS Secrets Manager User Guide. Important Parameter Store functions as a pass-through service for references to Secrets Manager secrets. Parameter Store doesn't retain data or metadata about secrets. The reference is stateless. To reference a Secrets Manager secret by using Parameter Store 1. Create a secret in Secrets Manager. For more information, see Create and manage secrets with AWS Secrets Manager. 2. Reference a secret by using the AWS CLI, AWS Tools for Windows PowerShell, or the SDK. When you reference a Secrets Manager secret, the name must begin with the following reserved path: /aws/reference/secretsmanager/. By specifying this path, Systems Manager knows to retrieve the secret from Secrets Manager instead of Parameter Store. Here are some example names that correctly reference the Secrets Manager secrets, CFCreds1 and DBPass, using Parameter Store. • /aws/reference/secretsmanager/CFCreds1 • /aws/reference/secretsmanager/DBPass Here is a Java code example that references an access key and a secret key that are stored in Secrets Manager. This code example sets up an Amazon DynamoDB client. The code retrieves configuration data and credentials from Parameter Store. The configuration data is stored as a string parameter in Parameter Store and the credentials are stored in Secrets Manager. Even though the configuration data and credentials are stored in separate services, both sets of data can be accessed from Parameter Store by using the GetParameter API. /** * Initialize Systems Manager client with default credentials */ AWSSimpleSystemsManagement ssm = AWSSimpleSystemsManagementClientBuilder.defaultClient(); Referencing AWS Secrets Manager secrets from Parameter Store parameters 2964 AWS Systems Manager User Guide ... /** * Example method to launch DynamoDB client with credentials different from default * @return DynamoDB client */ AmazonDynamoDB getDynamoDbClient() { //Getting AWS credentials from Secrets Manager using GetParameter BasicAWSCredentials differentAWSCreds = new BasicAWSCredentials( getParameter("/aws/reference/secretsmanager/access-key"), getParameter("/aws/reference/secretsmanager/secret-key")); //Initialize the DynamoDB client with different credentials final AmazonDynamoDB client = AmazonDynamoDBClient.builder() .withCredentials(new AWSStaticCredentialsProvider(differentAWSCreds)) .withRegion(getParameter("region")) //Getting configuration from Parameter Store .build(); return client; } /** * Helper method to retrieve parameter value * @param parameterName identifier of the parameter * @return decrypted parameter value */ public GetParameterResult getParameter(String parameterName) { GetParameterRequest request = new GetParameterRequest(); request.setName(parameterName); request.setWithDecryption(true); return ssm.newGetParameterCall().call(request).getParameter().getValue(); } Here are some AWS CLI examples. Use the aws secretsmanager list-secrets command to find the names of your secrets. AWS CLI Example 1: Reference by using the name of the secret Linux & macOS aws ssm get-parameter \ --name /aws/reference/secretsmanager/s1-secret \ Referencing AWS Secrets Manager secrets from Parameter Store parameters 2965 AWS Systems Manager User Guide --with-decryption Windows aws ssm get-parameter ^ --name /aws/reference/secretsmanager/s1-secret ^ --with-decryption The command returns information like the following. { "Parameter": { "Name": "/aws/reference/secretsmanager/s1-secret", "Type": "SecureString", "Value": "Fl*MEishm!al875", "Version": 0, "SourceResult": "{ \"CreatedDate\": 1526334434.743, \"Name\": \"s1-secret\", \"VersionId\": \"aaabbbccc-1111-222-333-123456789\", \"SecretString\": \"Fl*MEishm!al875\", \"VersionStages\": [\"AWSCURRENT\"], \"ARN\": \"arn:aws:secretsmanager:us- east-2:123456789012:secret:s1-secret-E18LRP\" }" "LastModifiedDate": 2018-05-14T21:47:14.743Z, "ARN": "arn:aws:secretsmanager:us-east-2:123456789012:secret:s1-secret- E18LRP", } } AWS CLI Example 2: Reference that includes the version ID Linux & macOS aws ssm
systems-manager-ug-837
systems-manager-ug.pdf
837
1: Reference by using the name of the secret Linux & macOS aws ssm get-parameter \ --name /aws/reference/secretsmanager/s1-secret \ Referencing AWS Secrets Manager secrets from Parameter Store parameters 2965 AWS Systems Manager User Guide --with-decryption Windows aws ssm get-parameter ^ --name /aws/reference/secretsmanager/s1-secret ^ --with-decryption The command returns information like the following. { "Parameter": { "Name": "/aws/reference/secretsmanager/s1-secret", "Type": "SecureString", "Value": "Fl*MEishm!al875", "Version": 0, "SourceResult": "{ \"CreatedDate\": 1526334434.743, \"Name\": \"s1-secret\", \"VersionId\": \"aaabbbccc-1111-222-333-123456789\", \"SecretString\": \"Fl*MEishm!al875\", \"VersionStages\": [\"AWSCURRENT\"], \"ARN\": \"arn:aws:secretsmanager:us- east-2:123456789012:secret:s1-secret-E18LRP\" }" "LastModifiedDate": 2018-05-14T21:47:14.743Z, "ARN": "arn:aws:secretsmanager:us-east-2:123456789012:secret:s1-secret- E18LRP", } } AWS CLI Example 2: Reference that includes the version ID Linux & macOS aws ssm get-parameter \ --name /aws/reference/secretsmanager/s1-secret:11111-aaa-bbb-ccc-123456789 \ --with-decryption Referencing AWS Secrets Manager secrets from Parameter Store parameters 2966 AWS Systems Manager Windows User Guide aws ssm get-parameter ^ --name /aws/reference/secretsmanager/s1-secret:11111-aaa-bbb-ccc-123456789 ^ --with-decryption The command returns information like the following. { "Parameter": { "Name": "/aws/reference/secretsmanager/s1-secret", "Type": "SecureString", "Value": "Fl*MEishm!al875", "Version": 0, "SourceResult": "{ \"CreatedDate\": 1526334434.743, \"Name\": \"s1-secret\", \"VersionId\": \"11111-aaa-bbb-ccc-123456789\", \"SecretString\": \"Fl*MEishm!al875\", \"VersionStages\": [\"AWSCURRENT\"], \"ARN\": \"arn:aws:secretsmanager:us- east-2:123456789012:secret:s1-secret-E18LRP\" }" "Selector": ":11111-aaa-bbb-ccc-123456789" } "LastModifiedDate": 2018-05-14T21:47:14.743Z, "ARN": "arn:aws:secretsmanager:us-east-2:123456789012:secret:s1-secret- E18LRP", } AWS CLI Example 3: Reference that includes the version stage Linux & macOS aws ssm get-parameter \ --name /aws/reference/secretsmanager/s1-secret:AWSCURRENT \ --with-decryption Referencing AWS Secrets Manager secrets from Parameter Store parameters 2967 AWS Systems Manager Windows User Guide aws ssm get-parameter ^ --name /aws/reference/secretsmanager/s1-secret:AWSCURRENT ^ --with-decryption The command returns information like the following. { "Parameter": { "Name": "/aws/reference/secretsmanager/s1-secret", "Type": "SecureString", "Value": "Fl*MEishm!al875", "Version": 0, "SourceResult": "{ \"CreatedDate\": 1526334434.743, \"Name\": \"s1-secret\", \"VersionId\": \"11111-aaa-bbb-ccc-123456789\", \"SecretString\": \"Fl*MEishm!al875\", \"VersionStages\": [\"AWSCURRENT\"], \"ARN\": \"arn:aws:secretsmanager:us- east-2:123456789012:secret:s1-secret-E18LRP\" }" "Selector": ":AWSCURRENT" } "LastModifiedDate": 2018-05-14T21:47:14.743Z, "ARN": "arn:aws:secretsmanager:us-east-2:123456789012:secret:s1-secret- E18LRP", } AWS KMS encryption for AWS Systems Manager Parameter Store SecureString parameters With AWS Systems Manager Parameter Store, you can create SecureString parameters, which are parameters that have a plaintext parameter name and an encrypted parameter value. Parameter Store uses AWS KMS to encrypt and decrypt the parameter values of SecureString parameters. AWS KMS encryption for Parameter Store SecureString parameters 2968 AWS Systems Manager User Guide With Parameter Store, you can create, store, and manage data as parameters with values. You can create a parameter in Parameter Store and use it in multiple applications and services subject to policies and permissions that you design. When you need to change a parameter value, you change one instance, rather than managing error-prone changes to numerous sources. Parameter Store supports a hierarchical structure for parameter names, so you can qualify a parameter for specific uses. To manage sensitive data, you can create SecureString parameters. Parameter Store uses AWS KMS keys to encrypt the parameter values of SecureString parameters when you create or change them. It also uses KMS keys to decrypt the parameter values when you access them. You can use the AWS managed key that Parameter Store creates for your account or specify your own customer managed key. Important Parameter Store supports only symmetric KMS keys. You cannot use an asymmetric KMS key to encrypt your parameters. For help determining whether a KMS key is symmetric or asymmetric, see Identify different key types in the AWS Key Management Service Developer Guide. Parameter Store supports two tiers of SecureString parameters: standard and advanced. Standard parameters, which cannot exceed 4096 bytes, are encrypted and decrypted directly under the KMS key that you specify. To encrypt and decrypt advanced SecureString parameters, Parameter Store uses envelope encryption with the AWS Encryption SDK. You can convert a standard SecureString parameter to an advanced parameter, but you cannot convert an advanced parameter to a standard one. For more information about the difference between standard and advanced SecureString parameters, see Managing parameter tiers. Topics • Protecting standard SecureString parameters • Protecting advanced SecureString parameters • Setting permissions to encrypt and decrypt parameter values • Parameter Store encryption context • Troubleshooting KMS key issues in Parameter Store AWS KMS encryption for Parameter Store SecureString parameters 2969 AWS Systems Manager User Guide Protecting standard SecureString parameters Parameter Store does not perform any cryptographic operations. Instead, it relies on AWS KMS to encrypt and decrypt SecureString parameter values. When you create or change a standard SecureString parameter value, Parameter Store calls the AWS KMS Encrypt operation. This operation uses a symmetric encryption KMS key directly to encrypt the parameter value instead of using the KMS key to generate a data key. You can select the KMS key that Parameter Store uses to encrypt the parameter value. If you do not specify a KMS key, Parameter Store uses the AWS managed key that Systems Manager automatically creates in your account. This KMS key has the aws/ssm alias. To view the default aws/ssm KMS key for your account, use the DescribeKey operation in the AWS KMS API. The following example uses the describe-key command in the AWS Command Line Interface (AWS CLI) with the aws/ssm alias name. aws kms describe-key \ --key-id alias/aws/ssm To
systems-manager-ug-838
systems-manager-ug.pdf
838
using the KMS key to generate a data key. You can select the KMS key that Parameter Store uses to encrypt the parameter value. If you do not specify a KMS key, Parameter Store uses the AWS managed key that Systems Manager automatically creates in your account. This KMS key has the aws/ssm alias. To view the default aws/ssm KMS key for your account, use the DescribeKey operation in the AWS KMS API. The following example uses the describe-key command in the AWS Command Line Interface (AWS CLI) with the aws/ssm alias name. aws kms describe-key \ --key-id alias/aws/ssm To create a standard SecureString parameter, use the PutParameter operation in the Systems Manager API. Omit the Tier parameter or specify a value of Standard, which is the default. Include a Type parameter with a value of SecureString. To specify a KMS key, use the KeyId parameter. The default is the AWS managed key for your account, aws/ssm. Parameter Store then calls the AWS KMS Encrypt operation with the KMS key and the plaintext parameter value. AWS KMS returns the encrypted parameter value, which Parameter Store stores with the parameter name. The following example uses the Systems Manager put-parameter command and its --type parameter in the AWS CLI to create a SecureString parameter. Because the command omits the optional --tier and --key-id parameters, Parameter Store creates a standard SecureString parameter and encrypts it under the AWS managed key. aws ssm put-parameter \ --name MyParameter \ --value "secret_value" \ --type SecureString The following similar example uses the --key-id parameter to specify a customer managed key. The example uses a KMS key ID to identify the KMS key, but you can use any valid KMS key AWS KMS encryption for Parameter Store SecureString parameters 2970 AWS Systems Manager User Guide identifier. Because the command omits the Tier parameter (--tier), Parameter Store creates a standard SecureString parameter, not an advanced one. aws ssm put-parameter \ --name param1 \ --value "secret" \ --type SecureString \ --key-id 1234abcd-12ab-34cd-56ef-1234567890ab When you get a SecureString parameter from Parameter Store, its value is encrypted. To get a parameter, use the GetParameter operation in the Systems Manager API. The following example uses the Systems Manager get-parameter command in the AWS CLI to get the MyParameter parameter from Parameter Store without decrypting its value. aws ssm get-parameter --name MyParameter { "Parameter": { "Type": "SecureString", "Name": "MyParameter", "Value": "AQECAHgnOkMROh5LaLXkA4j0+vYi6tmM17Lg" } } To decrypt the parameter value before returning it, set the WithDecryption parameter of GetParameter to true. When you use WithDecryption, Parameter Store calls the AWS KMS Decrypt operation on your behalf to decrypt the parameter value. As a result, the GetParameter request returns the parameter with a plaintext parameter value, as shown in the following example. aws ssm get-parameter \ --name MyParameter \ --with-decryption { "Parameter": { "Type": "SecureString", "Name": "MyParameter", AWS KMS encryption for Parameter Store SecureString parameters 2971 AWS Systems Manager User Guide "Value": "secret_value" } } The following workflow shows how Parameter Store uses a KMS key to encrypt and decrypt a standard SecureString parameter. Encrypt a standard parameter 1. When you use PutParameter to create a SecureString parameter, Parameter Store sends an Encrypt request to AWS KMS. That request includes the plaintext parameter value, the KMS key that you chose, and the Parameter Store encryption context. During transmission to AWS KMS, the plaintext value in the SecureString parameter is protected by Transport Layer Security (TLS). 2. AWS KMS encrypts the parameter value with the specified KMS key and encryption context. It returns the ciphertext to Parameter Store, which stores the parameter name and its encrypted value. Decrypt a standard parameter 1. When you include the WithDecryption parameter in a GetParameter request, Parameter Store sends a Decrypt request to AWS KMS with the encrypted SecureString parameter value and the Parameter Store encryption context. 2. AWS KMS uses the same KMS key and the supplied encryption context to decrypt the encrypted value. It returns the plaintext (decrypted) parameter value to Parameter Store. During transmission, the plaintext data is protected by TLS. AWS KMS encryption for Parameter Store SecureString parameters 2972 AWS Systems Manager User Guide 3. Parameter Store returns the plaintext parameter value to you in the GetParameter response. Protecting advanced SecureString parameters When you use PutParameter to create an advanced SecureString parameter, Parameter Store uses envelope encryption with the AWS Encryption SDK and a symmetric encryption AWS KMS key to protect the parameter value. Each advanced parameter value is encrypted under a unique data key, and the data key is encrypted under a KMS key. You can use the AWS managed key for the account (aws/ssm) or any customer managed key. The AWS Encryption SDK is an open-source, client-side library that helps you to encrypt and decrypt data using industry standards and best practices. It's supported on multiple
systems-manager-ug-839
systems-manager-ug.pdf
839
Protecting advanced SecureString parameters When you use PutParameter to create an advanced SecureString parameter, Parameter Store uses envelope encryption with the AWS Encryption SDK and a symmetric encryption AWS KMS key to protect the parameter value. Each advanced parameter value is encrypted under a unique data key, and the data key is encrypted under a KMS key. You can use the AWS managed key for the account (aws/ssm) or any customer managed key. The AWS Encryption SDK is an open-source, client-side library that helps you to encrypt and decrypt data using industry standards and best practices. It's supported on multiple platforms and in multiple programming languages, including a command-line interface. You can view the source code and contribute to its development in GitHub. For each SecureString parameter value, Parameter Store calls the AWS Encryption SDK to encrypt the parameter value using a unique data key that AWS KMS generates (GenerateDataKey). The AWS Encryption SDK returns to Parameter Store an encrypted message that includes the encrypted parameter value and an encrypted copy of the unique data key. Parameter Store stores the entire encrypted message in the SecureString parameter value. Then, when you get an advanced SecureString parameter value, Parameter Store uses the AWS Encryption SDK to decrypt the parameter value. This requires a call to AWS KMS to decrypt the encrypted data key. To create an advanced SecureString parameter, use the PutParameter operation in the Systems Manager API. Set the value of Tier parameter to Advanced. Include a Type parameter with a value of SecureString. To specify a KMS key, use the KeyId parameter. The default is the AWS managed key for your account, aws/ssm. aws ssm put-parameter \ --name MyParameter \ --value "secret_value" \ --type SecureString \ --tier Advanced The following similar example uses the --key-id parameter to specify a customer managed key. The example uses the Amazon Resource Name (ARN) of the KMS key, but you can use any valid KMS key identifier. aws ssm put-parameter \ AWS KMS encryption for Parameter Store SecureString parameters 2973 AWS Systems Manager User Guide --name MyParameter \ --value "secret_value" \ --type SecureString \ --tier Advanced \ --key-id arn:aws:kms:us- east-2:987654321098:key/1234abcd-12ab-34cd-56ef-1234567890ab When you get a SecureString parameter from Parameter Store, its value is the encrypted message that the AWS Encryption SDK returned. To get a parameter, use the GetParameter operation in the Systems Manager API. The following example uses the Systems Manager GetParameter operation to get the MyParameter parameter from Parameter Store without decrypting its value. aws ssm get-parameter --name MyParameter { "Parameter": { "Type": "SecureString", "Name": "MyParameter", "Value": "AQECAHgnOkMROh5LaLXkA4j0+vYi6tmM17Lg" } } To decrypt the parameter value before returning it, set the WithDecryption parameter of GetParameter to true. When you use WithDecryption, Parameter Store calls the AWS KMS Decrypt operation on your behalf to decrypt the parameter value. As a result, the GetParameter request returns the parameter with a plaintext parameter value, as shown in the following example. aws ssm get-parameter \ --name MyParameter \ --with-decryption { "Parameter": { "Type": "SecureString", "Name": "MyParameter", "Value": "secret_value" } AWS KMS encryption for Parameter Store SecureString parameters 2974 AWS Systems Manager } User Guide You cannot convert an advanced SecureString parameter to a standard one, but you can convert a standard SecureString to an advanced one. To convert a standard SecureString parameter to an advanced SecureString, use the PutParameter operation with the Overwrite parameter. The Type must be SecureString and the Tier value must be Advanced. The KeyId parameter, which identifies a customer managed key, is optional. If you omit it, Parameter Store uses the AWS managed key for the account. You can specify any KMS key that the principal has permission to use, even if you used a different KMS key to encrypt the standard parameter. When you use the Overwrite parameter, Parameter Store uses the AWS Encryption SDK to encrypt the parameter value. Then it stores the newly encrypted message in Parameter Store. aws ssm put-parameter \ --name myStdParameter \ --value "secret_value" \ --type SecureString \ --tier Advanced \ --key-id 1234abcd-12ab-34cd-56ef-1234567890ab \ --overwrite The following workflow shows how Parameter Store uses a KMS key to encrypt and decrypt an advanced SecureString parameter. Encrypt an advanced parameter 1. When you use PutParameter to create an advanced SecureString parameter, Parameter Store uses the AWS Encryption SDK and AWS KMS to encrypt the parameter value. Parameter Store calls the AWS Encryption SDK with the parameter value, the KMS key that you specified, and the Parameter Store encryption context. 2. The AWS Encryption SDK sends a GenerateDataKey request to AWS KMS with the identifier of the KMS key that you specified and the Parameter Store encryption context. AWS KMS returns two copies of the unique data key: one in plaintext and one encrypted under the KMS key. (The encryption context is used when encrypting the data key.) 3. The
systems-manager-ug-840
systems-manager-ug.pdf
840
SecureString parameter, Parameter Store uses the AWS Encryption SDK and AWS KMS to encrypt the parameter value. Parameter Store calls the AWS Encryption SDK with the parameter value, the KMS key that you specified, and the Parameter Store encryption context. 2. The AWS Encryption SDK sends a GenerateDataKey request to AWS KMS with the identifier of the KMS key that you specified and the Parameter Store encryption context. AWS KMS returns two copies of the unique data key: one in plaintext and one encrypted under the KMS key. (The encryption context is used when encrypting the data key.) 3. The AWS Encryption SDK uses the plaintext data key to encrypt the parameter value. It returns an encrypted message that includes the encrypted parameter value, the encrypted data key, and other data, including the Parameter Store encryption context. 4. Parameter Store stores the encrypted message as the parameter value. AWS KMS encryption for Parameter Store SecureString parameters 2975 AWS Systems Manager User Guide Decrypt an advanced parameter 1. You can include the WithDecryption parameter in a GetParameter request to get an advanced SecureString parameter. When you do, Parameter Store passes the encrypted message from the parameter value to a decryption method of the AWS Encryption SDK. 2. The AWS Encryption SDK calls the AWS KMS Decrypt operation. It passes in the encrypted data key and the Parameter Store encryption context from the encrypted message. 3. AWS KMS uses the KMS key and the Parameter Store encryption context to decrypt the encrypted data key. Then it returns the plaintext (decrypted) data key to the AWS Encryption SDK. 4. The AWS Encryption SDK uses the plaintext data key to decrypt the parameter value. It returns the plaintext parameter value to Parameter Store. 5. Parameter Store verifies the encryption context and returns the plaintext parameter value to you in the GetParameter response. Setting permissions to encrypt and decrypt parameter values To encrypt a standard SecureString parameter value, the user needs kms:Encrypt permission. To encrypt an advanced SecureString parameter value, the user needs kms:GenerateDataKey permission. To decrypt either type of SecureString parameter value, the user needs kms:Decrypt permission. You can use AWS Identity and Access Management (IAM) policies to allow or deny permission for a user to call the Systems Manager PutParameter and GetParameter operations. If you are using customer managed keys to encrypt your SecureString parameter values, you can use IAM policies and key policies to manage encrypt and decrypt permissions. However, you cannot AWS KMS encryption for Parameter Store SecureString parameters 2976 AWS Systems Manager User Guide establish access control policies for the default aws/ssm KMS key. For detailed information about controlling access to customer managed keys, see KMS key access and permissions in the AWS Key Management Service Developer Guide. The following example shows an IAM policy designed for standard SecureString parameters. It allows the user to call the Systems Manager PutParameter operation on all parameters in the FinancialParameters path. The policy also allows the user to call the AWS KMS Encrypt operation on an example customer managed key. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssm:PutParameter" ], "Resource": "arn:aws:ssm:us-east-2:111122223333:parameter/ FinancialParameters/*" }, { "Effect": "Allow", "Action": [ "kms:Encrypt" ], "Resource": "arn:aws:kms:us- east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab" } ] } The next example shows an IAM policy that is designed for advanced SecureString parameters. It allows the user to call the Systems Manager PutParameter operation on all parameters in the ReservedParameters path. The policy also allows the user to call the AWS KMS GenerateDataKey operation on an example customer managed key. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", AWS KMS encryption for Parameter Store SecureString parameters 2977 AWS Systems Manager User Guide "Action": [ "ssm:PutParameter" ], "Resource": "arn:aws:ssm:us-east-2:111122223333:parameter/ ReservedParameters/*" }, { "Effect": "Allow", "Action": [ "kms:GenerateDataKey" ], "Resource": "arn:aws:kms:us- east-2:987654321098:key/1234abcd-12ab-34cd-56ef-1234567890ab" } ] } The final example also shows an IAM policy that can be used for standard or advanced SecureString parameters. It allows the user to call the Systems Manager GetParameter operations (and related operations) on all parameters in the ITParameters path. The policy also allows the user to call the AWS KMS Decrypt operation on an example customer managed key. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssm:GetParameter*" ], "Resource": "arn:aws:ssm:us-east-2:111122223333:parameter/ITParameters/*" }, { "Effect": "Allow", "Action": [ "kms:Decrypt" ], "Resource": "arn:aws:kms:us- east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab" } ] } AWS KMS encryption for Parameter Store SecureString parameters 2978 AWS Systems Manager User Guide Parameter Store encryption context An encryption context is a set of key–value pairs that contain arbitrary nonsecret data. When you include an encryption context in a request to encrypt data, AWS KMS cryptographically binds the encryption context to the encrypted data. To decrypt the data, you must pass in the same encryption context. You can also use the encryption context to identify a cryptographic operation in audit records and logs.
systems-manager-ug-841
systems-manager-ug.pdf
841
"Resource": "arn:aws:ssm:us-east-2:111122223333:parameter/ITParameters/*" }, { "Effect": "Allow", "Action": [ "kms:Decrypt" ], "Resource": "arn:aws:kms:us- east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab" } ] } AWS KMS encryption for Parameter Store SecureString parameters 2978 AWS Systems Manager User Guide Parameter Store encryption context An encryption context is a set of key–value pairs that contain arbitrary nonsecret data. When you include an encryption context in a request to encrypt data, AWS KMS cryptographically binds the encryption context to the encrypted data. To decrypt the data, you must pass in the same encryption context. You can also use the encryption context to identify a cryptographic operation in audit records and logs. The encryption context appears in plaintext in logs, such as AWS CloudTrail logs. The AWS Encryption SDK also takes an encryption context, although it handles it differently. Parameter Store supplies the encryption context to the encryption method. The AWS Encryption SDK cryptographically binds the encryption context to the encrypted data. It also includes the encryption context in plain text in the header of the encrypted message that it returns. However, unlike AWS KMS, the AWS Encryption SDK decryption methods do not take an encryption context as input. Instead, when it decrypts data, the AWS Encryption SDK gets the encryption context from the encrypted message. Parameter Store verifies that the encryption context includes the value that it expects before returning the plaintext parameter value to you. Parameter Store uses the following encryption context in its cryptographic operations: • Key: PARAMETER_ARN • Value: The Amazon Resource Name (ARN) of the parameter that is being encrypted. The format of the encryption context is as follows: "PARAMETER_ARN":"arn:aws:ssm:region-id:account-id:parameter/parameter-name" For example, Parameter Store includes this encryption context in calls to encrypt and decrypt the MyParameter parameter in an example AWS account and region. "PARAMETER_ARN":"arn:aws:ssm:us-east-2:111122223333:parameter/MyParameter" If the parameter is in a Parameter Store hierarchical path, the path and name are included in the encryption context. For example, this encryption context is used when encrypting and decrypting the MyParameter parameter in the /ReadableParameters path in an example AWS account and region. AWS KMS encryption for Parameter Store SecureString parameters 2979 AWS Systems Manager User Guide "PARAMETER_ARN":"arn:aws:ssm:us-east-2:111122223333:parameter/ReadableParameters/ MyParameter" You can decrypt an encrypted SecureString parameter value by calling the AWS KMS Decrypt operation with the correct encryption context and the encrypted parameter value that the Systems Manager GetParameter operation returns. However, we encourage you to decrypt Parameter Store parameter values by using the GetParameter operation with the WithDecryption parameter. You can also include the encryption context in an IAM policy. For example, you can permit a user to decrypt only one particular parameter value or set of parameter values. The following example IAM policy statement allows the user to the get value of the MyParameter parameter and to decrypt its value using the specified KMS key. However the permissions apply only when the encryption context matches specified string. These permissions do not apply to any other parameter or KMS key, and the call to GetParameter fails if the encryption context does not match the string. Before using a policy statement like this one, replace the example ARNs with valid values. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssm:GetParameter*" ], "Resource": "arn:aws:ssm:us-east-2:111122223333:parameter/MyParameter" }, { "Effect": "Allow", "Action": [ "kms:Decrypt" ], "Resource": "arn:aws:kms:us- east-2:987654321098:key/1234abcd-12ab-34cd-56ef-1234567890ab", "Condition": { "StringEquals": { "kms:EncryptionContext:PARAMETER_ARN":"arn:aws:ssm:us- east-2:111122223333:parameter/MyParameter" AWS KMS encryption for Parameter Store SecureString parameters 2980 AWS Systems Manager } } } ] } User Guide Troubleshooting KMS key issues in Parameter Store To perform any operation on a SecureString parameter, Parameter Store must be able to use the AWS KMS KMS key that you specify for your intended operation. Most of the Parameter Store failures related to KMS keys are caused by the following problems: • The credentials that an application is using do not have permission to perform the specified action on the KMS key. To fix this error, run the application with different credentials or revise the IAM or key policy that is preventing the operation. For help with AWS KMS IAM and key policies, see KMS key access and permissions in the AWS Key Management Service Developer Guide. • The KMS key is not found. This typically happens when you use an incorrect identifier for the KMS key. Find the correct identifiers for the KMS key and try the command again. • The KMS key is not enabled. When this occurs, Parameter Store returns an InvalidKeyId exception with a detailed error message from AWS KMS. If the KMS key state is Disabled, enable it. If it is Pending Import, complete the import procedure. If the key state is Pending Deletion, cancel the key deletion or use a different KMS key. To find the key state of a KMS key, use the DescribeKey operation. Use Parameter Store parameters in Amazon Elastic Kubernetes Service To show parameters from Parameter Store, a tool of
systems-manager-ug-842
systems-manager-ug.pdf
842
identifiers for the KMS key and try the command again. • The KMS key is not enabled. When this occurs, Parameter Store returns an InvalidKeyId exception with a detailed error message from AWS KMS. If the KMS key state is Disabled, enable it. If it is Pending Import, complete the import procedure. If the key state is Pending Deletion, cancel the key deletion or use a different KMS key. To find the key state of a KMS key, use the DescribeKey operation. Use Parameter Store parameters in Amazon Elastic Kubernetes Service To show parameters from Parameter Store, a tool of AWS Systems Manager, as files mounted in Amazon EKS Pods, you can use the AWS Secrets and Configuration Provider for the Kubernetes Secrets Store CSI Driver. The ASCP works with Amazon Elastic Kubernetes Service 1.17+ running an Amazon EC2 node group. AWS Fargate node groups are not supported. With the ASCP, you can store and manage your parameter in Parameter Store and then retrieve them through your workloads running on Amazon EKS. If your parameter contains multiple key- value pairs in JSON format, you can choose which ones to mount in Amazon EKS. The ASCP uses Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2981 AWS Systems Manager User Guide JMESPath syntax to query the key-value pairs in your secret. The ASCP also works with AWS Secrets Manager secrets. The ASCP offers two methods of authentication with Amazon EKS The first approach uses IAM Roles for Service Accounts (IRSA). The second approach uses Pod Identities. Each approach has its benefits and use cases. ASCP with IAM Roles for Service Accounts (IRSA) The ASCP with IAM Roles for Service Accounts (IRSA) allows you to mount parameters from Parameter Store as files in your Amazon EKS Pods. This approach is suitable when: • You need to mount parameters as files in your Pods. • You're using Amazon EKS version 1.17 or later with Amazon EC2 node groups. • You want to retrieve specific key-value pairs from JSON-formatted parameters. For more information, see the section called “Integrate ASCP with IRSA for Amazon EKS”. ASCP with Pod Identity ASCP with EKS Pod Identity The ASCP with Pod Identity method enhances security and simplifies configuration for accessing parameters in Parameter Store. This approach is beneficial when: • You need more granular permission management at the Pod level. • You're using Amazon EKS version 1.24 or later. • You want improved performance and scalability. For more information, see the section called “Integrate ASCP with Pod Identity for Amazon EKS”. Choosing the right approach Consider the following factors when deciding between ASCP with IRSA and ASCP with Pod Identity: • Amazon EKSversion: Pod Identity requires Amazon EKS 1.24+, while CSI driver works with Amazon EKS 1.17+. • Security requirements: Pod Identity offers more granular control at the Pod level. Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2982 AWS Systems Manager User Guide • Performance: Pod Identity generally performs better in high-scale environments. • Complexity: Pod Identity simplifies setup by eliminating the need for separate service accounts. Choose the method that best aligns with your specific requirements and Amazon EKS environment. Install ASCP for Amazon EKS This section explains how to install the AWS Secrets and Configuration Provider for Amazon EKS. With ASCP, you can mount parameters from Parameter Store and secrets from AWS Secrets Manager as files in Amazon EKS Pods. Prerequisites • An Amazon EKS cluster • Version 1.24 or later for Pod Identity • Version 1.17 or later for IRSA • The AWS CLI installed and configured • kubectl installed and configured for your Amazon EKS cluster • Helm (version 3.0 or later) Install and configure the ASCP The ASCP is available on GitHub in the secrets-store-csi-provider-aws repository. The repo also contains example YAML files for creating and mounting a secret by changing the objectType value from secretsmanager to ssmparameter. During installation, you can configure the ASCP to use a FIPS endpoint. For a list of Systems Manager endpoints, see Systems Manager service endpoints in the Amazon Web Services General Reference. To install the ASCP by using Helm 1. To make sure the repo is pointing to the latest charts, use helm repo update. 2. Add the Secrets Store CSI Driver chart. helm repo add secrets-store-csi-driver https://kubernetes-sigs.github.io/secrets- store-csi-driver/charts Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2983 AWS Systems Manager User Guide 3. Install the chart. To configure throttling, add the following flag: --set-json 'k8sThrottlingParams={"qps": "number of queries per second", "burst": "number of queries per second"}' helm install -n kube-system csi-secrets-store secrets-store-csi-driver/secrets- store-csi-driver 4. Add the ASCP chart. helm repo add aws-secrets-manager https://aws.github.io/secrets-store-csi-driver- provider-aws 5. Install the chart. To use a FIPS endpoint, add the following flag: --set useFipsEndpoint=true helm install -n kube-system secrets-provider-aws aws-secrets-manager/secrets-store- csi-driver-provider-aws To install
systems-manager-ug-843
systems-manager-ug.pdf
843
use helm repo update. 2. Add the Secrets Store CSI Driver chart. helm repo add secrets-store-csi-driver https://kubernetes-sigs.github.io/secrets- store-csi-driver/charts Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2983 AWS Systems Manager User Guide 3. Install the chart. To configure throttling, add the following flag: --set-json 'k8sThrottlingParams={"qps": "number of queries per second", "burst": "number of queries per second"}' helm install -n kube-system csi-secrets-store secrets-store-csi-driver/secrets- store-csi-driver 4. Add the ASCP chart. helm repo add aws-secrets-manager https://aws.github.io/secrets-store-csi-driver- provider-aws 5. Install the chart. To use a FIPS endpoint, add the following flag: --set useFipsEndpoint=true helm install -n kube-system secrets-provider-aws aws-secrets-manager/secrets-store- csi-driver-provider-aws To install by using the YAML in the repo • Use the following commands. helm repo add secrets-store-csi-driver https://kubernetes-sigs.github.io/secrets- store-csi-driver/charts helm install -n kube-system csi-secrets-store secrets-store-csi-driver/secrets- store-csi-driver kubectl apply -f https://raw.githubusercontent.com/aws/secrets-store-csi-driver- provider-aws/main/deployment/aws-provider-installer.yaml Verify the installations To verify the installations of your EKS cluster, Secrets Store CSI driver, and ASCP plugin, follow these steps: 1. Verify the EKS cluster: eksctl get cluster --name clusterName This command should return information about your cluster. Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2984 AWS Systems Manager User Guide 2. Verify the Secrets Store CSI driver installation: kubectl get pods -n kube-system -l app=secrets-store-csi-driver You should see Pods running with names like csi-secrets-store-secrets-store-csi- driver-xxx. 3. Verify the ASCP plugin installation: YAML installation $ kubectl get pods -n kube-system -l app=csi-secrets-store-provider-aws Example output: NAME READY STATUS RESTARTS AGE csi-secrets-store-provider-aws-12345 1/1 Running 0 2m Helm installation $ kubectl get pods -n kube-system -l app=secrets-store-csi-driver-provider-aws Example output: NAME READY STATUS RESTARTS AGE secrets-provider-aws-secrets-store-csi-driver-provider-67890 1/1 Running 0 2m You should see Pods in the Running state. After running these commands, if everything is set up correctly, you should see all components running without any errors. If you encounter any issues, you may need to troubleshoot by checking the logs of the specific Pods that are having problems. Troubleshooting 1. To check the logs of the ASCP provider, run: Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2985 AWS Systems Manager User Guide kubectl logs -n kube-system -l app=csi-secrets-store-provider-aws 2. Check the status of all pods in the kube-system namespace. Replace the default placeholder text with your own pod ID: kubectl -n kube-system get pods kubectl -n kube-system logs pod/pod-id All Pods related to the CSI driver and ASCP should be in the 'Running' state. 3. Check the CSI driver version: kubectl get csidriver secrets-store.csi.k8s.io -o yaml This command should return information about the installed CSI driver. Additional resources For more information about using ASCP with Amazon EKS, see the following resources: • Using Pod Identity with Amazon EKS • AWS Secrets Store CSI Driver on GitHub Use AWS Secrets and Configuration Provider CSI with Pod Identity for Amazon EKS The AWS Secrets and Configuration Provider integration with the Pod Identity Agent for Amazon Elastic Kubernetes Service provides enhanced security, simplified configuration, and improved performance for applications running on Amazon EKS. Pod Identity simplifies AWS Identity and Access Management (IAM) authentication for Amazon EKS when retrieving parameters from AWS Systems Manager Parameter Store or secrets from Secrets Manager. Amazon EKS Pod Identity streamlines the process of configuring IAM permissions for Kubernetes applications by allowing permissions to be set up directly through Amazon EKS interfaces, reducing the number of steps and eliminating the need to switch between Amazon EKS and IAM services. Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2986 AWS Systems Manager User Guide Pod Identity enables the use of a single IAM role across multiple clusters without updating trust policies and supports role session tags for more granular access control. This approach not only simplifies policy management by allowing reuse of permission policies across roles but also enhances security by enabling access to AWS resources based on matching tags. How it works 1. Pod Identity assigns an IAM role to the Pod. 2. ASCP uses this role to authenticate with AWS services. 3. If authorized, ASCP retrieves the requested parameters and makes them available to the Pod. For more information, see Understand how Amazon EKS Pod Identity works in the Amazon EKS User Guide. Prerequisites Important Pod Identity is supported only for Amazon EKS in the cloud. It is not supported for Amazon EKS Anywhere, Red Hat OpenShift Service on AWS, or self-managed Kubernetes clusters on Amazon EC2 instances. • Amazon EKS cluster (version 1.24 or later) • Access to AWS CLI and Amazon EKS cluster via kubectl • (Optional) Access to two AWS accounts for cross-account access Install the Amazon EKS Pod Identity Agent To use Pod Identity with your cluster, you must install the Amazon EKS Pod Identity Agent add-on. To install the Pod Identity Agent • Install the Pod Identity Agent add-on on your cluster. Replace the default placeholder text with your own values: eksctl create addon \ Use AWS
systems-manager-ug-844
systems-manager-ug.pdf
844
EKS Anywhere, Red Hat OpenShift Service on AWS, or self-managed Kubernetes clusters on Amazon EC2 instances. • Amazon EKS cluster (version 1.24 or later) • Access to AWS CLI and Amazon EKS cluster via kubectl • (Optional) Access to two AWS accounts for cross-account access Install the Amazon EKS Pod Identity Agent To use Pod Identity with your cluster, you must install the Amazon EKS Pod Identity Agent add-on. To install the Pod Identity Agent • Install the Pod Identity Agent add-on on your cluster. Replace the default placeholder text with your own values: eksctl create addon \ Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2987 AWS Systems Manager User Guide --name eks-pod-identity-agent \ --cluster clusterName \ --region region Set up ASCP with Pod Identity 1. Create a permissions policy that grants ssm:GetParameters and ssm:DescribeParameters permission to the parameters that the Pod needs to access. 2. Create an IAM role that can be assumed by the Amazon EKS service principal for Pod Identity: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "pods.eks.amazonaws.com" }, "Action": [ "sts:AssumeRole", "sts:TagSession" ] } ] } Attach the IAM policy to the role. Replace the default placeholder text with your own values: aws iam attach-role-policy \ --role-name MY_ROLE \ --policy-arn POLICY_ARN 3. Create a Pod Identity association. For an example, see Create a Pod Identity association in the Amazon EKS User Guide 4. Create the SecretProviderClass that specifies which parameters or secrets to mount in the Pod: Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2988 AWS Systems Manager User Guide kubectl apply -f kubectl apply -f https://raw.githubusercontent.com/aws/ secrets-store-csi-driver-provider-aws/main/examples/ExampleSecretProviderClass- PodIdentity.yaml The key difference in SecretProviderClass between IRSA and Pod Identity is the optional parameter usePodIdentity. It is an optional field that determines the authentication approach. When not specified, it defaults to using IAM Roles for Service Accounts (IRSA). • To use EKS Pod Identity, use any of these values: "true", "True", "TRUE", "t", "T". • To explicitly use IRSA, set to any of these values: "false", "False", "FALSE", "f", or "F". 5. Deploy the Pod that mounts the parameters or secrets under /mnt/secrets-store: kubectl apply -f kubectl apply -f https://raw.githubusercontent.com/aws/secrets- store-csi-driver-provider-aws/main/examples/ExampleDeployment-PodIdentity.yaml 6. If you use a private Amazon EKS cluster, make sure that the VPC that the cluster is in has an AWS STS endpoint. For information about creating an endpoint, see Interface VPC endpoints in the AWS Identity and Access Management User Guide. Verify the secret mount To verify that the parameter or secret is mounted properly, run the following command. Replace the default placeholder text with your own values: kubectl exec -it $(kubectl get pods | awk '/pod-identity-deployment/{print $1}' | head -1) -- cat /mnt/secrets-store/MyParameter To set up Amazon EKS Pod Identity to access to parameters in Parameter Store 1. Create a permissions policy that grants ssm:GetParameters and ssm:DescribeParameters permission to the parameters that the Pod needs to access. 2. Create a parameter in Parameter Store, if you do not already have one. For information, see Creating Parameter Store parameters in Systems Manager. Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2989 AWS Systems Manager Troubleshoot You can view most errors by describing the Pod deployment. To see error messages for your container User Guide 1. Get a list of Pod names with the following command. If you aren't using the default namespace, use -n namespace. kubectl get pods 2. To describe the Pod, in the following command, for pod-id use the Pod ID from the Pods you found in the previous step. If you aren't using the default namespace, use -n NAMESPACE. kubectl describe pod/pod-id To see errors for the ASCP • To find more information in the provider logs, in the following command, for PODID use the ID of the csi-secrets-store-provider-aws Pod. kubectl -n kube-system get pods kubectl -n kube-system logs pod/pod-id Use AWS Secrets and Configuration Provider CSI with IAM Roles for Service Accounts (IRSA) Topics • Prerequisites • Set up access control • Identify which parameters to mount • Troubleshoot Prerequisites • Amazon EKS cluster (version 1.17 or later) Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2990 AWS Systems Manager User Guide • Access to AWS CLI and Amazon EKS cluster via kubectl Set up access control The ASCP retrieves the Amazon EKS Pod Identity and exchanges it for an IAM role. You set permissions in an IAM policy for that IAM role. When the ASCP assumes the IAM role, it gets access to the parameters you authorized. Other containers can't access the parameters unless you also associate them with the IAM role. To grant your Amazon EKS Pod access to parameters in Parameter Store 1. Create a permissions policy that grants ssm:GetParameters and ssm:DescribeParameters permission to the parameters that the Pod needs to access. 2.
systems-manager-ug-845
systems-manager-ug.pdf
845
CLI and Amazon EKS cluster via kubectl Set up access control The ASCP retrieves the Amazon EKS Pod Identity and exchanges it for an IAM role. You set permissions in an IAM policy for that IAM role. When the ASCP assumes the IAM role, it gets access to the parameters you authorized. Other containers can't access the parameters unless you also associate them with the IAM role. To grant your Amazon EKS Pod access to parameters in Parameter Store 1. Create a permissions policy that grants ssm:GetParameters and ssm:DescribeParameters permission to the parameters that the Pod needs to access. 2. Create an IAM OpenID Connect (OIDC) provider for the cluster if you don't already have one. For more information, see Create an IAM OIDC provider for your cluster in the Amazon EKS User Guide. 3. Create an IAM role for service account and attach the policy to it. For more information, see Create an IAM role for a service account in the Amazon EKS User Guide. 4. If you use a private Amazon EKS cluster, make sure that the VPC that the cluster is in has an AWS STS endpoint. For information about creating an endpoint, see Interface VPC endpoints in the AWS Identity and Access Management User Guide. Identify which parameters to mount To determine which parameters the ASCP mounts in Amazon EKS as files on the filesystem, you create a the section called “SecretProviderClass” YAML file. The SecretProviderClass lists the parameters to mount and the file name to mount them as. The SecretProviderClass must be in the same namespace as the Amazon EKS Pod it references. Mount the parameters as files The following instructions show how to mount parameters as files using example YAML files ExampleSecretProviderClass.yaml and ExampleDeployment.yaml. To mount parameters in Amazon EKS 1. Apply the SecretProviderClass to the Pod: Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2991 AWS Systems Manager User Guide kubectl apply -f ExampleSecretProviderClass.yaml 2. Deploy your Pod: kubectl apply -f ExampleDeployment.yaml 3. The ASCP mounts the files. Troubleshoot You can view most errors by describing the Pod deployment. To see error messages for your container 1. Get a list of Pod names with the following command. If you aren't using the default namespace, use -n name-space. kubectl get pods 2. To describe the Pod, in the following command, for pod-id use the Pod ID from the Pods you found in the previous step. If you aren't using the default namespace, use -n nameSpace. kubectl describe pod/pod-id To see errors for the ASCP • To find more information in the provider logs, in the following command, for pod-id use the ID of the csi-secrets-store-provider-aws Pod. kubectl -n kube-system get pods kubectl -n kube-system logs Pod/pod-id • Verify that the SecretProviderClass CRD is installed: kubectl get crd secretproviderclasses.secrets-store.csi.x-k8s.io Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2992 AWS Systems Manager User Guide This command should return information about the SecretProviderClass custom resource definition. • Verify that the SecretProviderClass object was created. kubectl get secretproviderclass SecretProviderClassName -o yaml AWS Secrets and Configuration Provider code examples ASCP authentication and access control examples Example: IAM policy allowing Amazon EKS Pod Identity service (pods.eks.amazonaws.com) to assume the role and tag the session: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "pods.eks.amazonaws.com" }, "Action": [ "sts:AssumeRole", "sts:TagSession" ] } ] } SecretProviderClass You use YAML to describe which parameters to mount in Amazon EKS using the ASCP. For examples, see the section called “SecretProviderClass usage”. SecretProviderClass YAML structure apiVersion: secrets-store.csi.x-k8s.io/v1 kind: SecretProviderClass Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2993 User Guide AWS Systems Manager metadata: name: name spec: provider: aws parameters: region: failoverRegion: pathTranslation: usePodIdentity: preferredAddressType: objects: The parameters field contains the details of the mount request: region (Optional) The AWS Region of the parameter. If you don't use this field, the ASCP looks up the Region from the annotation on the node. This lookup adds overhead to mount requests, so we recommend that you provide the Region for clusters that use large numbers of Pods. If you also specify failoverRegion, the ASCP tries to retrieve the parameter from both Regions. If either Region returns a 4xx error, for example for an authentication issue, the ASCP does not mount either parameter. If the parameter is retrieved successfully from region, then the ASCP mounts that parameter value. If the parameter is not retrieved successfully from region, but it is retrieved successfully from failoverRegion, then the ASCP mounts that parameter value. failoverRegion (Optional) If you include this field, the ASCP tries to retrieve the parameter from the Regions defined in region and this field. If either Region returns a 4xx error, for example for an authentication issue, the ASCP does not mount either parameter. If the parameter is retrieved successfully
systems-manager-ug-846
systems-manager-ug.pdf
846
for example for an authentication issue, the ASCP does not mount either parameter. If the parameter is retrieved successfully from region, then the ASCP mounts that parameter value. If the parameter is not retrieved successfully from region, but it is retrieved successfully from failoverRegion, then the ASCP mounts that parameter value. failoverRegion (Optional) If you include this field, the ASCP tries to retrieve the parameter from the Regions defined in region and this field. If either Region returns a 4xx error, for example for an authentication issue, the ASCP does not mount either parameter. If the parameter is retrieved successfully from region, then the ASCP mounts that parameter value. If the parameter is not retrieved successfully from region, but it is retrieved successfully from failoverRegion, then the ASCP mounts that parameter value. For an example of how to use this field, see Multi- Region parameter failover. pathTranslation (Optional) A single substitution character to use if the file name in Amazon EKS will contain the path separator character, such as slash (/) on Linux. The ASCP can't create a mounted file that Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2994 AWS Systems Manager User Guide contains a path separator character. Instead, the ASCP replaces the path separator character with a different character. If you don't use this field, the replacement character is underscore (_), so for example, My/Path/Parameter mounts as My_Path_Parameter. To prevent character substitution, enter the string False. usePodIdentity (Optional) Determines the authentication approach. When not specified, it defaults to IAM Roles for Service Accounts (IRSA) (IRSA). • To use EKS Pod Identity, use any of these values: "true"", "True", "TRUE", "t", or "T". • To explicitly use IRSA, set to any of these values: "false", "False", "FALSE", "f", or "F""=. preferredAddressType (Optional) Specifies the preferred IP address type for Pod Identity Agent endpoint communication. The field is only applicable when using EKS Pod Identity feature and will be ignored when using IAM Roles for Service Accounts.Values are case-insensitive. Valid values are: • "ipv4", "IPv4"", or "IPV4" – Force the use of Pod Identity Agent IPv4 endpoint • "ipv6", "IPv6", or "IPV6" – Force the use of Pod Identity Agent IPv6 endpoint • not specified – Use auto endpoint selection, trying IPv4 endpoint first and falling back to IPv6 endpoint if IPv4 fails objects A string containing a YAML declaration of the secrets to be mounted. We recommend using a YAML multi-line string or pipe (|) character. objectName Required. Specifies the name of the parameter or secret to be fetched. For Parameter Store, this is the Name of the parameter and can be either the name or full ARN of the parameter. For Secrets Manager this is the SecretId parameter and can be either the friendly name or full ARN of the secret. objectType Required if you don't use a Secrets Manager ARN for objectName. For Parameter Store, use ssmparameter. For Secrets Manager, use secretsmanager. Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2995 AWS Systems Manager objectAlias User Guide (Optional) The file name of the secret in the Amazon EKS Pod. If you don't specify this field, the objectName appears as the file name. objectVersion (Optional) The version ID of the parameter. Not recommended because you must update the version ID every time you update the parameter. By default the most recent version is used. If you include a failoverRegion, this field represents the primary objectVersion. objectVersionLabel (Optional) The alias for the version. The default is the most recent version AWSCURRENT. If you include a failoverRegion, this field represents the primary objectVersionLabel. jmesPath (Optional) A map of the keys in the parameter to the files to be mounted in Amazon EKS. To use this field, your parameter value must be in JSON format. The following example shows what a JSON encoded parameter looks like. { "username" : "myusername", "password" : "mypassword" } The keys are username and password. The value associated with username is myusername, and the value associated with password is mypassword. If you use this field, you must include the subfields path and objectAlias. path A key from a key-value pair in the JSON of the parameter value. If the field contains a hyphen, use single quotes to escape it, for example: path: '"hyphenated-path"' objectAlias The file name to be mounted in the Amazon EKS Pod. If the field contains a hyphen, use single quotes to escape it, for example: objectAlias: '"hyphenated-alias"' Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2996 AWS Systems Manager failoverObject User Guide (Optional) If you specify this field, the ASCP tries to retrieve both the parameter specified in the primary objectName and the parameter specified in the failoverObject objectName sub-field. If either returns a 4xx error, for example for an authentication issue, the ASCP does
systems-manager-ug-847
systems-manager-ug.pdf
847
a hyphen, use single quotes to escape it, for example: path: '"hyphenated-path"' objectAlias The file name to be mounted in the Amazon EKS Pod. If the field contains a hyphen, use single quotes to escape it, for example: objectAlias: '"hyphenated-alias"' Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2996 AWS Systems Manager failoverObject User Guide (Optional) If you specify this field, the ASCP tries to retrieve both the parameter specified in the primary objectName and the parameter specified in the failoverObject objectName sub-field. If either returns a 4xx error, for example for an authentication issue, the ASCP does not mount either parameter. If the parameter is retrieved successfully from the primary objectName, then the ASCP mounts that parameter value. If the parameter is not retrieved successfully from the primary objectName, but it is retrieved successfully from the failover objectName, then the ASCP mounts that parameter value. If you include this field, you must include the field objectAlias. For an example of how to use this field, see Failover to a different parameter. You typically use this field when the failover parameter isn't a replica. For an example of how to specify a replica, see Multi-Region parameter failover. objectName The name or full ARN of the failover parameter. If you use an ARN, the Region in the ARN must match the field failoverRegion. objectVersion (Optional) The version ID of the parameter. Must match the primary objectVersion. Not recommended because you must update the version ID every time you update the parameter. By default the most recent version is used. objectVersionLabel (Optional) The alias for the version. The default is the most recent version AWSCURRENT. Create a basic SecretProviderClass configuration to mount parameters in your Amazon EKS Pods. Pod Identity SecretProviderClass to use a parameter in the same Amazon EKS cluster: apiVersion: secrets-store.csi.x-k8s.io/v1 kind: SecretProviderClass metadata: name: aws-parameter-store spec: Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2997 User Guide AWS Systems Manager provider: aws parameters: objects: | - objectName: "MyParameter" objectType: "ssmparameter" usePodIdentity: "true" IRSA apiVersion: secrets-store.csi.x-k8s.io/v1 kind: SecretProviderClass metadata: name: deployment-aws-parameter spec: provider: aws parameters: objects: | - objectName: "MyParameter" objectType: "ssmparameter" SecretProviderClass usage Use these examples to create SecretProviderClass configurations for different scenarios. Example: Mount parameters by name or ARN This example shows how to mount three different types of parameters: • A parameter specified by full ARN • A parameter specified by name • A parameter version of a secret apiVersion: secrets-store.csi.x-k8s.io/v1 kind: SecretProviderClass metadata: name: aws-parameters spec: provider: aws parameters: objects: | Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2998 AWS Systems Manager User Guide - objectName: "arn:aws:ssm:us-east-2:777788889999:parameter:MyParameter2-d4e5f6" - objectName: "MyParameter3" objectType: "ssmparameter" - objectName: "MyParameter4" objectType: "ssmparameter" objectVersionLabel: "AWSCURRENT" Example: Mount key-value pairs from a paraemter This example shows how to mount specific key-value pairs from a JSON-formatted parameter: apiVersion: secrets-store.csi.x-k8s.io/v1 kind: SecretProviderClass metadata: name: aws-parameters spec: provider: aws parameters: objects: | - objectName: "arn:aws:ssm:us-east-2:777788889999:parameter:MyParameter-a1b2c3" jmesPath: - path: username objectAlias: dbusername - path: password objectAlias: dbpassword Example: Failover configuration examples These examples show how to configure failover for parameters. Multi-Region parameter failover This example shows how to configure automatic failover for a parameter replicated across multiple Regions: apiVersion: secrets-store.csi.x-k8s.io/v1 kind: SecretProviderClass metadata: name: aws-parameters spec: provider: aws parameters: region: us-east-1 Use AWS Secrets Manager secrets in Amazon Elastic Kubernetes Service 2999 AWS Systems Manager User Guide failoverRegion: us-east-2 objects: | - objectName: "MyParameter" Failover to a different parameter This example shows how to configure failover to a different parameter (not a replica): apiVersion: secrets-store.csi.x-k8s.io/v1 kind: SecretProviderClass metadata: name: aws-parameters spec: provider: aws parameters: region: us-east-1 failoverRegion: us-east-2 objects: | - objectName: "arn:aws:ssm:us-east-1:777788889999:parameter:MyParameter-a1b2c3" objectAlias: "MyMountedParameter" failoverObject: - objectName: "arn:aws:ssm:us- east-2:777788889999:parameter:MyFailoverParameter-d4e5f6" Additional resources For more information about using ASCP with Amazon EKS, see the following resources: • Using Pod Identity with Amazon EKS • AWS Secrets Store CSI Driver on GitHub Using Parameter Store parameters in AWS Lambda functions Parameter Store, a tool in AWS Systems Manager, provides secure, hierarchical storage for configuration data management and secrets management. You can store data such as passwords, database strings, Amazon Machine Image (AMI) IDs, and license codes as parameter values. To use parameters from Parameter Store in AWS Lambda functions without using an SDK, you can use the AWS Parameters and Secrets Lambda Extension. This extension retrieves parameter values and caches them for future use. Using the Lambda extension can reduce your costs by reducing Using Parameter Store parameters in AWS Lambda functions 3000 AWS Systems Manager User Guide the number of API calls to Parameter Store. Using the extension can also improve latency because retrieving a cached parameter is faster than retrieving it from Parameter Store. A Lambda extension is a companion process that augments the capabilities of a Lambda function. An extension is like a client that runs in parallel to
systems-manager-ug-848
systems-manager-ug.pdf
848
SDK, you can use the AWS Parameters and Secrets Lambda Extension. This extension retrieves parameter values and caches them for future use. Using the Lambda extension can reduce your costs by reducing Using Parameter Store parameters in AWS Lambda functions 3000 AWS Systems Manager User Guide the number of API calls to Parameter Store. Using the extension can also improve latency because retrieving a cached parameter is faster than retrieving it from Parameter Store. A Lambda extension is a companion process that augments the capabilities of a Lambda function. An extension is like a client that runs in parallel to a Lambda invocation. This parallel client can interface with your function at any point during its lifecycle. For more information about Lambda extensions, see Lambda Extensions API in the AWS Lambda Developer Guide. The AWS Parameters and Secrets Lambda Extension works for both Parameter Store and AWS Secrets Manager. To learn how to use the Lambda extension with secrets from Secrets Manager, see Use AWS Secrets Manager secrets in AWS Lambda functions in the AWS Secrets Manager User Guide. Related info Using the AWS Parameter and Secrets Lambda extension to cache parameters and secrets (AWS Compute Blog) How the extension works To use parameters in a Lambda function without the Lambda extension, you must configure your Lambda function to receive configuration updates by integrating with the GetParameter API action for Parameter Store. When you use the AWS Parameters and Secrets Lambda Extension, the extension retrieves the parameter value from Parameter Store and stores it in the local cache. Then, the cached value is used for further invocations until it expires. Cached values expire after they pass their time-to- live (TTL). You can configure the TTL value using the SSM_PARAMETER_STORE_TTL environment variable, as explained later in this topic. If the configured cache TTL has not expired, the cached parameter value is used. If the time has expired, the cached value is invalidated and the parameter value is retrieved from Parameter Store. Also, the system detects parameter values that are used frequently and maintains them in the cache while clearing those that are expired or unused. Important The extension can be invoked only in the INVOKE phase of the Lambda operation and not during the INIT phase. Using Parameter Store parameters in AWS Lambda functions 3001 AWS Systems Manager Implementation details User Guide Use the following details to help you configure the AWS Parameters and Secrets Lambda Extension. Authentication To authorize and authenticate Parameter Store requests, the extension uses the same credentials as those used to run the Lambda function itself. Therefore, the AWS Identity and Access Management (IAM) role used to run the function must have the following permissions to interact with Parameter Store: • ssm:GetParameter – Required to retrieve parameters from Parameter Store • kms:Decrypt – Required if you are retrieving SecureString parameters from Parameter Store For more information, see AWS Lambda execution role in the AWS Lambda Developer Guide. Instantiation Lambda instantiates separate instances corresponding to the concurrency level that your function requires. Each instance is isolated and maintains its own local cache of your configuration data. For more information about Lambda instances and concurrency, see Configuring reserved concurrency in the AWS Lambda Developer Guide. No SDK dependence The AWS Parameters and Secrets Lambda Extension works independently of any AWS SDK language library. An AWS SDK is not required to make GET requests to Parameter Store. Localhost port Use localhost in your GET requests. The extension makes requests to localhost port 2773. You do not need to specify an external or internal endpoint to use the extension. You can configure the port by setting the environment variable PARAMETERS_SECRETS_EXTENSION_HTTP_PORT. For example, in Python, your GET URL might look something like the following example. parameter_url = ('http://localhost:' + port + '/systemsmanager/parameters/get/? name=' + ssm_parameter_path) Using Parameter Store parameters in AWS Lambda functions 3002 AWS Systems Manager User Guide Changes to a parameter value before TTL expires The extension doesn't detect changes to the parameter value and doesn't perform an auto- refresh before the TTL expires. If you change a parameter value, operations that use the cached parameter value might fail until the cache is next refreshed. If you expect frequent changes to a parameter value, we recommend setting a shorter TTL value. Header requirement To retrieve parameters from the extension cache, the header of your GET request must include an X-Aws-Parameters-Secrets-Token reference. Set the token to AWS_SESSION_TOKEN, which is provided by Lambda for all running functions. Using this header indicates that the caller is within the Lambda environment. Example The following example in Python demonstrates a basic request to retrieve the value of a cached parameter. import urllib.request import os import json aws_session_token = os.environ.get('AWS_SESSION_TOKEN') def lambda_handler(event, context): # Retrieve /my/parameter from Parameter Store using extension cache req = urllib.request.Request('http://localhost:2773/systemsmanager/parameters/ get?name=%2Fmy%2Fparameter')
systems-manager-ug-849
systems-manager-ug.pdf
849
to a parameter value, we recommend setting a shorter TTL value. Header requirement To retrieve parameters from the extension cache, the header of your GET request must include an X-Aws-Parameters-Secrets-Token reference. Set the token to AWS_SESSION_TOKEN, which is provided by Lambda for all running functions. Using this header indicates that the caller is within the Lambda environment. Example The following example in Python demonstrates a basic request to retrieve the value of a cached parameter. import urllib.request import os import json aws_session_token = os.environ.get('AWS_SESSION_TOKEN') def lambda_handler(event, context): # Retrieve /my/parameter from Parameter Store using extension cache req = urllib.request.Request('http://localhost:2773/systemsmanager/parameters/ get?name=%2Fmy%2Fparameter') req.add_header('X-Aws-Parameters-Secrets-Token', aws_session_token) config = urllib.request.urlopen(req).read() return json.loads(config) ARM support The extension supports the ARM architecture in most AWS Regions where the x86_64 and x86 architectures are supported. If you are using the ARM architecture, we suggest you verify your architecture is supported. For complete lists of extension ARNs, see AWS Parameters and Secrets Lambda Extension ARNs. Using Parameter Store parameters in AWS Lambda functions 3003 AWS Systems Manager Logging User Guide Lambda logs execution information about the extension along with the function by using Amazon CloudWatch Logs. By default, the extension logs a minimal amount of information to CloudWatch. To log more details, set the environment variable PARAMETERS_SECRETS_EXTENSION_LOG_LEVEL to DEBUG. Adding the extension to a Lambda function To use the AWS Parameters and Secrets Lambda Extension, you add the extension to your Lambda function as a layer. Use one of the following methods to add the extension to your function. AWS Management Console (Add layer option) 1. Open the AWS Lambda console at https://console.aws.amazon.com/lambda/. 2. Choose your function. In the Layers area, choose Add a layer. 3. In the Choose a layer area, choose the AWS layers option. 4. For AWS layers, choose AWS-Parameters-and-Secrets-Lambda-Extension, choose a version, and then choose Add. AWS Management Console (Specify ARN option) 1. Open the AWS Lambda console at https://console.aws.amazon.com/lambda/. 2. Choose your function. In the Layers area, choose Add a layer. 3. In the Choose a layer area, choose the Specify an ARN option. 4. For Specify an ARN, enter the extension ARN for your AWS Region and architecture, and then choose Add. AWS Command Line Interface Run the following command in the AWS CLI. Replace each example resource placeholder with your own information. aws lambda update-function-configuration \ --function-name function-name \ --layers layer-ARN Related information Using Parameter Store parameters in AWS Lambda functions 3004 AWS Systems Manager User Guide Using layers with your Lambda function Configuring extensions (.zip file archive) AWS Parameters and Secrets Lambda Extension environment variables You can configure the extension by changing the following environment variables. To see the current settings, set PARAMETERS_SECRETS_EXTENSION_LOG_LEVEL to DEBUG. For more information, see Using AWS Lambda environment variables in the AWS Lambda Developer Guide. Note AWS Lambda records operation details about the Lambda extension and Lambda function in Amazon CloudWatch Logs. Environment variable SSM_PARAM ETER_STOR E_TIMEOUT _MILLIS Details Required Valid values Default value All whole numbers 0 (zero) No Timeout, in milliseconds, for requests to Parameter Store. A value of 0 (zero) indicates no timeout. SECRETS_M ANAGER_TI MEOUT_MIL LIS No Timeout, in milliseconds, for requests to Secrets Manager. All whole numbers 0 (zero) A value of 0 (zero) indicates no timeout. Using Parameter Store parameters in AWS Lambda functions 3005 AWS Systems Manager Environment variable SSM_PARAM ETER_STOR E_TTL Details Required Valid values Default value User Guide No 0 (zero) to 300 s (Five minutes) 300 s (Five minutes) Maximum valid lifetime, in seconds, of a parameter in the cache before it is invalidated. A value of 0 (zero) indicates that the cache should be bypassed. This variable is ignored if the value for PARAMETER S_SECRETS _EXTENSIO N_CACHE_S IZE is 0 (zero). Using Parameter Store parameters in AWS Lambda functions 3006 AWS Systems Manager Environment variable Details Required Valid values Default value User Guide SECRETS_M ANAGER_TTL Maximum valid lifetime, in No 0 (zero) to 300 s (Five minutes) 300 s (5 minutes) seconds, of a secret in the cache before it is invalidat ed. A value of 0 (zero) indicates that the cache is bypassed. This variable is ignored if the value for PARAMETER S_SECRETS _EXTENSIO N_CACHE_S IZE is 0 (zero). Determines whether the cache for the extension is enabled. Value values: TRUE | FALSE PARAMETER S_SECRETS _EXTENSIO N_CACHE_E NABLED No TRUE | FALSE TRUE Using Parameter Store parameters in AWS Lambda functions 3007 AWS Systems Manager Environment variable PARAMETER S_SECRETS _EXTENSIO N_CACHE_S IZE Details Required Valid values Default value User Guide No 0 (zero) to 1000 1000 The maximum size of the cache in terms of number of items. A value of 0 (zero) indicates that the cache is bypassed. This variable is ignored if both cache TTL values are 0 (zero). The port for the local HTTP No server. PARAMETER S_SECRETS _EXTENSIO N_HTTP_PO RT
systems-manager-ug-850
systems-manager-ug.pdf
850
the extension is enabled. Value values: TRUE | FALSE PARAMETER S_SECRETS _EXTENSIO N_CACHE_E NABLED No TRUE | FALSE TRUE Using Parameter Store parameters in AWS Lambda functions 3007 AWS Systems Manager Environment variable PARAMETER S_SECRETS _EXTENSIO N_CACHE_S IZE Details Required Valid values Default value User Guide No 0 (zero) to 1000 1000 The maximum size of the cache in terms of number of items. A value of 0 (zero) indicates that the cache is bypassed. This variable is ignored if both cache TTL values are 0 (zero). The port for the local HTTP No server. PARAMETER S_SECRETS _EXTENSIO N_HTTP_PO RT 1 - 65535 2773 Using Parameter Store parameters in AWS Lambda functions 3008 AWS Systems Manager Environment variable PARAMETER S_SECRETS _EXTENSIO N_MAX_CON NECTIONS Details Required Valid values Default value User Guide No Minimum of 1; No maximum 3 limit. Maximum number of connections for the HTTP clients that the extension uses to make requests to Parameter Store or Secrets Manager. This is a per-client configuration for the number of connections that both the Secrets Manager client and Parameter Store client make to the backend services. Using Parameter Store parameters in AWS Lambda functions 3009 AWS Systems Manager Environment variable PARAMETER S_SECRETS _EXTENSIO N_LOG_LEV EL Details Required Valid values Default value User Guide No DEBUG | WARN INFO | ERROR | NONE | INFO The level of detail reported in logs for the extension. We recommend using DEBUG for the most detail about your cache configura tion as you set up and test the extension. Logs for Lambda operations are automatic ally pushed to an associate d CloudWatch Logs log group. Sample commands for using the AWS Systems Manager Parameter Store and AWS Secrets Manager Extension The examples in this section demonstrate API actions for use with the AWS Systems Manager Parameter Store and AWS Secrets Manager extension. Sample commands for Parameter Store The Lambda extension uses read-only access to the GetParameter API action. To call this action, make an HTTP GET call similar to the following. This command format provides access to parameters in the standard parameter tier. Using Parameter Store parameters in AWS Lambda functions 3010 AWS Systems Manager User Guide GET http://localhost:port/systemsmanager/parameters/get?name=parameter- name&version=version&label=label&withDecryption={true|false} In this example, parameter-name represents the full parameter name, such as MyParameter, for a parameter not in a hierarchy, or %2FDev%2FProduction%2FEast%2FProject-ABC %2FMyParameter for a parameter named /Dev/Production/East/Project-ABC/ MyParameter that is part of a hierarchy. Note When using GET calls, parameter values must be encoded for HTTP to preserve special characters. For example, instead of formatting a hierarchical path like /a/b/c, encode characters that could be interpreted as part of the URL, such as %2Fa%2Fb%2Fc. version and label are the selectors available for use with the GetParameter action. GET http://localhost:port/systemsmanager/parameters/get/?name=MyParameter&version=5 To call a parameter in a hierarchy, make an HTTP GET call similar to the following. GET http://localhost:port/systemsmanager/parameters/get?name=%2Fa%2Fb%2F&label=release To call a public (global) parameter, make an HTTP GET call similar to the following. GET http://localhost:port/systemsmanager/parameters/get/?name=%2Faws%2Fservice%20list %2F… To make an HTTP GET call to a Secrets Manager secret by using Parameter Store references, make an HTTP GET call similar to the following. GET http://localhost:port/systemsmanager/parameters/get?name=%2Faws%2Freference %2Fsecretsmanager%2F… To make a call using the Amazon Resource Name (ARN) for a parameter, make an HTTP GET call similar to the following. Using Parameter Store parameters in AWS Lambda functions 3011 AWS Systems Manager User Guide GET http://localhost:port/systemsmanager/parameters/get?name=arn:aws:ssm:us- east-1:123456789012:parameter/MyParameter To make a call that accesses a SecureString parameter with decryption, make an HTTP GET call similar to the following. GET http://localhost:port/systemsmanager/parameters/get? name=MyParameter&withDecryption=true You can specify that parameters aren't decrypted by omitting withDecryption or explicitly setting it to false. You can also specify either a version or a label, but not both. If you do, only the first of these that is placed after question mark (?) in the URL is used. AWS Parameters and Secrets Lambda Extension ARNs The following tables provide extension ARNs for supported architectures and Regions. Topics • Extension ARNs for the x86_64 and x86 architectures • Extension ARNs for ARM64 and Mac with Apple silicon architectures Extension ARNs for the x86_64 and x86 architectures Last updated: April 23rd, 2025 Region US East (Ohio) US East (N. Virginia) ARN arn:aws:lambda:us-east-2:59 0474943231:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension:21 arn:aws:lambda:us-east-1:17 7933569100:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension:17 Using Parameter Store parameters in AWS Lambda functions 3012 AWS Systems Manager Region US West (N. California) US West (Oregon) Africa (Cape Town) Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) Region Asia Pacific (Jakarta) Asia Pacific (Melbourne) User Guide ARN arn:aws:lambda:us-west-1:99 7803712105:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension:17 arn:aws:lambda:us-west-2:34 5057560386:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension:17 arn:aws:lambda:af-south-1:3 17013901791:layer:AWS-Param eters-and-Secrets-Lambda-Ex tension:17 arn:aws:lambda:ap-east-1:76 8336418462:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension:19 arn:aws:lambda:ap-south-2:0 70087711984:layer:AWS-Param eters-and-Secrets-Lambda-Ex tension:14 arn:aws:lambda:ap-southeast -3:490737872127:layer:AWS-P arameters-and-Secrets-Lambda- Extension:17 arn:aws:lambda:ap-southeast -4:090732460067:layer:AWS-P arameters-and-Secrets-Lambda- Extension:7 Using Parameter Store parameters in AWS Lambda functions 3013 AWS Systems Manager Region Asia Pacific (Malaysia) Asia Pacific (Mumbai) Asia Pacific (Osaka) Asia Pacific (Seoul) Asia Pacific (Singapore) Asia Pacific (Sydney) Asia Pacific (Thailand)
systems-manager-ug-851
systems-manager-ug.pdf
851
Store parameters in AWS Lambda functions 3012 AWS Systems Manager Region US West (N. California) US West (Oregon) Africa (Cape Town) Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) Region Asia Pacific (Jakarta) Asia Pacific (Melbourne) User Guide ARN arn:aws:lambda:us-west-1:99 7803712105:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension:17 arn:aws:lambda:us-west-2:34 5057560386:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension:17 arn:aws:lambda:af-south-1:3 17013901791:layer:AWS-Param eters-and-Secrets-Lambda-Ex tension:17 arn:aws:lambda:ap-east-1:76 8336418462:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension:19 arn:aws:lambda:ap-south-2:0 70087711984:layer:AWS-Param eters-and-Secrets-Lambda-Ex tension:14 arn:aws:lambda:ap-southeast -3:490737872127:layer:AWS-P arameters-and-Secrets-Lambda- Extension:17 arn:aws:lambda:ap-southeast -4:090732460067:layer:AWS-P arameters-and-Secrets-Lambda- Extension:7 Using Parameter Store parameters in AWS Lambda functions 3013 AWS Systems Manager Region Asia Pacific (Malaysia) Asia Pacific (Mumbai) Asia Pacific (Osaka) Asia Pacific (Seoul) Asia Pacific (Singapore) Asia Pacific (Sydney) Asia Pacific (Thailand) User Guide ARN arn:aws:lambda:ap-southeast -5:381492012281:layer:AWS-P arameters-and-Secrets-Lambda- Extension:6 arn:aws:lambda:ap-south-1:1 76022468876:layer:AWS-Param eters-and-Secrets-Lambda-Ex tension:17 arn:aws:lambda:ap-northeast -3:576959938190:layer:AWS-P arameters-and-Secrets-Lambda- Extension:17 arn:aws:lambda:ap-northeast -2:738900069198:layer:AWS-P arameters-and-Secrets-Lambda- Extension:17 arn:aws:lambda:ap-southeast -1:044395824272:layer:AWS-P arameters-and-Secrets-Lambda- Extension:17 arn:aws:lambda:ap-southeast -2:665172237481:layer:AWS-P arameters-and-Secrets-Lambda- Extension:17 arn:aws:lambda:ap-southeast -7:941377119484:layer:AWS-P arameters-and-Secrets-Lambda- Extension:5 Using Parameter Store parameters in AWS Lambda functions 3014 AWS Systems Manager Region Asia Pacific (Tokyo) Canada (Central) Canada West (Calgary) China (Beijing) China (Ningxia) Europe (Frankfurt) Europe (Ireland) User Guide ARN arn:aws:lambda:ap-northeast -1:133490724326:layer:AWS-P arameters-and-Secrets-Lambda- Extension:17 arn:aws:lambda:ca-central-1 :200266452380:layer:AWS-Par ameters-and-Secrets-Lambda- Extension:19 arn:aws:lambda:ca-west-1:24 3964427225:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension:7 arn:aws-cn:lambda:cn-north- 1:287114880934:layer:AWS-Pa rameters-and-Secrets-Lambda- Extension:17 arn:aws-cn:lambda:cn-northw est-1:287310001119:layer:AWS- Parameters-and-Secrets-Lambda- Extension:17 arn:aws:lambda:eu-central-1 :187925254637:layer:AWS-Par ameters-and-Secrets-Lambda- Extension:17 arn:aws:lambda:eu-west-1:01 5030872274:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension:17 Using Parameter Store parameters in AWS Lambda functions 3015 AWS Systems Manager Region Europe (London) Europe (Milan) Europe (Paris) Europe (Spain) Region Europe (Stockholm) Israel (Tel Aviv) Europe (Zurich) Region User Guide ARN arn:aws:lambda:eu-west-2:13 3256977650:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension:17 arn:aws:lambda:eu-south-1:3 25218067255:layer:AWS-Param eters-and-Secrets-Lambda-Ex tension:17 arn:aws:lambda:eu-west-3:78 0235371811:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension:17 arn:aws:lambda:eu-south-2:5 24103009944:layer:AWS-Param eters-and-Secrets-Lambda-Ex tension:16 arn:aws:lambda:eu-north-1:4 27196147048:layer:AWS-Param eters-and-Secrets-Lambda-Ex tension:17 arn:aws:lambda:il-central-1 :148806536434:layer:AWS-Par ameters-and-Secrets-Lambda- Extension:7 arn:aws:lambda:eu-central-2 :772501565639:layer:AWS-Par ameters-and-Secrets-Lambda- Extension:14 Using Parameter Store parameters in AWS Lambda functions 3016 AWS Systems Manager Region Mexico (Central) Region Middle East (Bahrain) Middle East (UAE) South America (São Paulo) AWS GovCloud (US-East) AWS GovCloud (US-West) User Guide ARN arn:aws:lambda:mx-central-1 :241533131596:layer:AWS-Par ameters-and-Secrets-Lambda- Extension:4 arn:aws:lambda:me-south-1:8 32021897121:layer:AWS-Param eters-and-Secrets-Lambda-Ex tension:17 arn:aws:lambda:me-central-1 :858974508948:layer:AWS-Par ameters-and-Secrets-Lambda- Extension:17 arn:aws:lambda:sa-east-1:93 3737806257:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension:17 arn:aws-us-gov:lambda:us-gov- east-1:129776340158:layer:AWS- Parameters-and-Secrets-Lambda-E xtension:17 arn:aws-us-gov:lambda:us-gov- west-1:127562683043:layer:AWS- Parameters-and-Secrets-Lambda-E xtension:17 Extension ARNs for ARM64 and Mac with Apple silicon architectures Last updated: April 23rd, 2025 Using Parameter Store parameters in AWS Lambda functions 3017 AWS Systems Manager Region US East (Ohio) US East (N. Virginia) US West (N. California) Region US West (Oregon) Africa (Cape Town) Region Asia Pacific (Hong Kong) Region Asia Pacific (Hyderabad) Region User Guide ARN arn:aws:lambda:us-east-2:59 0474943231:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension-Arm64:21 arn:aws:lambda:us-east-1:17 7933569100:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension-Arm64:17 arn:aws:lambda:us-west-1:99 7803712105:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension-Arm64:14 arn:aws:lambda:us-west-2:34 5057560386:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension-Arm64:17 arn:aws:lambda:af-south-1:3 17013901791:layer:AWS-Param eters-and-Secrets-Lambda-Ex tension-Arm64:14 arn:aws:lambda:ap-east-1:76 8336418462:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension-Arm64:16 arn:aws:lambda:ap-south-2:0 70087711984:layer:AWS-Param eters-and-Secrets-Lambda-Ex tension-Arm64:6 Using Parameter Store parameters in AWS Lambda functions 3018 AWS Systems Manager Region Asia Pacific (Jakarta) Region Asia Pacific (Melbourne) Asia Pacific (Malaysia) Asia Pacific (Mumbai) Asia Pacific (Osaka) Asia Pacific (Seoul) Region Asia Pacific (Singapore) User Guide ARN arn:aws:lambda:ap-southeast -3:490737872127:layer:AWS-P arameters-and-Secrets-Lambda- Extension-Arm64:14 arn:aws:lambda:ap-southeast -4:090732460067:layer:AWS-P arameters-and-Secrets-Lambda- Extension-Arm64:6 arn:aws:lambda:ap-southeast -5:381492012281:layer:AWS-P arameters-and-Secrets-Lambda- Extension-Arm64:6 arn:aws:lambda:ap-south-1:1 76022468876:layer:AWS-Param eters-and-Secrets-Lambda-Ex tension-Arm64:17 arn:aws:lambda:ap-northeast -3:576959938190:layer:AWS-P arameters-and-Secrets-Lambda- Extension-Arm64:14 arn:aws:lambda:ap-northeast -2:738900069198:layer:AWS-P arameters-and-Secrets-Lambda- Extension-Arm64:14 arn:aws:lambda:ap-southeast -1:044395824272:layer:AWS-P arameters-and-Secrets-Lambda- Extension-Arm64:17 Using Parameter Store parameters in AWS Lambda functions 3019 AWS Systems Manager Region Asia Pacific (Sydney) Asia Pacific (Thailand) Asia Pacific (Tokyo) Canada (Central) Region Canada West (Calgary) China (Beijing) China (Ningxia) User Guide ARN arn:aws:lambda:ap-southeast -2:665172237481:layer:AWS-P arameters-and-Secrets-Lambda- Extension-Arm64:17 arn:aws:lambda:ap-southeast -7:941377119484:layer:AWS-P arameters-and-Secrets-Lambda- Extension-Arm64:4 arn:aws:lambda:ap-northeast -1:133490724326:layer:AWS-P arameters-and-Secrets-Lambda- Extension-Arm64:17 arn:aws:lambda:ca-central-1 :200266452380:layer:AWS-Par ameters-and-Secrets-Lambda- Extension-Arm64:16 arn:aws:lambda:ca-west-1:24 3964427225:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension-Arm64:6 arn:aws-cn:lambda:cn-north- 1:287114880934:layer:AWS-Pa rameters-and-Secrets-Lambda- Extension-Arm64:6 arn:aws-cn:lambda:cn-northw est-1:287310001119:layer:AWS- Parameters-and-Secrets-Lambda- Extension-Arm64:6 Using Parameter Store parameters in AWS Lambda functions 3020 AWS Systems Manager Region Europe (Frankfurt) Europe (Ireland) Europe (London) Europe (Milan) Region Europe (Paris) Region Europe (Spain) Region Europe (Stockholm) Region User Guide ARN arn:aws:lambda:eu-central-1 :187925254637:layer:AWS-Par ameters-and-Secrets-Lambda- Extension-Arm64:17 arn:aws:lambda:eu-west-1:01 5030872274:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension-Arm64:17 arn:aws:lambda:eu-west-2:13 3256977650:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension-Arm64:17 arn:aws:lambda:eu-south-1:3 25218067255:layer:AWS-Param eters-and-Secrets-Lambda-Ex tension-Arm64:14 arn:aws:lambda:eu-west-3:78 0235371811:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension-Arm64:14 arn:aws:lambda:eu-south-2:5 24103009944:layer:AWS-Param eters-and-Secrets-Lambda-Ex tension-Arm64:8 arn:aws:lambda:eu-north-1:4 27196147048:layer:AWS-Param eters-and-Secrets-Lambda-Ex tension-Arm64:14 Using Parameter Store parameters in AWS Lambda functions 3021 AWS Systems Manager Region Israel (Tel Aviv) Europe (Zurich) Region Mexico (Central) Region Middle East (Bahrain) Region Middle East (UAE) User Guide ARN arn:aws:lambda:il-central-1 :148806536434:layer:AWS-Par ameters-and-Secrets-Lambda- Extension-Arm64:6 arn:aws:lambda:eu-central-2 :772501565639:layer:AWS-Par ameters-and-Secrets-Lambda- Extension-Arm64:6 arn:aws:lambda:mx-central-1 :241533131596:layer:AWS-Par ameters-and-Secrets-Lambda- Extension-Arm64:3 arn:aws:lambda:me-south-1:8 32021897121:layer:AWS-Param eters-and-Secrets-Lambda-Ex tension-Arm64:14 arn:aws:lambda:me-central-1 :858974508948:layer:AWS-Par ameters-and-Secrets-Lambda- Extension-Arm64:6 South America (São Paulo) Region arn:aws:lambda:sa-east-1:93 AWS GovCloud (US-East) 3737806257:layer:AWS-Parame ters-and-Secrets-Lambda-Ext ension-Arm64:14 arn:aws-us-gov:lambda:us-gov- east-1:129776340158:layer:AWS- Parameters-and-Secrets-Lambda-E xtension-Arm64:6 Using Parameter Store parameters in AWS Lambda functions 3022 AWS Systems Manager Region AWS GovCloud (US-West) User Guide ARN arn:aws-us-gov:lambda:us-gov- west-1:127562683043:layer:AWS- Parameters-and-Secrets-Lambda-E xtension-Arm64:6 Integration with other products and services AWS Systems Manager has built-in integration for the products and services shown in the following table. Ansible Chef Ansible is an IT automation platform that makes your applications and systems easier to deploy. Systems Manager provides the Systems Manager document (SSM document) AWS- ApplyAnsiblePlaybooks you to create State Manager associations that which allows run Ansible playbooks. Learn more Creating associations that run Ansible playbooks Chef is an IT automation tool that makes your applications and systems easier to deploy. Systems Manager provides the AWS-Apply ChefRecipes SSM document, which allows you to create associations in State Manager, a tool in AWS Systems Manager, that run Chef recipes. Learn more Integration with other products and
systems-manager-ug-852
systems-manager-ug.pdf
852
the following table. Ansible Chef Ansible is an IT automation platform that makes your applications and systems easier to deploy. Systems Manager provides the Systems Manager document (SSM document) AWS- ApplyAnsiblePlaybooks you to create State Manager associations that which allows run Ansible playbooks. Learn more Creating associations that run Ansible playbooks Chef is an IT automation tool that makes your applications and systems easier to deploy. Systems Manager provides the AWS-Apply ChefRecipes SSM document, which allows you to create associations in State Manager, a tool in AWS Systems Manager, that run Chef recipes. Learn more Integration with other products and services 3023 AWS Systems Manager User Guide GitHub Creating associations that run Chef recipes Systems Manager also integrates with Chef InSpec profiles, allowing you to run complianc e scans and view compliant and noncompliant nodes. Learn more Using Chef InSpec profiles with Systems Manager Compliance GitHub provides hosting for software development version control and collabora tion. Systems Manager provides the SSM document AWS-RunDocument , which allows you to run other SSM documents stored in GitHub, and the SSM document AWS-RunRemoteScrip t , which allows you to run scripts stored in GitHub. Learn more • Running documents from remote locations • Running scripts from GitHub Integration with other products and services 3024 AWS Systems Manager Jenkins ServiceNow User Guide Jenkins is an open-source automation server that allows developers to reliably build, test, and deploy their software. Automation, a tool in Systems Manager, can be used as a post-build step to pre-install application releases into Amazon Machine Images (AMIs). Learn more Updating AMIs using Automation and Jenkins ServiceNow is an enterprise service management system that allows you to manage your IT services and operations. Automation, Change Manager, Incident Manager, and OpsCenter, all tools in Systems Manager, integrate with ServiceNow by using the AWS Service Management Connector. With this integration, you can view, create, update, add correspondence, and resolve AWS Support cases from ServiceNow. Learn more Integrating with ServiceNow Integration with other products and services 3025 AWS Systems Manager Terraform User Guide HashiCorp Terraform is an open-source infrastructure as code (IaC) software tool that provides a command line interface (CLI) workflow to manage various cloud services. For Systems Manager, you can use Terraform to manage or provision the following: Resources • aws_ssm_activation • aws_ssm_association • aws_ssm_default_patch_baseline • aws_ssm_document • aws_ssm_maintenance_window • aws_ssm_maintenance_window_target • aws_ssm_maintenance_window_task • aws_ssm_parameter • aws_ssm_patch_baseline • aws_ssm_patch_group • aws_ssm_resource_data_sync • aws_ssm_service_setting Data sources • aws_ssm_document • aws_ssm_instances • ssm_maintenance_windows • aws_ssm_parameter • aws_ssm_parameters_by_path • aws_ssm_patch_baseline Topics • Running scripts from GitHub Integration with other products and services 3026 AWS Systems Manager User Guide • Using Chef InSpec profiles with Systems Manager Compliance • Integrating with ServiceNow Running scripts from GitHub This topic describes how to use the pre-defined Systems Manager document (SSM document) AWS- RunRemoteScript to download scripts from GitHub, including Ansible Playbooks, Python, Ruby, and PowerShell scripts. By using this SSM document, you no longer need to manually port scripts into Amazon Elastic Compute Cloud (Amazon EC2) or wrap them in SSM documents. AWS Systems Manager integration with GitHub promotes infrastructure as code, which reduces the time it takes to manage nodes while standardizing configurations across your fleet. You can also create custom SSM documents that allow you to download and run scripts or other SSM documents from remote locations. For more information, see Creating composite documents. You can also download a directory that includes multiple scripts. When you run the primary script in the directory, Systems Manager also runs any referenced scripts that are included in the directory. Note the following important details about running scripts from GitHub. • Systems Manager doesn't verify that your script is capable of running on a node. Before you download and run the script, verify that the required software is installed on the node. Or, you can create a composite document that installs the software by using either Run Command or State Manager,tools in AWS Systems Manager, and then downloads and runs the script. • You're responsible for ensuring that all GitHub requirements are met. This includes refreshing your access token, as needed. Ensure that you don't surpass the number of authenticated or unauthenticated requests. For more information, see the GitHub documentation. • GitHub Enterprise repositories are not supported. Topics • Run Ansible Playbooks from GitHub • Run Python scripts from GitHub Running scripts from GitHub 3027 AWS Systems Manager User Guide Run Ansible Playbooks from GitHub This section includes procedures to help you run Ansible Playbooks from GitHub by using either the console or the AWS Command Line Interface (AWS CLI). Before you begin If you plan to run a script stored in a private GitHub repository, create an AWS Systems Manager SecureString parameter for your GitHub security access token. You can't access a script in a private GitHub repository by
systems-manager-ug-853
systems-manager-ug.pdf
853
• GitHub Enterprise repositories are not supported. Topics • Run Ansible Playbooks from GitHub • Run Python scripts from GitHub Running scripts from GitHub 3027 AWS Systems Manager User Guide Run Ansible Playbooks from GitHub This section includes procedures to help you run Ansible Playbooks from GitHub by using either the console or the AWS Command Line Interface (AWS CLI). Before you begin If you plan to run a script stored in a private GitHub repository, create an AWS Systems Manager SecureString parameter for your GitHub security access token. You can't access a script in a private GitHub repository by manually passing your token over SSH. The access token must be passed as a Systems Manager SecureString parameter. For more information about creating a SecureString parameter, see Creating Parameter Store parameters in Systems Manager. Run an Ansible Playbook from GitHub (console) Run an Ansible Playbook from GitHub 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Run Command. 3. Choose Run command. 4. 5. In the Command document list, choose AWS-RunRemoteScript. In Command parameters, do the following: • In Source Type, select GitHub. • In the Source Info box, enter the required information to access the source in the following format. { "owner": "owner_name", "repository": "repository_name", "getOptions": "branch:branch_name", "path": "path_to_scripts_or_directory", "tokenInfo": "{{ssm-secure:SecureString_parameter_name}}" } This example downloads a file named webserver.yml. { Running scripts from GitHub 3028 AWS Systems Manager User Guide "owner": "TestUser1", "repository": "GitHubPrivateTest", "getOptions": "branch:myBranch", "path": "scripts/webserver.yml", "tokenInfo": "{{ssm-secure:mySecureStringParameter}}" } Note "branch" is required only if your SSM document is stored in a branch other than master. To use the version of your scripts that are in a particular commit in your repository, use commitID with getOptions instead of branch. For example: "getOptions": "commitID:bbc1ddb94...b76d3bEXAMPLE", • In the Command Line field, enter parameters for the script execution. Here is an example. ansible-playbook -i “localhost,” --check -c local webserver.yml • (Optional) In the Working Directory field, enter the name of a directory on the node where you want to download and run the script. • (Optional) In Execution Timeout, specify the number of seconds for the system to wait before failing the script command execution. 6. In the Targets section, choose the managed nodes on which you want to run this operation by specifying tags, selecting instances or edge devices manually, or specifying a resource group. Tip If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. 7. For Other parameters: • For Comment, enter information about this command. • For Timeout (seconds), specify the number of seconds for the system to wait before failing the overall command execution. 8. For Rate control: Running scripts from GitHub 3029 AWS Systems Manager User Guide • For Concurrency, specify either a number or a percentage of managed nodes on which to run the command at the same time. Note If you selected targets by specifying tags applied to managed nodes or by specifying AWS resource groups, and you aren't certain how many managed nodes are targeted, then restrict the number of targets that can run the document at the same time by specifying a percentage. • For Error threshold, specify when to stop running the command on other managed nodes after it fails on either a number or a percentage of nodes. For example, if you specify three errors, then Systems Manager stops sending the command when the fourth error is received. Managed nodes still processing the command might also send errors. 9. (Optional) For Output options, to save the command output to a file, select the Write command output to an S3 bucket box. Enter the bucket and prefix (folder) names in the boxes. Note The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile (for EC2 instances) or IAM service role (hybrid-activated machines) assigned to the instance, not those of the IAM user performing this task. For more information, see Configure instance permissions required for Systems Manager or Create an IAM service role for a hybrid environment. In addition, if the specified S3 bucket is in a different AWS account, make sure that the instance profile or IAM service role associated with the managed node has the necessary permissions to write to that bucket. 10. In the SNS notifications section, if you want notifications sent about the status of the command execution, select the Enable SNS notifications check box. For more information about configuring Amazon SNS notifications for Run Command, see Monitoring Systems Manager status changes using Amazon SNS notifications. 11. Choose Run. Running scripts from GitHub 3030 AWS Systems Manager User Guide Run an Ansible Playbook from GitHub by using the AWS CLI 1. Install and configure the AWS Command Line Interface (AWS
systems-manager-ug-854
systems-manager-ug.pdf
854
instance profile or IAM service role associated with the managed node has the necessary permissions to write to that bucket. 10. In the SNS notifications section, if you want notifications sent about the status of the command execution, select the Enable SNS notifications check box. For more information about configuring Amazon SNS notifications for Run Command, see Monitoring Systems Manager status changes using Amazon SNS notifications. 11. Choose Run. Running scripts from GitHub 3030 AWS Systems Manager User Guide Run an Ansible Playbook from GitHub by using the AWS CLI 1. Install and configure the AWS Command Line Interface (AWS CLI), if you haven't already. For information, see Installing or updating the latest version of the AWS CLI. 2. Run the following command to download and run a script from GitHub. aws ssm send-command \ --document-name "AWS-RunRemoteScript" \ --instance-ids "instance-IDs"\ --parameters '{"sourceType":["GitHub"],"sourceInfo":["{\"owner \":\"owner_name\", \"repository\": \"repository_name\", \"path \": \"path_to_file_or_directory\", \"tokenInfo\":\"{{ssm- secure:name_of_your_SecureString_parameter}}\" }"],"commandLine": ["commands_to_run"]}' Here is an example command to run on a local Linux machine. aws ssm send-command \ --document-name "AWS-RunRemoteScript" \ --instance-ids "i-02573cafcfEXAMPLE" \ --parameters '{"sourceType":["GitHub"],"sourceInfo":["{\"owner\":\"TestUser1\", \"repository\": \"GitHubPrivateTest\", \"path\": \"scripts/webserver.yml\", \"tokenInfo\":\"{{ssm-secure:mySecureStringParameter}}\" }"],"commandLine": ["ansible-playbook -i “localhost,” --check -c local webserver.yml"]}' Run Python scripts from GitHub This section includes procedures to help you run Python scripts from GitHub by using either the AWS Systems Manager console or the AWS Command Line Interface (AWS CLI). Run a Python script from GitHub (console) Run a Python script from GitHub 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose Run Command. 3. Choose Run command. Running scripts from GitHub 3031 AWS Systems Manager User Guide 4. 5. In the Command document list, choose AWS-RunRemoteScript. For Command parameters, do the following: • In Source Type, select GitHub. • In the Source Info box, enter the required information to access the source in the following format: { "owner": "owner_name", "repository": "repository_name", "getOptions": "branch:branch_name", "path": "path_to_document", "tokenInfo": "{{ssm-secure:SecureString_parameter_name}}" } The following example downloads a directory of scripts named complex-script. { "owner": "TestUser1", "repository": "SSMTestDocsRepo", "getOptions": "branch:myBranch", "path": "scripts/python/complex-script", "tokenInfo": "{{ssm-secure:myAccessTokenParam}}" } Note "branch" is required only if your scripts are stored in a branch other than master. To use the version of your scripts that are in a particular commit in your repository, use commitID with getOptions instead of branch. For example: "getOptions": "commitID:bbc1ddb94...b76d3bEXAMPLE", • For Command Line, enter parameters for the script execution. Here is an example. mainFile.py argument-1 argument-2 This example runs mainFile.py, which can then run other scripts in the complex-script directory. Running scripts from GitHub 3032 AWS Systems Manager User Guide • (Optional) For Working Directory, enter the name of a directory on the node where you want to download and run the script. • (Optional) For Execution Timeout, specify the number of seconds for the system to wait before failing the script command execution. 6. In the Targets section, choose the managed nodes on which you want to run this operation by specifying tags, selecting instances or edge devices manually, or specifying a resource group. Tip If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. 7. For Other parameters: • For Comment, enter information about this command. • For Timeout (seconds), specify the number of seconds for the system to wait before failing the overall command execution. 8. For Rate control: • For Concurrency, specify either a number or a percentage of managed nodes on which to run the command at the same time. Note If you selected targets by specifying tags applied to managed nodes or by specifying AWS resource groups, and you aren't certain how many managed nodes are targeted, then restrict the number of targets that can run the document at the same time by specifying a percentage. • For Error threshold, specify when to stop running the command on other managed nodes after it fails on either a number or a percentage of nodes. For example, if you specify three errors, then Systems Manager stops sending the command when the fourth error is received. Managed nodes still processing the command might also send errors. 9. (Optional) For Output options, to save the command output to a file, select the Write command output to an S3 bucket box. Enter the bucket and prefix (folder) names in the boxes. Running scripts from GitHub 3033 AWS Systems Manager Note User Guide The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile (for EC2 instances) or IAM service role (hybrid-activated machines) assigned to the instance, not those of the IAM user performing this task. For more information, see Configure instance permissions required for Systems Manager or Create an IAM service role for a hybrid environment. In addition, if the specified S3 bucket is in a different
systems-manager-ug-855
systems-manager-ug.pdf
855
an S3 bucket box. Enter the bucket and prefix (folder) names in the boxes. Running scripts from GitHub 3033 AWS Systems Manager Note User Guide The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile (for EC2 instances) or IAM service role (hybrid-activated machines) assigned to the instance, not those of the IAM user performing this task. For more information, see Configure instance permissions required for Systems Manager or Create an IAM service role for a hybrid environment. In addition, if the specified S3 bucket is in a different AWS account, make sure that the instance profile or IAM service role associated with the managed node has the necessary permissions to write to that bucket. 10. In the SNS notifications section, if you want notifications sent about the status of the command execution, select the Enable SNS notifications check box. For more information about configuring Amazon SNS notifications for Run Command, see Monitoring Systems Manager status changes using Amazon SNS notifications. 11. Choose Run. Run a Python script from GitHub by using the AWS CLI 1. Install and configure the AWS Command Line Interface (AWS CLI), if you haven't already. For information, see Installing or updating the latest version of the AWS CLI. 2. Run the following command to download and run a script from GitHub. aws ssm send-command --document-name "AWS-RunRemoteScript" --instance- ids "instance-IDs" --parameters '{"sourceType":["GitHub"],"sourceInfo": ["{\"owner\":\"owner_name\", \"repository\":\"repository_name\", \"path\": \"path_to_script_or_directory"}"],"commandLine":["commands_to_run"]}' Here is an example. aws ssm send-command --document-name "AWS-RunRemoteScript" --instance-ids "i-02573cafcfEXAMPLE" --parameters '{"sourceType":["GitHub"],"sourceInfo": ["{\"owner\":\"TestUser1\", \"repository\":\"GitHubTestPublic\", \"path\": \"scripts/python/complex-script\"}"],"commandLine":["mainFile.py argument-1 argument-2 "]}' Running scripts from GitHub 3034 AWS Systems Manager User Guide This example downloads a directory of scripts called complex-script. The commandLine entry runs mainFile.py, which can then run other scripts in the complex-script directory. Using Chef InSpec profiles with Systems Manager Compliance AWS Systems Manager integrates with Chef InSpec. Chef InSpec is an open-source testing framework that allows you to create human-readable profiles to store in GitHub or Amazon Simple Storage Service (Amazon S3). Then you can use Systems Manager to run compliance scans and view compliant and noncompliant nodes. A profile is a security, compliance, or policy requirement for your computing environment. For example, you can create profiles that perform the following checks when you scan your nodes with Compliance, a tool in AWS Systems Manager: • Check if specific ports are open or closed. • Check if specific applications are running. • Check if certain packages are installed. • Check Windows Registry keys for specific properties. You can create InSpec profiles for Amazon Elastic Compute Cloud (Amazon EC2) instances and on- premises servers or virtual machines (VMs) that you manage with Systems Manager. The following sample Chef InSpec profile checks if port 22 is open. control 'Scan Port' do impact 10.0 title 'Server: Configure the service port' desc 'Always specify which port the SSH server should listen to. Prevent unexpected settings.' describe sshd_config do its('Port') { should eq('22') } end end InSpec includes a collection of resources that help you quickly write checks and auditing controls. InSpec uses the InSpec Domain-specific Language (DSL) for writing these controls in Ruby. You can also use profiles created by a large community of InSpec users. For example, the DevSec chef-os- hardening project on GitHub includes dozens of profiles to help you secure your nodes. You can author and store profiles in GitHub or Amazon S3. Using Chef InSpec profiles with Systems Manager Compliance 3035 AWS Systems Manager How it works User Guide Here is how the process of using InSpec profiles with Compliance works: 1. Either identify predefined InSpec profiles that you want to use, or create your own. You can use predefined profiles on GitHub to get started. For information about how to create your own InSpec profiles, see ChefChef InSpec Profiles. 2. Store profiles in either a public or private GitHub repository, or in an S3 bucket. 3. Run Compliance with your InSpec profiles by using the Systems Manager document (SSM document) AWS-RunInspecChecks. You can begin a Compliance scan by using Run Command, a tool in AWS Systems Manager, for on-demand scans, or you can schedule regular Compliance scans by using State Manager, a tool in AWS Systems Manager. 4. Identify noncompliant nodes by using the Compliance API or the Compliance console. Note Note the following information. • Chef uses a client on your nodes to process the profile. You don't need to install the client. When Systems Manager runs the SSM document AWS-RunInspecChecks, the system checks if the client is installed. If not, Systems Manager installs the Chef client during the scan, and then uninstalls the client after the scan is completed. • Running the SSM document AWS-RunInspecChecks, as described in this topic, assigns a compliance entry of type Custom:Inspec to each targeted node. To assign this
systems-manager-ug-856
systems-manager-ug.pdf
856
Manager. 4. Identify noncompliant nodes by using the Compliance API or the Compliance console. Note Note the following information. • Chef uses a client on your nodes to process the profile. You don't need to install the client. When Systems Manager runs the SSM document AWS-RunInspecChecks, the system checks if the client is installed. If not, Systems Manager installs the Chef client during the scan, and then uninstalls the client after the scan is completed. • Running the SSM document AWS-RunInspecChecks, as described in this topic, assigns a compliance entry of type Custom:Inspec to each targeted node. To assign this compliance type, the document calls the PutComplianceItems API operation. Running an InSpec compliance scan This section includes information about how to run an InSpec compliance scan by using the Systems Manager console and the AWS Command Line Interface (AWS CLI). The console procedure shows how to configure State Manager to run the scan. The AWS CLI procedure shows how to configure Run Command to run the scan. Using Chef InSpec profiles with Systems Manager Compliance 3036 AWS Systems Manager User Guide Running an InSpec compliance scan with State Manager (console) To run an InSpec compliance scan with State Manager by using the AWS Systems Manager console 1. Open the AWS Systems Manager console at https://console.aws.amazon.com/systems- manager/. 2. In the navigation pane, choose State Manager. 3. Choose Create association. 4. 5. 6. 7. In the Provide association details section, enter a name. In the Document list, choose AWS-RunInspecChecks. In the Document version list, choose Latest at runtime. In the Parameters section, in the Source Type list, choose either GitHub or S3. If you choose GitHub, then enter the path to an InSpec profile in either a public or private GitHub repository in the Source Info field. Here is an example path to a public profile provided by the Systems Manager team from the following location: https://github.com/awslabs/ amazon-ssm/tree/master/Compliance/InSpec/PortCheck. {"owner":"awslabs","repository":"amazon-ssm","path":"Compliance/InSpec/ PortCheck","getOptions":"branch:master"} If you choose S3, then enter a valid URL to an InSpec profile in an S3 bucket in the Source Info field. For more information about how Systems Manager integrates with GitHub and Amazon S3, see Running scripts from GitHub. 8. In the Targets section, choose the managed nodes on which you want to run this operation by specifying tags, selecting instances or edge devices manually, or specifying a resource group. Tip If a managed node you expect to see isn't listed, see Troubleshooting managed node availability for troubleshooting tips. 9. In the Specify schedule section, use the schedule builder options to create a schedule that specifies when you want the Compliance scan to run. Using Chef InSpec profiles with Systems Manager Compliance 3037 AWS Systems Manager 10. For Rate control: User Guide • For Concurrency, specify either a number or a percentage of managed nodes on which to run the command at the same time. Note If you selected targets by specifying tags applied to managed nodes or by specifying AWS resource groups, and you aren't certain how many managed nodes are targeted, then restrict the number of targets that can run the document at the same time by specifying a percentage. • For Error threshold, specify when to stop running the command on other managed nodes after it fails on either a number or a percentage of nodes. For example, if you specify three errors, then Systems Manager stops sending the command when the fourth error is received. Managed nodes still processing the command might also send errors. 11. (Optional) For Output options, to save the command output to a file, select the Write command output to an S3 bucket box. Enter the bucket and prefix (folder) names in the boxes. Note The S3 permissions that grant the ability to write the data to an S3 bucket are those of the instance profile (for EC2 instances) or IAM service role (hybrid-activated machines) assigned to the instance, not those of the IAM user performing this task. For more information, see Configure instance permissions required for Systems Manager or Create an IAM service role for a hybrid environment. In addition, if the specified S3 bucket is in a different AWS account, make sure that the instance profile or IAM service role associated with the managed node has the necessary permissions to write to that bucket. 12. Choose Create Association. The system creates the association and automatically runs the Compliance scan. 13. Wait several minutes for the scan to complete, and then choose Compliance in the navigation pane. 14. In Corresponding managed instances, locate nodes where the Compliance Type column is Custom:Inspec. Using Chef InSpec profiles with Systems Manager Compliance 3038 AWS Systems Manager User Guide 15. Choose a node ID to view the details of noncompliant statuses. Running an InSpec compliance scan with Run Command (AWS CLI) 1. Install and configure the
systems-manager-ug-857
systems-manager-ug.pdf
857
with the managed node has the necessary permissions to write to that bucket. 12. Choose Create Association. The system creates the association and automatically runs the Compliance scan. 13. Wait several minutes for the scan to complete, and then choose Compliance in the navigation pane. 14. In Corresponding managed instances, locate nodes where the Compliance Type column is Custom:Inspec. Using Chef InSpec profiles with Systems Manager Compliance 3038 AWS Systems Manager User Guide 15. Choose a node ID to view the details of noncompliant statuses. Running an InSpec compliance scan with Run Command (AWS CLI) 1. Install and configure the AWS Command Line Interface (AWS CLI), if you haven't already. For information, see Installing or updating the latest version of the AWS CLI. 2. Run one of the following commands to run an InSpec profile from either GitHub or Amazon S3. The command takes the following parameters: • sourceType: GitHub or Amazon S3 • sourceInfo: URL to the InSpec profile folder either in GitHub or an S3 bucket. The folder must contain the base InSpec file (*.yml) and all related controls (*.rb). GitHub aws ssm send-command --document-name "AWS-RunInspecChecks" --targets '[{"Key":"tag:tag_name","Values":["tag_value"]}]' --parameters '{"sourceType": ["GitHub"],"sourceInfo":["{\"owner\":\"owner_name\", \"repository\": \"repository_name\", \"path\": \"Inspec.yml_file"}"]}' Here is an example. aws ssm send-command --document-name "AWS-RunInspecChecks" --targets '[{"Key":"tag:testEnvironment","Values":["webServers"]}]' --parameters '{"sourceType":["GitHub"],"getOptions":"branch:master","sourceInfo":["{\"owner\": \"awslabs\", \"repository\":\"amazon-ssm\", \"path\": \"Compliance/InSpec/PortCheck \"}"]}' Amazon S3 aws ssm send-command --document-name "AWS-RunInspecChecks" --targets '[{"Key":"tag:tag_name","Values":["tag_value"]}]' --parameters'{"sourceType": ["S3"],"sourceInfo":["{\"path\":\"https://s3.aws-api-domain/amzn-s3-demo- bucket/Inspec.yml_file\"}"]}' Using Chef InSpec profiles with Systems Manager Compliance 3039 AWS Systems Manager Here is an example. User Guide aws ssm send-command --document-name "AWS-RunInspecChecks" --targets '[{"Key":"tag:testEnvironment","Values":["webServers"]}]' -- parameters'{"sourceType":["S3"],"sourceInfo":["{\"path\":\"https://s3.aws-api- domain/amzn-s3-demo-bucket/InSpec/PortCheck.yml\"}"]}' 3. Run the following command to view a summary of the Compliance scan. aws ssm list-resource-compliance-summaries --filters Key=ComplianceType,Values=Custom:Inspec 4. Run the following command to see details of a node that isn't compliant. aws ssm list-compliance-items --resource-ids node_ID --resource-type ManagedInstance --filters Key=DocumentName,Values=AWS-RunInspecChecks Integrating with ServiceNow ServiceNow provides a cloud-based service management system to create and manage organization-level workflows, such as for IT services, ticketing systems, and support. The AWS Service Management Connector integrates ServiceNow with Systems Manager to provision, manage, and operate AWS resources from ServiceNow. You can use the AWS Service Management Connector to integrate ServiceNow with Automation, Change Manager, Incident Manager, and OpsCenter, all tools in AWS Systems Manager. You can perform the following tasks using ServiceNow: • Run automation playbooks from Systems Manager. • View, update, and resolve incidents from Systems Manager OpsItems. • View and manage operational items, such as incidents, through Systems Manager OpsCenter. • View and run Systems Manager change requests from a curated list of pre-approved change templates. • Manage and resolve incidents involving AWS hosted applications by integrating with Incident Manager. Integrating with ServiceNow 3040 AWS Systems Manager Note User Guide For information about how to integrate with ServiceNow, see Configuring AWS service integrations in the AWS Service Management Connector Administrator Guide. Integrating with ServiceNow 3041 AWS Systems Manager User Guide AWS Systems Manager reference The following information and topics can help you better implement AWS Systems Manager solutions. Principal In AWS Identity and Access Management (IAM), you can grant or deny a service access to resources using the Principal policy element. The Principal policy element value for Systems Manager is ssm.amazonaws.com. Supported AWS Regions and endpoints See Systems Manager service endpoints in the Amazon Web Services General Reference. Service Quotas See Systems Manager service quotas in the Amazon Web Services General Reference. API Reference See AWS Systems Manager API Reference. AWS CLI Command Reference See AWS Systems Manager section of the AWS CLI Command Reference. AWS Tools for PowerShell Cmdlet Reference See AWS Systems Manager section of the AWS Tools for PowerShell Cmdlet Reference. SSM Agent Repository on GitHub See aws/amazon-ssm-agent. Ask a Question Systems Manager issues in AWS re:Post AWS News Blog Management Tools More reference topics 3042 AWS Systems Manager User Guide • Using this service with an AWS SDK • Reference: Amazon S3 buckets for patching operations • Reference: Amazon EventBridge event patterns and types for Systems Manager • Reference: Cron and rate expressions for Systems Manager • Reference: ec2messages, ssmmessages, and other API operations • Reference: Date and time string formats for Systems Manager Using this service with an AWS SDK AWS software development kits (SDKs) are available for many popular programming languages. Each SDK provides an API, code examples, and documentation that make it easier for developers to build applications in their preferred language. SDK documentation Code examples AWS SDK for C++ AWS SDK for C++ code examples AWS CLI AWS SDK for Go AWS SDK for Java AWS CLI code examples AWS SDK for Go code examples AWS SDK for Java code examples AWS SDK for JavaScript AWS SDK for JavaScript code examples AWS SDK for Kotlin AWS SDK for Kotlin code examples AWS SDK for .NET AWS SDK for PHP AWS SDK for .NET code examples AWS SDK for PHP
systems-manager-ug-858
systems-manager-ug.pdf
858
Each SDK provides an API, code examples, and documentation that make it easier for developers to build applications in their preferred language. SDK documentation Code examples AWS SDK for C++ AWS SDK for C++ code examples AWS CLI AWS SDK for Go AWS SDK for Java AWS CLI code examples AWS SDK for Go code examples AWS SDK for Java code examples AWS SDK for JavaScript AWS SDK for JavaScript code examples AWS SDK for Kotlin AWS SDK for Kotlin code examples AWS SDK for .NET AWS SDK for PHP AWS SDK for .NET code examples AWS SDK for PHP code examples AWS Tools for PowerShell Tools for PowerShell code examples AWS SDK for Python (Boto3) AWS SDK for Python (Boto3) code examples AWS SDK for Ruby AWS SDK for Rust AWS SDK for Ruby code examples AWS SDK for Rust code examples Working with AWS SDKs 3043 AWS Systems Manager User Guide SDK documentation Code examples AWS SDK for SAP ABAP AWS SDK for SAP ABAP code examples AWS SDK for Swift AWS SDK for Swift code examples Example availability Can't find what you need? Request a code example by using the Provide feedback link at the bottom of this page. Reference: Amazon S3 buckets for patching operations In the course of performing various Patch Manager patching operations, AWS Systems Manager Agent (SSM Agent) accesses certain Amazon Simple Storage Service (Amazon S3) buckets that are owned and maintained by Amazon Web Services (AWS). These S3 buckets are publicly accessible, and by default, SSM Agent connects to them using HTTP calls. However, if you're using a virtual private cloud (VPC) endpoint in your Systems Manager operations, you must provide explicit permission in an Amazon Elastic Compute Cloud (Amazon EC2) instance profile for Systems Manager, or in a service role for non-EC2 machines in a hybrid and multicloud environment. Otherwise, your resources can't access these public buckets. This reference topic lists the patching-related buckets for each supported AWS Region. For information about specifying these S3 buckets in EC2 instance profiles, see SSM Agent communications with AWS managed S3 buckets. For information about using VPC endpoints with Systems Manager, see Improve the security of EC2 instances by using VPC endpoints for Systems Manager. Topics • Buckets containing SSM Command documents for patching operations (Linux and Windows Server) • Buckets containing SSM Command documents for patching operations (macOS) • Buckets containing AWS managed patch baseline snapshots Amazon S3 buckets for patching operations 3044 AWS Systems Manager User Guide Buckets containing SSM Command documents for patching operations (Linux and Windows Server) Buckets with the format aws-patch-manager-region-unique-suffix contain the following documents used by Patch Manager patching operations on the Linux and Windows Server operating systems: • AWS-RunPatchBaseline • AWS-RunPatchBaselineAssociation • AWS-RunPatchBaselineWithHooks • AWS-InstanceRebootWithHooks • AWS-PatchAsgInstance • AWS-PatchInstanceWithRollback Region name Region code US East (Ohio) us-east-2 US East (N. Virginia) us-east-1 US West (N. California) us-west-1 US West (Oregon) us-west-2 Africa (Cape Town) af-south-1 Asia Pacific (Hong Kong) ap-east-1 aws-patch-manager- region-suffix bucket aws-patch-manager-us-east-2 -552881074 aws-patch-manager-us-east-1 -1970c647d aws-patch-manager-us- west-1-8badb4304 aws-patch-manager-us- west-2-34d7f99f8 aws-patch-manager-af-south- 1-bdd5f65a9 aws-patch-manager-ap- east-1-632356271 Buckets containing SSM Command documents for patching operations (Linux and Windows Server) 3045 AWS Systems Manager User Guide Region name Region code Asia Pacific (Hyderabad) ap-south-2 Asia Pacific (Jakarta) ap-southeast-3 Asia Pacific (Melbourne) ap-southeast-4 Asia Pacific (Mumbai) ap-south-1 Asia Pacific (Osaka) ap-northeast-3 Asia Pacific (Seoul) ap-northeast-2 Asia Pacific (Singapore) ap-southeast-1 Asia Pacific (Sydney) ap-southeast-2 Asia Pacific (Tokyo) ap-northeast-1 Canada (Central) ca-central-1 Canada West (Calgary) ca-west-1 Europe (Frankfurt) eu-central-1 aws-patch-manager- region-suffix bucket aws-patch-manager-ap- south-2-32f4b4128 aws-patch-manager-ap- southeast-3-aa48fc462 aws-patch-manager-ap- southeast-4-01e2c40d3 aws-patch-manager-ap- south-1-cb7c62ff9 aws-patch-manager-ap- northeast-3-67373598a aws-patch-manager-ap- northeast-2-10467995c aws-patch-manager-ap- southeast-1-7fdfd9ef7 aws-patch-manager-ap- southeast-2-17283a275 aws-patch-manager-ap- northeast-1-4849fa78f aws-patch-manager-ca-centra l-1-3148e69e3 aws-patch-manager-ca- west-1-9e3a4b2f9 aws-patch-manager-eu- central-1-9163fdaaf Buckets containing SSM Command documents for patching operations (Linux and Windows Server) 3046 AWS Systems Manager User Guide Region name Region code Europe (Ireland) eu-west-1 Europe (London) eu-west-2 Europe (Milan) eu-south-1 Europe (Paris) eu-west-3 Europe (Spain) eu-south-2 Europe (Stockholm) eu-north-1 Europe (Zurich) eu-central-2 Israel (Tel Aviv) il-central-1 Middle East (Bahrain) me-south-1 Middle East (UAE) me-central-1 South America (São Paulo) sa-east-1 aws-patch-manager- region-suffix bucket aws-patch-manager-eu- west-1-5522fb710 aws-patch-manager-eu- west-2-902a2bc74 aws-patch-manager-eu- south-1-c52f3f594 aws-patch-manager-eu- west-3-29bf85721 aws-patch-manager-eu- south-2-a4cf248b1 aws-patch-manager-eu- north-1-795879e9b aws-patch-manager-eu- central-2-184ce43c8 aws-patch-manager-il-centra l-1-e221cb57b aws-patch-manager-me- south-1-a53fc9dce aws-patch-manager-me- central-1-2932f2f80 aws-patch-manager-sa-east-1 -ddf4b6a09 Buckets containing SSM Command documents for patching operations (Linux and Windows Server) 3047 AWS Systems Manager User Guide Buckets containing SSM Command documents for patching operations (macOS) Buckets with the format aws-patchmanager-macos-region-unique-suffix contain the following documents used by Patch Manager patching operations on the macOS operating system: • AWS-RunPatchBaseline • AWS-RunPatchBaselineAssociation • AWS-RunPatchBaselineWithHooks • AWS-InstanceRebootWithHooks • AWS-PatchAsgInstance • AWS-PatchInstanceWithRollback Region name Region code US East (Ohio) us-east-2 US East (N. Virginia) us-east-1 US West (N. California) us-west-1 US West (Oregon) us-west-2 Africa (Cape Town) af-south-1 Asia Pacific (Hong Kong) ap-east-1 aws-patchmanager-m acos- region-suffix bucket aws-patchmanager-macos- us-east-2-552881074 aws-patchmanager-macos- us-east-1-1970c647d aws-patchmanager-macos- us-west-1-8badb4304 aws-patchmanager-macos- us-west-2-34d7f99f8 aws-patchmanager-macos-af- south-1-bdd5f65a9 aws-patchmanager-macos- ap-east-1-632356271 Buckets containing SSM Command documents for
systems-manager-ug-859
systems-manager-ug.pdf
859
3047 AWS Systems Manager User Guide Buckets containing SSM Command documents for patching operations (macOS) Buckets with the format aws-patchmanager-macos-region-unique-suffix contain the following documents used by Patch Manager patching operations on the macOS operating system: • AWS-RunPatchBaseline • AWS-RunPatchBaselineAssociation • AWS-RunPatchBaselineWithHooks • AWS-InstanceRebootWithHooks • AWS-PatchAsgInstance • AWS-PatchInstanceWithRollback Region name Region code US East (Ohio) us-east-2 US East (N. Virginia) us-east-1 US West (N. California) us-west-1 US West (Oregon) us-west-2 Africa (Cape Town) af-south-1 Asia Pacific (Hong Kong) ap-east-1 aws-patchmanager-m acos- region-suffix bucket aws-patchmanager-macos- us-east-2-552881074 aws-patchmanager-macos- us-east-1-1970c647d aws-patchmanager-macos- us-west-1-8badb4304 aws-patchmanager-macos- us-west-2-34d7f99f8 aws-patchmanager-macos-af- south-1-bdd5f65a9 aws-patchmanager-macos- ap-east-1-632356271 Buckets containing SSM Command documents for patching operations (macOS) 3048 AWS Systems Manager User Guide Region name Region code Asia Pacific (Hyderabad) ap-south-2 Asia Pacific (Jakarta) ap-southeast-3 Asia Pacific (Melbourne) ap-southeast-4 Asia Pacific (Mumbai) ap-south-1 Asia Pacific (Osaka) ap-northeast-3 Asia Pacific (Seoul) ap-northeast-2 Asia Pacific (Singapore) ap-southeast-1 Asia Pacific (Sydney) ap-southeast-2 Asia Pacific (Tokyo) ap-northeast-1 Canada (Central) ca-central-1 Canada West (Calgary) ca-west-1 Europe (Frankfurt) eu-central-1 aws-patchmanager-m acos- region-suffix bucket aws-patchmanager-macos- ap-south-2-32f4b4128 aws-patchmanager-macos- ap-southeast-3-aa48fc462 aws-patchmanager-macos- ap-southeast-4-01e2c40d3 aws-patchmanager-macos- ap-south-1-cb7c62ff9 aws-patchmanager-macos- ap-northeast-3-67373598a aws-patchmanager-macos- ap-northeast-2-10467995c aws-patchmanager-macos- ap-southeast-1-7fdfd9ef7 aws-patchmanager-macos- ap-southeast-2-17283a275 aws-patchmanager-macos- ap-northeast-1-4849fa78f aws-patchmanager-macos-ca- central-1-3148e69e3 aws-patchmanager-macos-ca- west-1-9e3a4b2f9 aws-patchmanager-macos- eu-central-1-9163fdaaf Buckets containing SSM Command documents for patching operations (macOS) 3049 AWS Systems Manager User Guide Region name Region code Europe (Ireland) eu-west-1 Europe (London) eu-west-2 Europe (Milan) eu-south-1 Europe (Paris) eu-west-3 Europe (Spain) eu-south-2 Europe (Stockholm) eu-north-1 Europe (Zurich) eu-central-2 Israel (Tel Aviv) il-central-1 Middle East (Bahrain) me-south-1 Middle East (UAE) me-central-1 South America (São Paulo) sa-east-1 aws-patchmanager-m acos- region-suffix bucket aws-patchmanager-macos- eu-west-1-5522fb710 aws-patchmanager-macos- eu-west-2-902a2bc74 aws-patchmanager-macos- eu-south-1-c52f3f594 aws-patchmanager-macos- eu-west-3-29bf85721 aws-patchmanager-macos- eu-south-2-a4cf248b1 aws-patchmanager-macos- eu-north-1-795879e9b aws-patchmanager-macos- eu-central-2-184ce43c8 aws-patchmanager-macos-il- central-1-e221cb57b aws-patchmanager-macos- me-south-1-a53fc9dce aws-patchmanager-macos- me-central-1-2932f2f80 aws-patchmanager-macos-sa- east-1-ddf4b6a09 Buckets containing SSM Command documents for patching operations (macOS) 3050 AWS Systems Manager User Guide Buckets containing AWS managed patch baseline snapshots Buckets with the format patch-baseline-snapshot-region or patch-baseline- snapshot-region-unique-suffix contain AWS managed patch baseline snapshots. Access to this S3 bucket is required if you use any of the following SSM documents: • AWS-RunPatchBaseline • AWS-RunPatchBaselineAssociation • AWS-RunPatchBaselineWithHooks • AWS-ApplyPatchBaseline (a legacy SSM Document) Region name Region code US East (Ohio) us-east-2 US East (N. Virginia) us-east-1 US West (N. California) us-west-1 US West (Oregon) us-west-2 Africa (Cape Town) af-south-1 Asia Pacific (Hong Kong) ap-east-1 Asia Pacific (Hyderabad) ap-south-2 Asia Pacific (Jakarta) ap-southeast-3 patch-baseline-sna pshot-* bucket patch-baseline-snapshot-us- east-2 patch-baseline-snapshot-us- east-1 patch-baseline-snapshot-us- west-1 patch-baseline-snapshot-us- west-2 patch-baseline-snapshot-af- south-1-tbxdb5b9 patch-baseline-snapshot-ap- east-1 patch-baseline-snapshot-ap- south-2-50209442 patch-baseline-snapshot-ap- southeast-3-be0a3174 Buckets containing AWS managed patch baseline snapshots 3051 AWS Systems Manager User Guide Region name Region code Asia Pacific (Melbourne) ap-southeast-4 Asia Pacific (Mumbai) ap-south-1 Asia Pacific (Osaka) ap-northeast-3 Asia Pacific (Seoul) ap-northeast-2 Asia Pacific (Singapore) ap-southeast-1 Asia Pacific (Sydney) ap-southeast-2 Asia Pacific (Tokyo) ap-northeast-1 Canada (Central) ca-central-1 Canada West (Calgary) ca-west-1 Europe (Frankfurt) eu-central-1 Europe (Ireland) eu-west-1 Europe (London) eu-west-2 patch-baseline-sna pshot-* bucket patch-baseline-snapshot-ap- southeast-4-dc6f76ce patch-baseline-snapshot-ap- south-1 patch-baseline-snapshot-ap- northeast-3 patch-baseline-snapshot-ap- northeast-2 patch-baseline-snapshot-ap- southeast-1 patch-baseline-snapshot-ap- southeast-2 patch-baseline-snapshot-ap- northeast-1 patch-baseline-snapshot-ca- central-1 patch-baseline-snapshot-ca- west-1 patch-baseline-snapshot-eu- central-1 patch-baseline-snapshot-eu- west-1 patch-baseline-snapshot-eu- west-2 Buckets containing AWS managed patch baseline snapshots 3052 AWS Systems Manager User Guide Region name Region code Europe (Milan) eu-south-1 Europe (Paris) eu-west-3 Europe (Spain) eu-south-2 Europe (Stockholm) eu-north-1 Europe (Zurich) eu-central-2 Israel (Tel Aviv) il-central-1 Middle East (Bahrain) me-south-1 Middle East (UAE) me-central-1 South America (São Paulo) sa-east-1 patch-baseline-sna pshot-* bucket patch-baseline-snapshot-eu- south-1 patch-baseline-snapshot-eu- west-3 patch-baseline-snapshot-eu- south-2-df2c9d70 patch-baseline-snapshot-eu- north-1 patch-baseline-snapshot-eu- central-2 patch-baseline-snapshot-il- central-1 patch-baseline-snapshot-me- south-1-uduvl7q8 patch-baseline-snapshot-me- central-1 patch-baseline-snapshot-sa- east-1 Reference: Amazon EventBridge event patterns and types for Systems Manager Note Amazon EventBridge is the preferred way to manage your events. CloudWatch Events and EventBridge are the same underlying service and API, but EventBridge provides EventBridge event patterns and types for Systems Manager 3053 AWS Systems Manager User Guide more features. Changes you make in either CloudWatch or EventBridge are reflected in each console. For more information, see the Amazon EventBridge User Guide. Using Amazon EventBridge, you can create rules that match incoming events and route them to targets for processing. An event indicates a change in an environment in your own applications, software as a service (SaaS) applications, or an AWS service. Events are produced on a best effort basis. After an event type that is specified in a rule is detected, EventBridge routes it to a specified target for processing. Targets can include Amazon Elastic Compute Cloud (Amazon EC2) instances, AWS Lambda functions, Amazon Kinesis streams, Amazon Elastic Container Service (Amazon ECS) tasks, AWS Step Functions state machines, Amazon Simple Notification Service (Amazon SNS) topics, Amazon Simple Queue Service (Amazon SQS) queues, built-in targets and many more. For information about creating EventBridge rules, see the following topics: • Monitoring Systems Manager events with Amazon EventBridge • Amazon EventBridge event examples for Systems Manager • Getting started with Amazon EventBridge in the Amazon EventBridge User Guide The remainder of this topic describes the types of Systems Manager events that you can include in your EventBridge rules. Event type: Automation
systems-manager-ug-860
systems-manager-ug.pdf
860
EC2) instances, AWS Lambda functions, Amazon Kinesis streams, Amazon Elastic Container Service (Amazon ECS) tasks, AWS Step Functions state machines, Amazon Simple Notification Service (Amazon SNS) topics, Amazon Simple Queue Service (Amazon SQS) queues, built-in targets and many more. For information about creating EventBridge rules, see the following topics: • Monitoring Systems Manager events with Amazon EventBridge • Amazon EventBridge event examples for Systems Manager • Getting started with Amazon EventBridge in the Amazon EventBridge User Guide The remainder of this topic describes the types of Systems Manager events that you can include in your EventBridge rules. Event type: Automation Event type name Description of events you can add to a rule EC2 Automation Execution Status-change Notification The overall status of an Automation workflow changes. You can add one or more of the following status changes to an event rule: • Approved • Canceled • Failed • PendingApproval Event type: Automation 3054 AWS Systems Manager User Guide Event type name Description of events you can add to a rule • PendingChangeCalendarOverride • Rejected • Scheduled • Success • TimedOut EC2 Automation Step Status-change Notificat ion The status of a specific step in an Automatio n workflow changes. You can add one or more of the following status changes to an event rule: • Canceled • Failed • Success • TimedOut Event type: Change Calendar Event type name Description of events you can add to a rule Calendar State Change The state of a Change Calendar changes. You can add one or both of the following state changes to an event rule: • OPEN • CLOSED State changes for calendars shared from other AWS accounts aren't supported. Event type: Change Calendar 3055 AWS Systems Manager User Guide Event type: Change Manager Event type name Description of events you can add to a rule Change Request Status Update The state of a Change Manager change request. You can use the following states in an event rule: • Approved • Rejected • InProgress Event type: Configuration Compliance Event type name Description of events you can add to a rule Configuration Compliance State Change The state of a managed node changes, for either association compliance or patch compliance. You can add one or more of the following state changes to an event rule: • compliant • non_compliant Event type: Inventory Event type name Description of events you can add to a rule Inventory Resource State Change The deletion of custom inventory and a PutInventory call that uses an old schema version. You can add one or more of the following state changes to an event rule: Event type: Change Manager 3056 AWS Systems Manager User Guide Event type name Description of events you can add to a rule • Custom inventory type deleted event on a specific node. EventBridge sends one event per node per custom InventoryType. • Custom inventory type deleted event for all nodes. • PutInventory call with old schema version event. EventBridge sends this event when the schema version is less than the current schema. This event applies to all inventory types. For more information, see Using EventBridge to monitor Inventory events. Event type: Maintenance Window Event type name Description of events you can add to a rule Maintenance Window Status-change Notificat ion The overall status of one or more maintenance windows changes. You can add one or more of the following state changes to an event rule: Maintenance Window Target Registration Notification • DISABLED • ENABLED The status of one or more maintenance window targets changes. You can add one or more of the following state changes to an event rule: • DEREGISTERED • REGISTERED • UPDATED Event type: Maintenance Window 3057 AWS Systems Manager User Guide Event type name Description of events you can add to a rule Maintenance Window Execution State-change Notification The overall status of a maintenance window changes while it's running. You can add one or more of the following state changes to an event rule: • CANCELLED • CANCELLING • FAILED • IN_PROGRESS • PENDING • SKIPPED_OVERLAPPING • SUCCESS • TIMED_OUT Maintenance Window Task Execution State- change Notification The state of a task in a maintenance window changes while it's running. You can add one or more of the following state changes to an event rule: • CANCELLED • CANCELLING • FAILED • IN_PROGRESS • SUCCESS • TIMED_OUT Event type: Maintenance Window 3058 AWS Systems Manager User Guide Event type name Description of events you can add to a rule Maintenance Window Task Target Invocation State-change Notification The state of a maintenance window task on a specific target changes. This notification is fully supported only for Run Command tasks. For this type of task, you can add one or more of the following state changes to an event rule: • CANCELLED • CANCELLING • FAILED
systems-manager-ug-861
systems-manager-ug.pdf
861
or more of the following state changes to an event rule: • CANCELLED • CANCELLING • FAILED • IN_PROGRESS • SUCCESS • TIMED_OUT Event type: Maintenance Window 3058 AWS Systems Manager User Guide Event type name Description of events you can add to a rule Maintenance Window Task Target Invocation State-change Notification The state of a maintenance window task on a specific target changes. This notification is fully supported only for Run Command tasks. For this type of task, you can add one or more of the following state changes to an event rule: • CANCELLED • CANCELLING • FAILED • IN_PROGRESS • SUCCESS • TIMED_OUT For Automation, AWS Lambda, and AWS Step Functions tasks, EventBridge reports only the states IN_PROGRESS and COMPLETE. COMPLETE is reported whether the task is successful or not. Maintenance Window Task Registration Notification The state of one or more maintenance window tasks changes. You can add one or more of the following state changes to an event rule: • DEREGISTERED • REGISTERED • UPDATED Event type: Maintenance Window 3059 AWS Systems Manager Event type: OpsCenter Event type name OpsItem Create User Guide Description of events you can add to a rule Occurs when an OpsItem is created. You can add rules for one of the following OpsItem types: • /aws/issue • /aws/task • /aws/insight • /aws/actionitem OpsItem Update Occurs when an OpsItem is updated. You can add rules for one of the following OpsItem types: • /aws/issue • /aws/task • /aws/insight • /aws/actionitem Event type: Parameter Store Event type name Description of events you can add to a rule Parameter Store Change The state of a parameter changes. You can add one or more of the following state changes to an event rule: • Create • Update • Delete • LabelParameterVersion Event type: OpsCenter 3060 AWS Systems Manager User Guide Event type name Description of events you can add to a rule Parameter Store Policy Action For more information, see Configuring EventBridge rules for parameters and parameter policies. A condition of an advanced parameter policy change is met. You can add one or more of the following status changes to an event rule: • Expiration • ExpirationNotification • NoChangeNotification For more information, see Configuring EventBridge rules for parameters and parameter policies. Event type: Run Command Event type name Description of events you can add to a rule EC2 Command Invocation Status-change Notification The status of a command sent to an individua l managed instance changes. You can add one or more of the following status changes to an event rule: • Success • InProgress • TimedOut • Canceled • Failed EC2 Command Status-change Notification The overall status of a command changes. You can add one or more of the following status changes to an event rule: Event type: Run Command 3061 AWS Systems Manager User Guide Event type name Description of events you can add to a rule • Success • InProgress • TimedOut • Canceled • Failed Event type: State Manager Event type name Description of events you can add to a rule EC2 State Manager Association State Change The overall state of an Association changes as it's being applied. You can add one or more of the following state changes to an event rule: • Failed • Pending • Success EC2 State Manager Instance Association State Change The state of a single managed instance that is targeted by an Association changes. You can add one or more of the following state changes to an event rule: • Failed • Pending • Success Reference: Cron and rate expressions for Systems Manager When you create a State Manager association or a maintenance window in AWS Systems Manager, you specify a schedule for when the window or the association should run. You can specify a schedule as either a time-based entry, called a cron expression, or a frequency-based entry, called a rate expression. Event type: State Manager 3062 AWS Systems Manager User Guide General information about cron and rate expressions The following information applies to cron and rate expressions for both maintenance windows and associations. Single-run schedules When you create an association or a maintenance window, you can specify a timestamp in Coordinated Universal Time (UTC) format so that it runs once at the specified time. For example: "at(2020-07-07T15:55:00)" Schedule offsets Associations and maintenance windows support schedule offsets for cron expressions only. A schedule offset is the number of days to wait after the date and time specified by a cron expression before running the association or maintenance window. Maintenance window example In the following command, the cron expression schedules a maintenance window to run the third Tuesday of every month at 11:30 PM. However, because the schedule offset is 2, the maintenance window won't run until 11:30 PM two days later. aws ssm create-maintenance-window \
systems-manager-ug-862
systems-manager-ug.pdf
862
format so that it runs once at the specified time. For example: "at(2020-07-07T15:55:00)" Schedule offsets Associations and maintenance windows support schedule offsets for cron expressions only. A schedule offset is the number of days to wait after the date and time specified by a cron expression before running the association or maintenance window. Maintenance window example In the following command, the cron expression schedules a maintenance window to run the third Tuesday of every month at 11:30 PM. However, because the schedule offset is 2, the maintenance window won't run until 11:30 PM two days later. aws ssm create-maintenance-window \ --name "My-Cron-Offset-Maintenance-Window" \ --allow-unassociated-targets \ --schedule "cron(30 23 ? * TUE#3 *)" \ --duration 4 \ --cutoff 1 \ --schedule-offset 2 Association example In the following command, the cron expression schedules an association to run the second Thursday of each month. However, because the schedule offset is 3, the assocation won't run until the next Sunday, three days later. aws ssm create-association \ --name "AWS-UpdateSSMAgent" \ --targets "Key=instanceids,Values=i-0cb2b964d3e14fd9f" \ --schedule-expression "cron(0 0 ? * THU#2 *)" \ --schedule-offset 3 General information about cron and rate expressions 3063 AWS Systems Manager User Guide --apply-only-at-cron-interval Note To use an offset with an assocation, you must specify the --apply-only-at- cron-interval option. This option tells the system not to run an association immediately after you create it. If you create an association or a maintenance window with a cron expression that targets a day that has already passed in the current period, but add a schedule offset date that falls in the future, the association or maintenance window won't run in the period. It will go into effect in the following period. For example, if you specify a cron expression that would have run a maintenance window yesterday and add a schedule offset of two days, the maintenance window won't run tomorrow. Required fields Cron expressions for maintenance windows have six required fields. Cron expressions for associations have five. (State Manager doesn't currently support specifying months in cron expressions for associations.) An additional field, the Seconds field (the first in a cron expression), is optional. Fields are separated by a space. Cron expression examples Minutes Hours 0 10 15 12 0 18 Day of month Month Day of week Year Meaning * * ? * * * ? ? * * MON-FRI * Run at 10:00 am (UTC) every day Run at 12:15 PM (UTC) every day Run at 6:00 PM General information about cron and rate expressions 3064 AWS Systems Manager User Guide Minutes Hours Day of month Month Day of week Year Meaning (UTC) every Monday through Friday Run at 8:00 AM (UTC) every 1st day of the month 0 8 1 * ? * Supported values The following table shows supported values for required cron entries. Supported values for cron expressions Field Minutes Hours Day-of-month Month (maintenance windows only) Values 0-59 0-23 1-31 Wildcards , - * / , - * / , - * ? / L W 1-12 or JAN-DEC , - * / Day-of-week 1-7 or SUN-SAT , - * ? / L # Year 1970-2199 , - * / General information about cron and rate expressions 3065 AWS Systems Manager Note User Guide You can't specify a value in the day-of-month and in the day-of-week fields in the same cron expression. If you specify a value in one of the fields, use a ? (question mark) in the other field. Wildcards for cron expressions The following table shows the wildcard values that cron expressions support. Note Cron expressions that lead to rates faster than five (5) minute aren't supported. Support for specifying both a day-of-week and a day-of-month value isn't complete. Use the question mark (?) character in one of these fields. Supported wildcards for cron expressions Wildcard Description , - * / The , (comma) wildcard includes additiona l values. In the Month field, JAN,FEB,MAR would include January, February, and March. The - (dash) wildcard specifies ranges. In the Day field, 1-15 would include days 1 through 15 of the specified month. The * (asterisk) wildcard includes all values in the field. In the Hours field, * would include every hour. The / (forward slash) wildcard specifies increments. In the Minutes field, you could enter 1/10 to specify every tenth minute, starting from the first minute of the hour. So General information about cron and rate expressions 3066 AWS Systems Manager Wildcard ? L W # User Guide Description 1/10 specifies the first, 11th, 21st, and 31st minute, and so on. The ? (question mark) wildcard specifies one or another. In the Day-of-month field you could enter 7 and if you didn't care what day of the week the 7th was, you could enter ? in the Day-of-week field. The L wildcard in the Day-of-month or
systems-manager-ug-863
systems-manager-ug.pdf
863
specifies increments. In the Minutes field, you could enter 1/10 to specify every tenth minute, starting from the first minute of the hour. So General information about cron and rate expressions 3066 AWS Systems Manager Wildcard ? L W # User Guide Description 1/10 specifies the first, 11th, 21st, and 31st minute, and so on. The ? (question mark) wildcard specifies one or another. In the Day-of-month field you could enter 7 and if you didn't care what day of the week the 7th was, you could enter ? in the Day-of-week field. The L wildcard in the Day-of-month or Day- of-week fields specifies the last day of the month or week. The W wildcard in the Day-of-month field specifies a weekday. In the Day-of-month field, 3W specifies the day closest to the third weekday of the month. The # wildcard in the day-of-week field followed by a number between one and five specifies a given day of the month. 5#3 specifies the 3rd Thursday of the month. Rate expressions Rate expressions have the following two required fields. Fields are separated by spaces. Required fields for rate expressions Field Value Unit Values positive number, such as 1 or 15 minute minutes hour General information about cron and rate expressions 3067 AWS Systems Manager Field User Guide Values hours day days If the value is equal to 1, then the unit must be singular. Similarly, for values greater than 1, the unit must be plural. For example, rate(1 hours) and rate(5 hour) aren't valid, but rate(1 hour) and rate(5 hours) are valid. Topics • Cron and rate expressions for associations • Cron and rate expressions for maintenance windows Cron and rate expressions for associations This section includes examples of cron and rate expressions for State Manager associations. Before you create one of these expressions, be aware of the following information: • Associations support the following cron expressions: Every 1/2, 1, 2, 4, 8, or 12 hours; every day, every week, or every specified day and time of the week; a specific day in a specific week of the month, or the last x day of the month at a specific time. • Associations support the following rate expressions: intervals of 30 minutes or greater and less than 31 days. • If you specify the optional Seconds field, its value can be 0 (zero). For example: cron(0 */30 * * * ? *) • For an association that collects metadata for Inventory, a tool in AWS Systems Manager, we recommend using a rate expression. • State Manager doesn't currently support specifying months in cron expressions for associations. Associations support cron expressions that include a day of the week and the number sign (#) to designate the nth day of a month to run an association. Here is an example that runs a cron schedule on the third Tuesday of every month at 23:30 UTC: Cron and rate expressions for associations 3068 AWS Systems Manager cron(30 23 ? * TUE#3 *) User Guide Here is an example that runs on the second Thursday of every month at midnight UTC: cron(0 0 ? * THU#2 *) Associations also support the (L) sign to indicate the last X day of the month. Here is an example that runs a cron schedule on the last Tuesday of every month at midnight UTC: cron(0 0 ? * 3L *) To further control when an association runs, for example if you want to run an association two days after patch Tuesday, you can specify an offset. An offset defines how many days to wait after the scheduled day to run an association. For example, if you specified a cron schedule of cron(0 0 ? * THU#2 *), you could specify the number 3 in the Schedule offset field to run the association each Sunday after the second Thursday of the month. To use offsets, you must either choose the Apply association only at the next specified Cron interval option in the console or you must specify the use --apply-only-at-cron-interval parameter from the command line. This option tells State Manager not to run an association immediately after you create it. The following table presents cron examples for associations. Cron examples for associations Example Details cron(0/30 * * * ? *) Every 30 minutes cron(0 0/1 * * ? *) cron(0 0/2 * * ? *) cron(0 0/4 * * ? *) cron(0 0/8 * * ? *) cron(0 0/12 * * ? *) cron(15 13 ? * * *) Every hour Every 2 hours Every 4 hours Every 8 hours Every 12 hours Every day at 1:15 PM Cron and rate expressions for associations 3069 AWS Systems Manager Example Details User Guide cron(15 13 ? * MON *) Every Monday at 1:15 PM cron(30 23 ? * TUE#3 *)
systems-manager-ug-864
systems-manager-ug.pdf
864
examples for associations Example Details cron(0/30 * * * ? *) Every 30 minutes cron(0 0/1 * * ? *) cron(0 0/2 * * ? *) cron(0 0/4 * * ? *) cron(0 0/8 * * ? *) cron(0 0/12 * * ? *) cron(15 13 ? * * *) Every hour Every 2 hours Every 4 hours Every 8 hours Every 12 hours Every day at 1:15 PM Cron and rate expressions for associations 3069 AWS Systems Manager Example Details User Guide cron(15 13 ? * MON *) Every Monday at 1:15 PM cron(30 23 ? * TUE#3 *) The third Tuesday of every month at 11:30 PM Here are some rate examples for associations. Rate examples for associations Example Details rate(30 minutes) Every 30 minutes rate(1 hour) rate(5 hours) rate(15 days) Every hour Every 5 hours Every 15 days AWS CLI examples for associations To create State Manager associations using the AWS CLI, you include the --schedule- expression parameter with a cron or rate expression. The following examples use the AWS CLI on a local Linux machine. Note By default, when you create a new association, the system runs it immediately after it's created and then according to the schedule you specified. Specify --apply-only-at- cron-interval so that the association doesn't run immediately after you create it. This parameter isn't supported for rate expressions. aws ssm create-association \ --association-name "My-Cron-Association" \ --schedule-expression "cron(0 2 ? * SUN *)" \ --targets Key=tag:ServerRole,Values=WebServer \ Cron and rate expressions for associations 3070 AWS Systems Manager --name AWS-UpdateSSMAgent User Guide aws ssm create-association \ --association-name "My-Rate-Association" \ --schedule-expression "rate(7 days)" \ --targets Key=tag:ServerRole,Values=WebServer \ --name AWS-UpdateSSMAgent aws ssm create-association \ --association-name "My-Rate-Association" \ --schedule-expression "at(2020-07-07T15:55:00)" \ --targets Key=tag:ServerRole,Values=WebServer \ --name AWS-UpdateSSMAgent \ --apply-only-at-cron-interval Cron and rate expressions for maintenance windows This section includes examples of cron and rate expressions for maintenance windows. Unlike State Manager associations, maintenance windows support all cron and rate expressions. This includes support for values in the seconds field. For example, the following 6-field cron expression runs a maintenance window at 9:30 AM every day. cron(30 09 ? * * *) By adding a value to the Seconds field, the following 7-field cron expression runs a maintenance window at 9:30:24 AM every day. cron(24 30 09 ? * * *) The following table provides additional 6-field cron examples for maintenance windows. Cron examples for maintenance windows Example Details cron(0 2 ? * THU#3 *) 02:00 AM the third Thursday of every month Cron and rate expressions for maintenance windows 3071 AWS Systems Manager Example Details User Guide cron(15 10 ? * * *) 10:15 AM every day cron(15 10 ? * MON-FRI *) 10:15 AM every Monday, Tuesday, Wednesday, Thursday and Friday cron(0 2 L * ? *) 02:00 AM on the last day of every month cron(15 10 ? * 6L *) 10:15 AM on the last Friday of every month The following table provides rate examples for maintenance windows. Rate examples for maintenance windows Example Details rate(30 minutes) Every 30 minutes rate(1 hour) rate(5 hours) rate(25 days) Every hour Every 5 hours Every 25 days AWS CLI examples for maintenance windows To create maintenance windows using the AWS CLI, you include the --schedule parameter with a cron or rate expression or a timestamp. The following examples use the AWS CLI on a local Linux machine. aws ssm create-maintenance-window \ --name "My-Cron-Maintenance-Window" \ --allow-unassociated-targets \ --schedule "cron(0 16 ? * TUE *)" \ --schedule-timezone "America/Los_Angeles" \ --start-date 2021-01-01T00:00:00-08:00 \ --end-date 2021-06-30T00:00:00-08:00 \ --duration 4 \ --cutoff 1 Cron and rate expressions for maintenance windows 3072 AWS Systems Manager User Guide aws ssm create-maintenance-window \ --name "My-Rate-Maintenance-Window" \ --allow-unassociated-targets \ --schedule "rate(7 days)" \ --duration 4 \ --schedule-timezone "America/Los_Angeles" \ --cutoff 1 aws ssm create-maintenance-window \ --name "My-TimeStamp-Maintenance-Window" \ --allow-unassociated-targets \ --schedule "at(2021-07-07T13:15:30)" \ --duration 4 \ --schedule-timezone "America/Los_Angeles" \ --cutoff 1 More info CRON expression at the Wikipedia website Reference: ec2messages, ssmmessages, and other API operations If you monitor API operations, you might see calls to the following operations: • ec2messages:AcknowledgeMessage • ec2messages:DeleteMessage • ec2messages:FailMessage • ec2messages:GetEndpoint • ec2messages:GetMessages • ec2messages:SendReply • ssmmessages:CreateControlChannel • ssmmessages:CreateDataChannel • ssmmessages:OpenControlChannel • ssmmessages:OpenDataChannel ec2messages, ssmmessages, and other API operations 3073 AWS Systems Manager User Guide • ssm:DescribeDocumentParameters • ssm:DescribeInstanceProperties • ssm:GetCalendar • ssm:GetManifest • ssm:ListInstanceAssociations • ssm:PutCalendar • ssm:PutConfigurePackageResult • ssm:RegisterManagedInstance • ssm:RequestManagedInstanceRoleToken • ssm:UpdateInstanceAssociationStatus • ssm:UpdateInstanceInformation • ssm:UpdateManagedInstancePublicKey These are special operations used by AWS Systems Manager, as described in the rest of this topic. Agent-related API operations (ssmmessages and ec2messages endpoints) ssmmessages API operations Systems Manager uses the ssmmessages endpoint for the following types of API operations: • Operations from Systems Manager Agent (SSM Agent) to the Systems Manager service in the cloud. • Operations from SSM Agent to Session Manager, a tool in AWS Systems Manager, in the cloud.
systems-manager-ug-865
systems-manager-ug.pdf
865
Manager User Guide • ssm:DescribeDocumentParameters • ssm:DescribeInstanceProperties • ssm:GetCalendar • ssm:GetManifest • ssm:ListInstanceAssociations • ssm:PutCalendar • ssm:PutConfigurePackageResult • ssm:RegisterManagedInstance • ssm:RequestManagedInstanceRoleToken • ssm:UpdateInstanceAssociationStatus • ssm:UpdateInstanceInformation • ssm:UpdateManagedInstancePublicKey These are special operations used by AWS Systems Manager, as described in the rest of this topic. Agent-related API operations (ssmmessages and ec2messages endpoints) ssmmessages API operations Systems Manager uses the ssmmessages endpoint for the following types of API operations: • Operations from Systems Manager Agent (SSM Agent) to the Systems Manager service in the cloud. • Operations from SSM Agent to Session Manager, a tool in AWS Systems Manager, in the cloud. This endpoint is required to create and delete session channels with the Session Manager service in the cloud. Additionally, if connectivity is allowed, SSM Agent receives Command documents through this Amazon Message Gateway Service. If connectivity is not allowed, SSM Agent receives Command documents through the Amazon Message Delivery Service. For more information, see Actions, resources, and condition keys for Amazon Message Gateway Service. • Operations from Run Command. ec2messages API operations Agent-related API operations (ssmmessages and ec2messages endpoints) 3074 AWS Systems Manager User Guide ec2messages:* API operations are made to the Amazon Message Delivery Service endpoint. Systems Manager uses this endpoint for API operations from Systems Manager Agent (SSM Agent) to the Systems Manager service in the cloud. Important ec2messages:* API operations are supported only in AWS Regions that launched before 2024. In Regions launched in 2024 and later, only ssmmessages:* API operations are supported. Endpoint connection precedence Beginning with version 3.3.40.0 of SSM Agent, Systems Manager began using the ssmmessages:* endpoint (Amazon Message Gateway Service) whenever available instead of the ec2messages:* endpoint (Amazon Message Delivery Service). If you provide access to ssmmessages:* in your AWS Identity and Access Management (IAM) permission policies, SSM Agent connects to the ssmmessages:* endpoint, even if your IAM instance profile is configured to allow both endpoints. This includes policies for IAM instance profiles and IAM service roles you have created yourself, and for IAM instance profiles created by the Quick Setup Host management configuration and Default Host Management Configuration. If you have provided permissions for both endpoints and monitor API operations using, for example, CloudWatch Metrics, you will see no calls to ec2messages:*. For AWS Regions launched before 2024: You can safely remove ec2messages:* permissions from your policies at this time. Endpoint connection failover For AWS Regions launched before 2024 only: If your IAM instance profile does not provide permissions for ssmmessages:* at the time the agent starts, but only ec2messages:*, SSM Agent connects to the ec2messages:* endpoint. If you have both ssmmessages:* and ec2messages:* at the time SSM Agent starts, but remove ssmmessages:* after the agent starts, SSM Agent soon switches the connection to the ec2messages:* endpoint. For Regions launched in 2024 and later, only the ssmmessages:* endpoint is supported. For more information about the ssmmessages and ec2messages:* endpoints, see the following topics in the AWS Service Authorization Reference. Agent-related API operations (ssmmessages and ec2messages endpoints) 3075 AWS Systems Manager User Guide • Actions, resources, and condition keys for Amazon Message Gateway Service (ssmmessages). • Actions, resources, and condition keys for Amazon Message Delivery Service (ec2messages:*) ssm:* namespace instance-related API operations DescribeDocumentParameters Systems Manager runs this API operation to render specific nodes in the Amazon EC2 console. Results of the DescribeDocumentParameters operation are displayed in the Documents node. DescribeInstanceProperties Systems Manager runs this API operations to render specific nodes in the Amazon EC2 console. Results of the DescribeInstanceProperties operation are displayed in the Fleet Manager node. GetCalendar Systems Manager runs this API operation to render Change Calendar type documents in the Change Calendar console. GetManifest SSM Agent runs this API operation to determine system requirements for installing or updating a specified version of an AWS Systems Manager Distributor package. This is a legacy API operation and not available in AWS Regions launched after 2017. ListInstanceAssociations SSM Agent runs this API operation to see if a new State Manager association is available. This API operation is required for State Manager to function. PutCalendar Systems Manager runs this API operation to update Change Calendar type documents in the Change Calendar console. PutConfigurePackageResult SSM Agent runs this API operation to publish installation error and latency metrics for public Distributor packages to the package owner’s account. ssm:* namespace instance-related API operations 3076 AWS Systems Manager RegisterManagedInstance User Guide SSM Agent runs this API operation for the following scenarios: • To register an on-premises server or virtual machine (VM) with Systems Manager as a managed instance using an activation code and ID. • To register AWS IoT Greengrass Version 2 credentials. This operation is also called by Amazon EC2 instances running SSM Agent version 3.1.x or later. RequestManagedInstanceRoleToken SSM Agent runs this API operation to retrieve temporary credentials to access the managed node. UpdateInstanceAssociationStatus SSM Agent runs
systems-manager-ug-866
systems-manager-ug.pdf
866
metrics for public Distributor packages to the package owner’s account. ssm:* namespace instance-related API operations 3076 AWS Systems Manager RegisterManagedInstance User Guide SSM Agent runs this API operation for the following scenarios: • To register an on-premises server or virtual machine (VM) with Systems Manager as a managed instance using an activation code and ID. • To register AWS IoT Greengrass Version 2 credentials. This operation is also called by Amazon EC2 instances running SSM Agent version 3.1.x or later. RequestManagedInstanceRoleToken SSM Agent runs this API operation to retrieve temporary credentials to access the managed node. UpdateInstanceAssociationStatus SSM Agent runs this API operation to update an association. This API operation is required for State Manager, a tool in AWS Systems Manager, to function. UpdateInstanceInformation SSM Agent calls the Systems Manager service in the cloud every 5 minutes to provide heartbeat information. This call is necessary to maintain a heartbeat with the agent so that the service knows the agent is functioning as expected. UpdateManagedInstancePublicKey SSM Agent runs this API operation to provide the public key after rotating the key pair on the managed node. The public key is used to authenticate the requests, signed with the private key, to get temporary credentials from Systems Manager. ssm:* namespace other API operations ExecuteApi Systems Manager delegated administrators who manage OpsItems in OpsCenter require access to this API action so they can view related resource details about OpsItems across multiple AWS accounts. Specifically, this API gives a delegated administrator permission to view the following OpsItem details in the AWS Management Console: the OpsItem description, tags, AWS CloudFormation template, AWS Config changes, CloudWatch Logs alarms, and AWS CloudTrail events. For more information about working with OpsItems across accounts, see (Optional) Manually set up OpsCenter to centrally manage OpsItems across accounts. For more ssm:* namespace other API operations 3077 AWS Systems Manager User Guide information about related resource details for OpsItems, see Adding related resources to an OpsItem. Reference: Date and time string formats for Systems Manager AWS Systems Manager API operations accept filters to limit the number of results returned by a request. Some of these API operations accept filters that require a formatted string to represent a specific date and time. For example, the DescribeSessions API operation accepts the InvokedAfter and InvokedBefore keys as some valid values for a SessionFilter object. Another example is the DescribeAutomationExecutions API operation, which accepts the StartTimeBefore and StartTimeAfter keys as some valid values for an AutomationExecutionFilter object. The values you provide for these keys when filtering your requests must match the ISO 8601 standard. For information about ISO 8601, see ISO 8601. These formatted date and time strings aren't limited to filters. There are also API operations that require an ISO 8601 formatted string to represent a specific date and time when providing a value for a request parameter. For example, the AtTime request parameter for the GetCalendarState operation. These strings are difficult to create. Use the examples in this topic to create formatted date and time strings to use with Systems Manager API operations. Formatting date and time strings for Systems Manager The following is an example of an ISO 8601 formatted date and time string. 2024-05-08T15:16:43Z This represents May 8, 2024 at 15:16 Coordinated Universal Time (UTC). The calendar date portion of the string is represented by a four-digit year, two-digit month, and two-digit day separated by hyphens. This can be represented in the following format. YYYY-MM-DD The time portion of the string begins with the letter "T" as a delimiter, and then is represented by a two-digit hour, two-digit minute, and two-digit second separated by colons. This can be represented in the following format. hh:mm:ss Date and time string formats for Systems Manager 3078 AWS Systems Manager User Guide The time portion of the string ends with the letter "Z", denoting the UTC standard. Creating custom date and time strings for Systems Manager You can create custom date and time strings from your local machine using your preferred command line tool. The syntax you use to create an ISO 8601 formatted date and time string differs depending on your local machine's operating system. The following are examples of how you can use date from GNU's coreutils on Linux, or PowerShell on Windows to create an ISO 8601 formatted date and time string. coreutils date '+%Y-%m-%dT%H:%M:%SZ' PowerShell (Get-Date).ToString("yyyy-MM-ddTH:mm:ssZ") When working with Systems Manager API operations, you might need to create historical date and time strings for reporting or troubleshooting purposes. The following are examples of how you can create and use custom historical ISO 8601 formatted date and time strings for the AWS Tools for PowerShell and AWS Command Line Interface (AWS CLI). AWS CLI • Retrieve the last week of command history for an SSM document. lastWeekStamp=$(date '+%Y-%m-%dT%H:%M:%SZ' -d '7 days ago') docFilter='{"key":"DocumentName","value":"AWS-RunPatchBaseline"}' timeFilter='{"key":"InvokedAfter","value":'\"$lastWeekStamp\"'}'
systems-manager-ug-867
systems-manager-ug.pdf
867
GNU's coreutils on Linux, or PowerShell on Windows to create an ISO 8601 formatted date and time string. coreutils date '+%Y-%m-%dT%H:%M:%SZ' PowerShell (Get-Date).ToString("yyyy-MM-ddTH:mm:ssZ") When working with Systems Manager API operations, you might need to create historical date and time strings for reporting or troubleshooting purposes. The following are examples of how you can create and use custom historical ISO 8601 formatted date and time strings for the AWS Tools for PowerShell and AWS Command Line Interface (AWS CLI). AWS CLI • Retrieve the last week of command history for an SSM document. lastWeekStamp=$(date '+%Y-%m-%dT%H:%M:%SZ' -d '7 days ago') docFilter='{"key":"DocumentName","value":"AWS-RunPatchBaseline"}' timeFilter='{"key":"InvokedAfter","value":'\"$lastWeekStamp\"'}' commandFilters=[$docFilter,$timeFilter] aws ssm list-commands \ --filters $commandFilters • Retrieve the last week of automation execution history. lastWeekStamp=$(date '+%Y-%m-%dT%H:%M:%SZ' -d '7 days ago') Creating custom date and time strings for Systems Manager 3079 AWS Systems Manager User Guide aws ssm describe-automation-executions \ --filters Key=StartTimeAfter,Values=$lastWeekStamp • Retrieve the last month of session history. lastWeekStamp=$(date '+%Y-%m-%dT%H:%M:%SZ' -d '30 days ago') aws ssm describe-sessions \ --state History \ --filters key=InvokedAfter,value=$lastWeekStamp AWS Tools for PowerShell • Retrieve the last week of command history for an SSM document. $lastWeekStamp = (Get-Date).AddDays(-7).ToString("yyyy-MM-ddTH:mm:ssZ") $docFilter = @{ Key="DocumentName" Value="AWS-InstallWindowsUpdates" } $timeFilter = @{ Key="InvokedAfter" Value=$lastWeekStamp } $commandFilters = $docFilter,$timeFilter Get-SSMCommand ` -Filters $commandFilters • Retrieve the last week of automation execution history. $lastWeekStamp = (Get-Date).AddDays(-7).ToString("yyyy-MM-ddTH:mm:ssZ") Get-SSMAutomationExecutionList ` -Filters @{Key="StartTimeAfter";Values=$lastWeekStamp} • Retrieve the last month of session history. $lastWeekStamp = (Get-Date).AddDays(-30).ToString("yyyy-MM-ddTH:mm:ssZ") Creating custom date and time strings for Systems Manager 3080 AWS Systems Manager User Guide Get-SSMSession ` -State History ` -Filters @{Key="InvokedAfter";Value=$lastWeekStamp} Creating custom date and time strings for Systems Manager 3081 AWS Systems Manager User Guide Use cases and best practices This topic lists common use cases and best practices for AWS Systems Manager tools. If available, this topic also includes links to relevant blog posts and technical documentation. Note The title of each section here is an active link to the corresponding section in the technical documentation. Automation • Create self-service Automation runbooks for infrastructure. • Use Automation, a tool in AWS Systems Manager, to simplify creating Amazon Machine Images (AMIs) from the AWS Marketplace or custom AMIs, using public Systems Manager documents (SSM documents) or by authoring your own workflows. • Build and maintain AMIs using the AWS-UpdateLinuxAmi and AWS-UpdateWindowsAmi Automation runbooks, or using custom Automation runbooks that you create. Compliance • As a security best practice, we recommend that you update the AWS Identity and Access Management (IAM) role used by your managed nodes to restrict the node's ability to use the PutComplianceItems API action. This API action registers a compliance type and other compliance details on a designated resource, such as an Amazon EC2 instance or a managed node. For more information, see Configuring permissions for Compliance. Inventory • Use Inventory, a tool in AWS Systems Manager, with AWS Config to audit your application configurations over time. 3082 AWS Systems Manager Maintenance Windows User Guide • Define a schedule to perform potentially disruptive actions on your nodes such as operating system (OS) patching, driver updates, or software installations. • For information about the differences between State Manager and Maintenance Windows, tools of AWS Systems Manager, see Choosing between State Manager and Maintenance Windows. Parameter Store • Use Parameter Store, a tool in AWS Systems Manager, to centrally manage global configuration settings. • How AWS Systems Manager Parameter Store uses AWS KMS. • Reference AWS Secrets Manager secrets from Parameter Store parameters. Patch Manager • Use Patch Manager, a tool in AWS Systems Manager, to roll out patches at scale and increase fleet compliance visibility across your nodes. • Integrate Patch Manager with AWS Security Hub to receive alerts when nodes in your fleet go out of compliance and monitor the patching status of your fleets from a security point of view. There is a charge to use Security Hub. For more information, see Pricing. • Use only one method at a time for scanning managed nodes for patch compliance to avoid unintentionally overwriting compliance data. Run Command • Manage Instances at Scale without SSH Access Using EC2 Run Command. • Audit all API calls made by or on behalf of Run Command, a tool in AWS Systems Manager, using AWS CloudTrail. • When you send a command using Run Command, don't include sensitive information formatted as plaintext, such as passwords, configuration data, or other secrets. All Systems Manager API activity in your account is logged in an S3 bucket for AWS CloudTrail logs. This means that any user with access to S3 bucket can view the plaintext values of those secrets. For this reason, we recommend creating and using SecureString parameters to encrypt sensitive data you use in your Systems Manager operations. 3083 AWS Systems Manager User Guide For more information, see Restricting access to Parameter Store parameters using IAM policies. Note By default,
systems-manager-ug-868
systems-manager-ug.pdf
868
send a command using Run Command, don't include sensitive information formatted as plaintext, such as passwords, configuration data, or other secrets. All Systems Manager API activity in your account is logged in an S3 bucket for AWS CloudTrail logs. This means that any user with access to S3 bucket can view the plaintext values of those secrets. For this reason, we recommend creating and using SecureString parameters to encrypt sensitive data you use in your Systems Manager operations. 3083 AWS Systems Manager User Guide For more information, see Restricting access to Parameter Store parameters using IAM policies. Note By default, the log files delivered by CloudTrail to your bucket are encrypted by Amazon server-side encryption with Amazon S3-managed encryption keys (SSE-S3). To provide a security layer that is directly manageable, you can instead use server-side encryption with AWS KMS–managed keys (SSE-KMS) for your CloudTrail log files. For more information, see Encrypting CloudTrail log files with AWS KMS–managed keys (SSE-KMS) in the AWS CloudTrail User Guide. • Use the targets and rate control features in Run Command to perform a staged command operation. • Use fine-grained access permissions for Run Command (and all Systems Manager tools) by using AWS Identity and Access Management (IAM) policies. Session Manager • Log session activity in your AWS account using AWS CloudTrail. • Log session data in your AWS account using Amazon CloudWatch Logs or Amazon S3. • Control user session access to instances. • Restrict access to commands in a session. • Turn off or turn on ssm-user account administrative permissions. State Manager • Update SSM Agent at least once a month using the pre-configured AWS-UpdateSSMAgent document. • (Windows) Upload the PowerShell or DSC module to Amazon Simple Storage Service (Amazon S3), and use AWS-InstallPowerShellModule. • Use tags to create application groups for your nodes. And then target nodes using the Targets parameter instead of specifying individual node IDs. • Automatically remediate findings generated by Amazon Inspector by using Systems Manager. 3084 AWS Systems Manager User Guide • Use a centralized configuration repository for your SSM documents, and share documents across your organization. • For information about the differences between State Manager and Maintenance Windows, see Choosing between State Manager and Maintenance Windows. Managed nodes • Systems Manager requires accurate time references to perform its operations. If your node's date and time aren't set correctly, they might not match the signature date of your API requests. This might lead to errors or incomplete functionality. For example, nodes with incorrect time settings won't be included in your lists of managed nodes. For information about setting the time on your nodes, see Set the time for your Amazon EC2 instance. • On Linux managed nodes, verify the signature of SSM Agent. More info • Security best practices for Systems Manager Deleting Systems Manager resources and artifacts As a best practice, we recommend that you delete Systems Manager resources and artifacts if you no longer need to view data about those resources or use the artifacts in any way. The following table lists each Systems Manager tool or artifact and a link to more information about deleting the resources or artifacts created by Systems Manager. Capability or artifact Details Application Manager Automation You can't delete an application in Applicati on Manager, but you can remove an applicati on from the service by deleting the underlyin g tags, Resource Groups, or AWS CloudForm ation stacks. If you create AWS resources by using Systems Manager Automation, you must manually Deleting Systems Manager resources and artifacts 3085 AWS Systems Manager User Guide Capability or artifact Details Change Calendar Change Manager Compliance Distributor delete those resources by using the correspon ding AWS Management Console. If you created a custom runbook, you can delete the underlying SSM document. For more informati on, see Deleting custom SSM documents. You can delete a change calendar and a change calendar event. For more information, see Deleting a change calendar and Deleting a Change Calendar event. You can delete a change template. For more information, see Deleting change templates. Systems Manager Compliance automatic ally displays compliance data about Patch Manager patching and State Manager associati ons. You can't delete this data. If you configure d a resource data sync to centralize complianc e data in an S3 bucket, you can delete the sync. For more information, see Deleting a resource data sync for Compliance. You can delete packages in Distributor. For more information, see Delete a Distributor package. Deleting Systems Manager resources and artifacts 3086 AWS Systems Manager User Guide Capability or artifact Details Explorer Fleet Manager You can disconnect from the sources from which Explorer collects OpsData. For more information, see Editing Systems Manager Explorer data sources. You can also delete a resource data sync used by Explorer to aggregate OpsData and OpsItems from multiple
systems-manager-ug-869
systems-manager-ug.pdf
869
resource data sync to centralize complianc e data in an S3 bucket, you can delete the sync. For more information, see Deleting a resource data sync for Compliance. You can delete packages in Distributor. For more information, see Delete a Distributor package. Deleting Systems Manager resources and artifacts 3086 AWS Systems Manager User Guide Capability or artifact Details Explorer Fleet Manager You can disconnect from the sources from which Explorer collects OpsData. For more information, see Editing Systems Manager Explorer data sources. You can also delete a resource data sync used by Explorer to aggregate OpsData and OpsItems from multiple AWS Regions and accounts to a single Amazon Simple Storage Service (Amazon S3) bucket. For more information, see Deleting a Systems Manager Explorer resource data sync. For information about deleting an S3 bucket, see Deleting a bucket in the Amazon Simple Email Service Developer Guide. You can't delete a managed node by using Fleet Manager. You must use Amazon Elastic Compute Cloud (Amazon EC2). For more information, see Terminate your instance (Linux) and Terminate your instance (Windows) . Deleting Systems Manager resources and artifacts 3087 AWS Systems Manager User Guide Capability or artifact Details Inventory Maintenance Windows OpsCenter Parameter Store Patch Manager You can stop Inventory data collection by deleting the State Manager associations that define the schedule and the resources from which to collect metadata. For more informati on, see Stopping data collection and deleting inventory data. If you no longer want to use AWS Systems Manager Inventory to view metadata about your AWS resources, then we also recommend deleting resource data syncs used for inventory data collection. For more informati on, see Deleting an Inventory resource data sync. You can delete a maintenance window, a maintenance window target, and a maintenan ce window task. For more information, see Update or delete maintenance window resources using the console. You can delete an individual OpsItem by calling the DeleteOpsItem API operation using the AWS Command Line Interface or the AWS SDK. You can't delete an OpsItem in the AWS Management Console. For more information, see Delete OpsItems. You can delete a parameter that you have created. For more information, see Deleting parameters from Parameter Store. You can delete a custom patch baseline. For more information, see Updating or deleting a custom patch baseline. Deleting Systems Manager resources and artifacts 3088 AWS Systems Manager User Guide Capability or artifact Details Quick Setup Run Command Automation Service-linked role Session Manager SSM Agent You can delete associations created by Quick Setup. The associations are stored and processed by State Manager. For more information, see Deleting associations. After a command finishes processin g, information about it is stored in the Command history tab. You can't delete information from the Command history tab. After an automation finishes processing, information about it is stored in the Execution s tab. You can't delete information from the Executions tab. Systems Manager automatically creates service-linked roles for some tools. You can delete these roles. For more information, see Deleting the AWSServiceRoleForA mazonSSM service-linked role for Systems Manager. Session Manager doesn't retain data about your resources after you terminate a session. To terminate a session, see End a session. You can manually uninstall SSM Agent from your nodes. For more information, see the following topics. • Linux: Manually installing and uninstalling SSM Agent on EC2 instances for Linux • macOS: Manually installing and uninstalling SSM Agent on EC2 instances for macOS • Windows Server: Open Control panel and then choose Add/remove programs. Deleting Systems Manager resources and artifacts 3089 AWS Systems Manager User Guide Capability or artifact Details State Manager Systems Manager document service You can delete an association. For more information, see Deleting associations. You can't delete runbooks provided by AWS or AWS Support, but you can delete custom runbooks. For more information, see Deleting custom SSM documents. Choosing between State Manager and Maintenance Windows State Manager and Maintenance Windows, both tools in AWS Systems Manager, can perform some similar types of updates on your managed nodes. Which one you choose depends on whether you need to automate system compliance or perform high-priority, time-sensitive tasks during periods you specify. State Manager and Maintenance Windows: Key use cases State Manager, a tool in AWS Systems Manager, sets and maintains the targeted state configuration for managed nodes and AWS resources within your AWS account. You can define combinations of configurations and targets as association objects. State Manager is the recommended tool if you want to maintain all managed nodes in your account in a consistent state, use Amazon EC2 Auto Scaling to generate new nodes, or have strict compliance reporting requirements for the managed nodes in your account. The main use cases for State Manager are as follows: • Auto Scaling scenarios: State Manager can monitor all new nodes launched within
systems-manager-ug-870
systems-manager-ug.pdf
870
a tool in AWS Systems Manager, sets and maintains the targeted state configuration for managed nodes and AWS resources within your AWS account. You can define combinations of configurations and targets as association objects. State Manager is the recommended tool if you want to maintain all managed nodes in your account in a consistent state, use Amazon EC2 Auto Scaling to generate new nodes, or have strict compliance reporting requirements for the managed nodes in your account. The main use cases for State Manager are as follows: • Auto Scaling scenarios: State Manager can monitor all new nodes launched within an account either manually or through Auto Scaling groups. If there are any associations in the account targeting that new node (through tags or all nodes), then that particular association is automatically applied to the new node. • Compliance reporting: State Manager can drive compliance reporting of required states for resources in your account. • Supporting all nodes: State Manager can target all nodes within a given account. Choosing between State Manager and Maintenance Windows 3090 AWS Systems Manager User Guide A maintenance window takes one or more actions on AWS resources within a given time window. You can define a single maintenance window with start and end times. You can specify multiple tasks to run within this maintenance window. Use Maintenance Windows, a tool in AWS Systems Manager, if your high priority operations include patching your managed nodes, running multiple types of tasks on your nodes during an update period, or controlling when update operations can be run on your nodes. The main use cases for Maintenance Windows are as follows: • Running multiple documents: Maintenance windows can run multiple tasks. Each task can use a different document type. As a result, you can build complex workflows using different tasks within a single maintenance window. • Patching: A maintenance window can provide patching support for all managed nodes in a single Region that are tagged with a specific tag or resource group. Because patching usually involves bringing down nodes (for example, removing nodes from a load balancer), patching, and post processing (putting nodes back into production), patching can be achieved as a series of tasks within a given patch time window. Note Using a maintenance window, your patching operation is limited to a single Region in a single account. Using a patch policy created in Quick Setup, a tool in Systems Manager, you can instead configure patching for some or all accounts and Regions in an organization created in AWS Organizations. For more information, see Patch policy configurations in Quick Setup. • Window actions: Maintenance windows can make one or more sets of actions start within a specific time window. Maintenance windows won't start outside of that window. Actions already started continue until finished, even if they finish outside of the time window. The following table compares the main features of State Manager and Maintenance Windows. Feature State Manager Maintenance Windows AWS CloudFormation integration AWS CloudFormation templates support State Manager associations. AWS CloudFormation templates support maintenan State Manager and Maintenance Windows: Key use cases 3091 AWS Systems Manager User Guide Feature State Manager Maintenance Windows ce windows, window targets, and window tasks. Not applicable. Compliance Every State Manager associati on reports compliance with respect to the required state of the targeted resource. You can use the Compliance Dashboard to aggregate and view the reported complianc e. Configuration Management integration State Manager supports external targeted state Not applicable. solutions such as Microsoft PowerShell Desired State Configuration (DSC), Ansible playbooks, and Chef recipes. You can use State Manager associations to test that the Configuration Management solutions work and to apply their configuration changes to your nodes when you're ready. State Manager and Maintenance Windows: Key use cases 3092 AWS Systems Manager Feature Documents Monitoring User Guide State Manager Maintenance Windows State Manager configura tions can be defined as Policy Maintenance Windows configurations can be defined documents (for gathering as automation documents inventory information), (multi-step actions with Automation runbooks, optional approval workflows for AWS resources such as ) or SSM documents (required Amazon Simple Storage state for managed nodes). Service (Amazon S3) buckets, or Systems Manager Command documents (SSM documents) for managed nodes. State Manager monitors changes in the configura tion, association, or state of a node (for example, new nodes coming online). When State Manager detects these changes, the given associati on is re-applied to the nodes originally targeted with that association. Not applicable. State Manager and Maintenance Windows: Key use cases 3093 AWS Systems Manager User Guide Feature State Manager Maintenance Windows Priorities within tasks Not applicable. Tasks within a maintenan ce window can be assigned a priority. All tasks with the same priority are run in parallel. Tasks with lower priorities are run after tasks with higher priorities reach
systems-manager-ug-871
systems-manager-ug.pdf
871
nodes. State Manager monitors changes in the configura tion, association, or state of a node (for example, new nodes coming online). When State Manager detects these changes, the given associati on is re-applied to the nodes originally targeted with that association. Not applicable. State Manager and Maintenance Windows: Key use cases 3093 AWS Systems Manager User Guide Feature State Manager Maintenance Windows Priorities within tasks Not applicable. Tasks within a maintenan ce window can be assigned a priority. All tasks with the same priority are run in parallel. Tasks with lower priorities are run after tasks with higher priorities reach a final state. There is no way to conditionally run tasks. After a higher priority task reaches its final state, the next priority task runs, regardless of the state of the previous task. Safety controls State Manager supports two safety controls when Maintenance windows support two safety controls deploying configurations when deploying configura across a large fleet. You can tions across a large fleet. You use maximum concurrency to can use maximum concurren define how many concurren cy to define how many t nodes or resources should concurrent nodes or resources have the configuration should have the configura applied. You can define a tion applied. You can define maximum error rate which a maximum error rate which can be used to pause the can be used to pause the State Manager association if a actions in a maintenance certain number or percentag window if a certain number e of errors occur across the fleet. or percentage of errors occur across the fleet. State Manager and Maintenance Windows: Key use cases 3094 AWS Systems Manager Feature Scheduling User Guide State Manager Maintenance Windows You can run State Manager associations on demand, at Maintenance windows support several schedulin a particular cron interval, at a given rate, or after they're g options including at expressions (for example, created. This is useful if you want to maintain the required state of your resources in a "at(2021-07-07T13: 15:30)" ), cron and rate expressions, cron with offsets, consistent and timely manner. and start and end times for when maintenance windows should run, and cutoff times to specify when to stop scheduling within a given time window. Important Cron expressions for State Manager associations do not support the months field, such as 03 or MAR for the month of March. If you require monthly or quarterly configuration updates, a maintenan ce window can best meet your needs. For more information, see Reference: Cron and rate expressions for Systems Manager. State Manager and Maintenance Windows: Key use cases 3095 AWS Systems Manager Feature Targeting User Guide State Manager Maintenance Windows State Manager associati ons can target one or more Maintenance windows can target one or more nodes nodes by using node ID, using node IDs, tags, or tag, or resource group. resource groups. State Manager can target all managed nodes within a given account. Not applicable. Tasks within maintenance windows Maintenance windows can support one or more tasks where each task targets a specific Automation runbook or Command document action. All tasks within a maintenance window run in parallel unless different priorities are set for different tasks. Overall, maintenance windows support four task types: • AWS Systems Manager Run Command commands • AWS Systems Manager Automation workflows • AWS Lambda functions • AWS Step Functions tasks State Manager and Maintenance Windows: Key use cases 3096 AWS Systems Manager User Guide Related information The following related resources can help you as you work with this service. Pricing Some Systems Manager tools charge a fee. For more information, see AWS Systems Manager pricing. AWS Systems Manager documentation library AWS Systems Manager Documentation – Access all user documentation for Systems Manager, including AWS AppConfig, Incident Manager, and AWS Systems Manager for SAP. AWS re:Post AWS re:Post – AWS managed question and answer (Q & A) service offering crowd-sourced, expert- reviewed answers to your technical questions. AWS Blog & Podcast Read blog posts about Systems Manager in the AWS Management Tools Category, and other posts tagged with #Systems Manager. Service quotas Review Systems Manager service quotas in the Amazon Web Services General Reference. Unless otherwise noted, each quota applies to a single Region in an AWS account. Service Authorization Reference for Systems Manager In the AWS Service Authorization Reference, view information about the actions, resources, and condition context keys you can use in AWS Identity and Access Management (IAM) policies for Systems Manager. AWS Systems Manager Service Level Agreement The AWS Systems Manager Service Level Agreement (SLA) is a policy governing the use of Systems Manager and applies separately to each AWS account using Systems Manager. General AWS resources 3097 AWS Systems Manager User Guide The following general resources can help you as you work with AWS. • Classes & Workshops –
systems-manager-ug-872
systems-manager-ug.pdf
872
Region in an AWS account. Service Authorization Reference for Systems Manager In the AWS Service Authorization Reference, view information about the actions, resources, and condition context keys you can use in AWS Identity and Access Management (IAM) policies for Systems Manager. AWS Systems Manager Service Level Agreement The AWS Systems Manager Service Level Agreement (SLA) is a policy governing the use of Systems Manager and applies separately to each AWS account using Systems Manager. General AWS resources 3097 AWS Systems Manager User Guide The following general resources can help you as you work with AWS. • Classes & Workshops – Links to role-based and specialty courses, in addition to self-paced labs to help sharpen your AWS skills and gain practical experience. • AWS Developer Center – Explore tutorials, download tools, and learn about AWS developer events. • AWS Developer Tools – Links to developer tools, SDKs, IDE toolkits, and command line tools for developing and managing AWS applications. • Getting Started Resource Center – Learn how to set up your AWS account, join the AWS community, and launch your first application. • Hands-On Tutorials – Follow step-by-step tutorials to launch your first application on AWS. • AWS Whitepapers – Links to a comprehensive list of technical AWS whitepapers, covering topics such as architecture, security, and economics and authored by AWS Solutions Architects or other technical experts. • AWS Support Center – The hub for creating and managing your AWS Support cases. Also includes links to other helpful resources, such as forums, technical FAQs, service health status, and AWS Trusted Advisor. • Support – The primary webpage for information about Support, a one-on-one, fast-response support channel to help you build and run applications in the cloud. • Contact Us – A central contact point for inquiries concerning AWS billing, account, events, abuse, and other issues. • AWS Site Terms – Detailed information about our copyright and trademark; your account, license, and site access; and other topics. 3098 AWS Systems Manager User Guide Document history The following table describes the important changes to the documentation since the last release of AWS Systems Manager. For notification about updates to this documentation, you can subscribe to an RSS feed. Change Description Date Expanded introduction to Patch Manager To better introduce Patch Manager to potential May 21, 2025 customers and users, we have added the following three sections to the Patch Manager chapter: • How can Patch Manager benefit my organization? • Who should use Patch Manager? • What are the main features of Patch Manager? Updated managed policy for Quick Setup: AWSQuickS Systems Manager has updated the managed policy May 7, 2025 etupSSMDeploymentR AWSQuickSetupSSMDe olePolicy ploymentRolePolicy to provide permissions to tag IAM roles and Lambda resources created for the unified console. For informati on, see Systems Manager updates to AWS managed policies. Feature configuration options for the unified console Systems Manager now provides feature configura May 7, 2025 tion options when setting up 3099 AWS Systems Manager User Guide the unified console. These feature configurations allow you to choose whether to set up Default Host Managemen t Configuration (DHMC), inventory metadata collectio n, and automatic SSM Agent updates. For more informati on, see Setting up Systems Manager unified console for an organization and Setting up Systems Manager unified console for a single account and Region. Updated managed policy for Quick Setup: AWSSystem Systems Manager has updated the managed policy April 29, 2025 sManagerJustInTime NodeAccessRoleProp agationPolicy AWSSystemsManagerJ ustInTimeNodeAcces sRolePropagationPo licy to provide permissio ns to tag a resource shared by AWS Resource Access Manager for just-in-time node access. For information, see Systems Manager updates to AWS managed policies. 3100 AWS Systems Manager User Guide Updated managed policy for Quick Setup: AWSQuickS Systems Manager has updated the managed policy April 29, 2025 etupManageJITNARes ourcesExecutionPolicy AWSQuickSetupManag eJITNAResourcesExe cutionPolicy permissions to tag IAM roles to provide created for just-in-time node access. For information, see Systems Manager updates to AWS managed policies. Systems Manager introduces just-in-time node access AWS Systems Manager now supports a just-in-time April 29, 2025 access method of connectin g to managed nodes. This new method of connectin g to managed nodes helps improve the security of your nodes by providing temporary, time-bound access to nodes only when needed, eliminating the need for long-standing permissio ns. Additionally, Systems Manager provides session recording for RDP sessions to Windows Server nodes to help you meet compliance requirements, perform root cause analysis, and more. For more information, see Just- in-time node access using Systems Manager. 3101 AWS Systems Manager User Guide New managed policies for just-in-time node access Systems Manager has released several new April 29, 2025 managed policies to support just-in-time node access. For information, see Systems Manager updates to AWS managed policies. New versions of the AWS Parameters and Secrets New versions of the AWS Parameters and
systems-manager-ug-873
systems-manager-ug.pdf
873
only when needed, eliminating the need for long-standing permissio ns. Additionally, Systems Manager provides session recording for RDP sessions to Windows Server nodes to help you meet compliance requirements, perform root cause analysis, and more. For more information, see Just- in-time node access using Systems Manager. 3101 AWS Systems Manager User Guide New managed policies for just-in-time node access Systems Manager has released several new April 29, 2025 managed policies to support just-in-time node access. For information, see Systems Manager updates to AWS managed policies. New versions of the AWS Parameters and Secrets New versions of the AWS Parameters and Secrets Lambda Extension Lambda Extension are now April 23, 2025 available for all supported Regions and architectures. New topic: "What is complianc e in Patch Manager?" Patch compliance for the managed nodes in your fleet April 11, 2025 is not defined by AWS or other third parties. The new topic What is compliance in Patch Manager? clarifies that patch compliance for a node managed by Systems Manager means that all patches have been installed on the node that meet the approval criteria specified in the associated patch baseline. Compliance is defined by you, in the rules you configure in a patch baseline, or in a predefined patch baseline provided by AWS that you choose for your patching operations. 3102 AWS Systems Manager User Guide New versions of the AWS Parameters and Secrets New versions of the AWS Parameters and Secrets Lambda Extension Lambda Extension are April 3, 2025 now available. In addition, extension support has been added for the following Regions: • Asia Pacific (Thailand) (ap- southeast-7) • Mexico (Central) (mx-centr al-1) New topic: Configuring permissions for Compliance As a security best practice, we recommend that you March 11, 2025 update the AWS Identity and Access Management (IAM) role used by your managed nodes to restrict the node's ability to use the PutCompli anceItems API action. This API action registers a complianc e type and other complianc e details on a designated resource, such as an Amazon EC2 instance or a managed node. For more information, see Configuring permissions for Compliance. 3103 AWS Systems Manager User Guide Updated topic: Reviewing node insights Updated topic: Verify the signature of SSM Agent February 25, 2025 February 14, 2025 In the unified console for Systems Manager, the Review node insights page reports the number of managed and unmanaged EC2 instances in your organization or account. We have clarified that Systems Manager includes an EC2 instance in the "Unmanaged" count when it is in a Stopped state. For more information, see What is an unmanaged instance?. The AWS Systems Manager Agent (SSM Agent) RPM and Debian installer packages for Linux instances are cryptogra phically signed. You can use a public key to verify that the agent package is original and unmodified. If the files are damaged or have been altered, the verification fails. You can verify the signature of the installer package using either RPM or GPG. The topic includes a new public key for SSM Agent. For more information, see Verify the signature of SSM Agent. 3104 AWS Systems Manager User Guide New topic: Verify the signature of the Session Manager plugin Session Manager plugin updated February 13, 2025 February 6, 2025 The Session Manager plugin RPM and Debian installer packages for Linux instances are cryptographically signed. You can use a public key to verify that the plugin binary and package is original and unmodified. If the file is altered or damaged, the verification fails. You can verify the signature of the installer package using the GNU Privacy Guard (GPG) tool. For more information, see Verify the signature of the Session Manager plugin. The Session Manager plugin was recently updated with the following enhanceme nts: Upgraded the Go version to 1.23 in the Dockerfile. Updated the version configura tion step in the README. For more information about the Session Manager plugin, see Install the Session Manager plugin for the AWS CLI. 3105 AWS Systems Manager User Guide TPS quotas published for Automation API actions January 21, 2025 We have published the transaction per second (TPS) quotas, formerly known as limited, for several Systems Manager Automation-related API actions. For information, see Systems Manager service quotas in the Amazon Web Services General Reference. Terminology change: Systems Manager capabilities renamed Until now, the functional units that make up Systems January 10, 2025 as "tools" Manager have been called capabilities, such as the Automation capability, the Parameter Store capability, and so on. These functional units are now referred to as tools, such as the Automation tool and the Parameter Store tool. This user guide has been updated to reflect the change. Patch Manager support for additional macOS versions Patch Manager now supports macOS versions 12.7, 13.6 January 8, 2025 (Amazon EC2 AMIs) and 13.7, and 15.x. For
systems-manager-ug-874
systems-manager-ug.pdf
874
quotas in the Amazon Web Services General Reference. Terminology change: Systems Manager capabilities renamed Until now, the functional units that make up Systems January 10, 2025 as "tools" Manager have been called capabilities, such as the Automation capability, the Parameter Store capability, and so on. These functional units are now referred to as tools, such as the Automation tool and the Parameter Store tool. This user guide has been updated to reflect the change. Patch Manager support for additional macOS versions Patch Manager now supports macOS versions 12.7, 13.6 January 8, 2025 (Amazon EC2 AMIs) and 13.7, and 15.x. For complete lists of OSs and versions supported by Patch Manager, see Supported operating systems for Patch Manager. 3106 AWS Systems Manager User Guide SSM Agent and Patch Manager support for Patch Manager now supports CentOS Stream 9, Ubuntu additional versions: CentOS Server 24.10, and Windows Stream, Ubuntu Server, and Server 2025. SSM Agent now Windows Server supports Ubuntu Server 24.10 November 22, 2024 and Windows Server 2025. (Agent support for CentOS Stream 9 was previousl y released.) For complete lists of supported OSs and versions, see the following topics: • Supported operating systems for Systems Manager • Supported operating systems for Patch Manager New topic: AWS KMS encryption for Parameter Learn how AWS Systems Manager Parameter Store Store SecureString parameter uses AWS Key Managemen November 22, 2024 s t Service to encrypt the values of SecureString parameters in Parameter Store in the following topic: • AWS KMS encryption for SecureString parameters in Parameter Store 3107 AWS Systems Manager User Guide New and updated managed policies for Systems Manager To support new features for Systems Manager, we November 21, 2024 are releasing multiple new managed policies to support new Systems Manager configurations and operation s, and updating other managed policies. For more information, see Systems Manager updates to AWS managed policies. 3108 AWS Systems Manager User Guide A new, simplified node management experience for AWS Systems Manager has released a new unified November 21, 2024 Systems Manager console experience for managing nodes at scale across accounts and Regions. You can now see all managed and unmanaged nodes across your organizations’ AWS accounts and Regions from a single place. You can also identify, diagnose, and remediate unmanaged nodes. Systems Manager is also now integrated with Amazon Q Developer (Amazon Q), which extends your ability to see and control your nodes from anywhere in the AWS Management Console by entering natural language prompts. With this release, you can also now use AWS Organizations to allow a delegated administrator account to manage nodes across the organization from a central viewpoint. For more information, see the following topics: • What is AWS Systems Manager? • Setting up AWS Systems Manager • Complete node tasks with AWS Systems Manager 3109 AWS Systems Manager User Guide Session Manager plugin bug fix The Session Manager plugin was recently updated with November 20, 2024 the following bug fix: Rolled back change that added credentials to OpenDataC hannel requests. Session Manager plugin enhancements This version was deprecated on 11/20/2024. November 6, 2024 The Session Manager plugin was recently updated with the following enhancements. • Added credentials to OpenDataChannel requests. • Upgraded the testify and objx dependent packages. Additional OS version support for macOS Systems Manager now supports version 15.x November 6, 2024 (Sequoia) of the macOS operating system (EC2 instances only). For a list of all supported OSs and versions, see Supported operating systems for Systems Manager. 3110 AWS Systems Manager User Guide Patch Manager: Updates to supportd package name For several operating systems, we have updated and formats for Approved and expanded the lists of formats November 1, 2024 Rejected lists for package names that you can specify in Approved patches and Rejected patches lists in your patch baselines. For information, see Package name formats for Amazon Linux 1, Amazon Linux 2, Amazon Linux 2022, Amazon Linux 2023, CentOS, Oracle Linux, and Red Hat Enterprise Linux (RHEL). Additional operating version support for Patch Manager Patch Manager now supports additional versions of November 1, 2024 Oracle Linux (8.10 and 9.4) and Ubuntu Server (23.10 and 24.04). For lists of all supported operating systems and versions, see the following topics: • Supported operating systems for Systems Manager • Supported operating systems for Patch Manager 3111 AWS Systems Manager User Guide SSM Agent support for additional versions: CentOS SSM Agent now supports CentOS Stream 9, Oracle Stream, Oracle Linux, and Linux 8.10 and 9.4, and October 25, 2024 Ubuntu Server Session Manager plugin enhancement Ubuntu Server 24.04 LTS, in addition to earlier supported versions. For complete lists of supported OSs and versions for Systems Manager, see Supported operating systems for Systems Manager. Added support for passing the plugin version with OpenDataChannel requests. October 10, 2024 New: View details about RDP connections made
systems-manager-ug-875
systems-manager-ug.pdf
875
Supported operating systems for Systems Manager • Supported operating systems for Patch Manager 3111 AWS Systems Manager User Guide SSM Agent support for additional versions: CentOS SSM Agent now supports CentOS Stream 9, Oracle Stream, Oracle Linux, and Linux 8.10 and 9.4, and October 25, 2024 Ubuntu Server Session Manager plugin enhancement Ubuntu Server 24.04 LTS, in addition to earlier supported versions. For complete lists of supported OSs and versions for Systems Manager, see Supported operating systems for Systems Manager. Added support for passing the plugin version with OpenDataChannel requests. October 10, 2024 New: View details about RDP connections made using Fleet You can now view informati on about Remote Desktop October 10, 2024 Manager Protocol connections that have been made by users in your AWS account. For information, see Viewing information about current and completed connections. Patch Manager now supports SLES version 15.6 Patching support for SUSE Linux Enterprise Server (SLES) September 29, 2024 15.6 has been released. You can now patch SLES 15.6 machines using Patch Manager. For a full list of operating systems and versions supportd by Patch Manager, see Supported operating systems for Patch Manager. 3112 AWS Systems Manager User Guide New versions of the AWS Parameters and Secrets New versions of the AWS Parameters and Secrets Lambda Extension Lambda Extension are now September 19, 2024 available. Support for all architectures has been introduced for the Asia Pacific (Malaysia) Region (ap- southeast-5). In addition, ARM64 and Mac with Apple silicon architecture extension support has been added for the following Regions: • Asia Pacific (Hyderabad) (ap-south-2) • Asia Pacific (Melbourne) (ap-southeast-4) • Canada West (Calgary) (ca- west-1) • Europe (Zurich) (eu-centr al-2) • Europe (Spain) (eu-south-2) • Middle East (UAE) (me-centr al-) • China (Beijing) (cn-north-1) • China (Ningxia) (cn-north west-1) • Israel (Tel Aviv) (il-centr al-1) • AWS GovCloud (US-East) (us-gov-east-1) • AWS GovCloud (US-West) (us-gov-west-1) 3113 AWS Systems Manager User Guide New topic: Configuring permissions for maintenance The topic Configuring permissions for maintenan windows using the AWS CLI ce windows using the AWS August 19, 2024 CLI provides instructions for creating a custom service role (and its policies) for running maintenance window tasks on a user's behalf. SSM Agent and Patch Manager support for additional versions: SSM Agent and Patch Manager now support versions 8.10, 9.3, and 9.4 AlmaLinux, Oracle Linux, and of AlmaLinux and Rocky August 14, 2024 Rocky Linux Linux, and version 9.3 of Oracle Linux, in addition to earlier supported versions. For complete lists of supported OSs and versions, see the following topics: • Supported operating systems for Systems Manager • Supported operating systems for Patch Manager 3114 AWS Systems Manager User Guide New IAM policy condition for Parameter Store support: Using ssm:Policies , a newly supported condition August 14, 2024 ssm:Policies for IAM policies, you can prevent Entities from creating or updating parameter that include a parameter policy. For more information, see the following topics: • ssm:Policies: Prevent creation or updates to parameters that use parameter policies • Condition keys for AWS Systems Manager in the Service Authorization Reference. Updated managed policy for Quick Setup: SSMQuickS Systems Manager has updated the managed policy August 13, 2024 etupRolePolicy SSMQuickSetupRoleP olicy to provide access to additional AWS CloudForm ation stack sets. For informati on, see Systems Manager updates to AWS managed policies. 3115 AWS Systems Manager User Guide Support for provisioning and managing Systems Manager We have added HashiCorp Terraform to the list of resources using Terraform supported third-party August 1, 2024 integrations with Systems Manager. Terraform is an open-source infrastructure as code (IaC) software tool that provides a command line interface (CLI) workflow to manage various cloud services. You can use Terraform to provision and manage a number of commonly used Systems Manager resources and data sources. For information about this and other third-par ty integrations with Systems Manager, see Integration with other products and services. 3116 AWS Systems Manager User Guide New Quick Setup console experience and API Systems Manager Quick Setup has released a new August 1, 2024 console experience and API. Now you can interact with this API using the console, AWS CLI, AWS CloudForm ation, and SDKs. You can opt in to the new console using the Quick Setup console. For more information about onboarding to the new Quick Setup experience, see Getting started with Quick Setup. For more details about the API operations available through the Quick Setup API, see the Quick Setup API Reference. 3117 AWS Systems Manager User Guide New topic: Rejected patch list options in custom patch For patching operations that use a custom patch July 23, 2024 baselines baseline in Patch Manager, we have clarified the behavior when a patch added to the Rejected patch list is assigned the action Allow as dependency . Because Windows Server doesn't support the concept of patch
systems-manager-ug-876
systems-manager-ug.pdf
876
Setup console. For more information about onboarding to the new Quick Setup experience, see Getting started with Quick Setup. For more details about the API operations available through the Quick Setup API, see the Quick Setup API Reference. 3117 AWS Systems Manager User Guide New topic: Rejected patch list options in custom patch For patching operations that use a custom patch July 23, 2024 baselines baseline in Patch Manager, we have clarified the behavior when a patch added to the Rejected patch list is assigned the action Allow as dependency . Because Windows Server doesn't support the concept of patch dependencies, patches not already installed on a managed node are skipped. Patches that are already installed on the node are assigned the status INSTALLED_REJECTED For more information, see . Rejected patch list options in custom patch baselines and Patch compliance values for other operating systems. New topic: Configuring SSM Agent for use with the Federal We have provided instructions for configuring SSM Agent for July 22, 2024 Information Processing use with the Federal Informati Standard (FIPS) on Processing Standard (FIPS). For information, see Configuri ng SSM Agent for use with the Federal Information Processing Standard (FIPS). 3118 AWS Systems Manager User Guide Update: Clarified support for @ symbol in Fleet Manager user names If an IAM Identity Center user name contains one or more July 21, 2024 @ symbols, Fleet Manager RDP disregards the first @ symbol and all characters that follow it, whether or not the @ introduces the domain portion of an email address. For more informati on about supported character s for user names in Fleet Manager RDP connections, see Authenticating Remote Desktop connections. Updated managed policy: AmazonSSMManagedEC Systems Manager has updated the managed policy July 18, 2024 2InstanceDefaultPolicy AmazonSSMManagedEC 2InstanceDefaultPo licy by providing inline statement IDs (Sids) to clarify the purpose of each policy statment. For information, see Systems Manager updates to AWS managed policies. 3119 AWS Systems Manager User Guide Name changes to AWS managed buckets for Patch AWS owns and maintains a number of Amazon S3 Manager patching operations buckets that SSM Agent July 18, 2024 accesses in the course of performing various Patch Manager patching operations. These S3 buckets are publicly accessible, and by default, SSM Agent connects to them using HTTP calls. However, if you're using a virtual private cloud (VPC) endpoint in your Systems Manager operation s, you must provide explicit permission in an Amazon EC2 instance profile for Systems Manager, or in a service role for non-EC2 machines in a hybrid and multiclou d environment. Otherwise, your resources can't access these public buckets. In most cases, we are changing the names of these buckets. For example, for patching operations, the bucket aws- patchmanager-macos- us-east-2 is replaced by aws-patchmanager-m acos-us-east-2-552 881074 , and the bucket aws-ssm-us-east-2 is replaced by aws-patch -manager-us-east-2 -552881074 . For more 3120 AWS Systems Manager User Guide information, see the following topics: • SSM Agent communica tions with AWS managed S3 buckets • Reference: Amazon S3 buckets for patching operations New service-linked role for Quick Setup Systems Manager has released a new service- July 3, 2024 linked role, AWSServic eRoleForSSMQuickSe tup . Systems Manager uses this role to check configura tion health of resources set up using Quick Setup, to ensure consistent use of parameters and provisioned resources, and to remediate resources when drift is detected. The managed policy associated with this role is SSMQuickSetupRoleP olicy . For more informati on, see AWSServiceRoleForS SMQuickSetup service-linked role permissions for Systems Manager. 3121 AWS Systems Manager User Guide New managed policies for Quick Setup configuration Systems Manager has released an additional 12 new July 3, 2024 types managed policies to support various Quick Setup configura tion types and processes. For information, see Systems Manager updates to AWS managed policies. Support for RHEL 8.10 and 9.4 Systems Manager and Patch Manager now support Red June 26, 2024 Hat Enterprise Linux versions 8.10 and 9.4. For more information, see Supported operating systems and machine types and Supported operating systems for Patch Manager. Patch Manager support for 8.8 and 8.9 versions: Patch Manager now supports versions 8.8 and 8.9 of June 17, 2024 AlmaLinux, Oracle Linux, and AlmaLinux, Oracle Linux, Rocky Linux and Rocky Linux, in addition to earlier 8.x versions. For complete lists of supported OSs and versions for Patch Manager, see Supported operating systems for Patch Manager. 3122 AWS Systems Manager User Guide New public parameters for macOS Amazon EC2 AMIs Public parameters have been released to support Amazon June 17, 2024 Machine Images for macOS Amazon Elastic Compute Cloud instances. For more information, see the following topics. • Finding public parameters • Calling AMI public parameters for macOS • Launch a Mac instance in the Amazon EC2 User Guide • Amazon EC2 Mac instances in the Amazon EC2 User
systems-manager-ug-877
systems-manager-ug.pdf
877
and Rocky Linux, in addition to earlier 8.x versions. For complete lists of supported OSs and versions for Patch Manager, see Supported operating systems for Patch Manager. 3122 AWS Systems Manager User Guide New public parameters for macOS Amazon EC2 AMIs Public parameters have been released to support Amazon June 17, 2024 Machine Images for macOS Amazon Elastic Compute Cloud instances. For more information, see the following topics. • Finding public parameters • Calling AMI public parameters for macOS • Launch a Mac instance in the Amazon EC2 User Guide • Amazon EC2 Mac instances in the Amazon EC2 User Guide • Use AWS Systems Manager parameters instead of AMI IDs in launch templates in the Amazon EC2 Auto Scaling User Guide Update: Regional availabil We have clarified which June 12, 2024 ity of the /aws/serv commercial Regions the / ice/global-infrast ructure parameter path aws/service/globa l-infrastructure public parameter path can be queried from, and how to run a query for the path if you are working in a different commerical AWS Region. For information, see Calling public parameters for AWS services, Regions, endpoints, Availability Zones, local zones, and Wavelength Zones. 3123 AWS Systems Manager User Guide New: Code examples chapter Changes to ec2messag es:* endpoint support May 8, 2024 A new chapter, Code examples for Systems Manager using AWS SDKs, provides examples in different SDK languages for how to work with the Systems Manager service. For AWS Regions launching in May 3, 2024 2024 or later, the ec2messag es:* endpoints are not supported by SSM Agent for sending status and execution information back to the Systems Manager service. Accounts in these Regions must use ssmmessages:* . In Regions launched before 2024, both ssmmessag es:* and ec2messages:* are still supported, but we recommend using only the ssmmessages:* endpoint (Amazon Message Gateway Service) now. You can safely remove ec2messages:* permissions from your policies at this time. For more information, see Working with SSM Agent and Agent-related API operations (ssmmessages and ec2messages endpoints). 3124 AWS Systems Manager User Guide Additional runtimes available for running scripts in The aws:executeScript action now supports the Automation runbooks Python 3.9, 3.10, and 3.11 April 23, 2024 runtimes. For more informati on about how to use this action, see aws:execu teScript . Support for 8.8 and 8.9 versions: AlmaLinux, Oracle Systems Manager now supports versions 8.8 and Linux, and Rocky Linux 8.9 of AlmaLinux, Oracle April 22, 2024 Linux, and Rocky Linux, in addition to earlier 8.x versions. For complete lists of supported OSs and versions, see Supported operating systems for Systems Manager. 3125 AWS Systems Manager User Guide Patch Manager: Change to patching status 'INSTALLE Previously, only patches installed by Patch Manager April 16, 2024 D_PENDING_REBOOT' could be marked as INSTALLED_PENDING_ REBOOT . Patches installed outside of Patch Manager were never given this status. Now, INSTALLED _PENDING_REBOOT can apply to any patch that has been applied to a managed node since it was last rebooted. This includes patches installed by Patch Manager with the NoReboot option selected, and to patches installed outside of Patch Manager after the node's most recent reboot. For descriptions of all Patch Manager patching status values, see Understan ding patch compliance state values. Systems Manager, including Patch Manager, now supports Red Hat Enterprise Linux (RHEL) versions 8.9 and 9.3, in addition to earlier 8.x and 9.x versions. Support for RHEL 8.9 and 9.3 March 26, 2024 3126 AWS Systems Manager User Guide Topic update: AWS managed policies for AWS Systems The topic AWS managed policies for AWS Systems March 1, 2024 Manager Manager has provided information about the four managed policies for Systems Manager that have been introduced or updated since March 12, 2021. We have added a section to this topic with information about the 12 other managed policies for use with Systems Manager that were created or last updated before that date. For details, see Additional managed policies for Systems Manager. 3127 AWS Systems Manager User Guide Parameter Store now supports cross-account sharing February 21, 2024 You can now share advanced parameters securely and efficiently across AWS accounts or within your AWS Organization by setting up resource sharing. Resource sharing allows you to centraliz e application configuration management and reduce the operational overhead of sharing the parameters with every single account you own. Parameters can be shared across accounts using the Parameter Store console, the AWS RAM console, or the AWS CLI. For more informati on, see Working with shared parameters. Automation action enhancement You can now use the February 12, 2024 onFailure and isCritica l properties with the aws:approve action. For more information about the aws:approve action, see aws:approve – Pause an automation for manual approval. 3128 AWS Systems Manager User Guide Additional operating version support for Patch Manager We have added to the list of supported operating system January
systems-manager-ug-878
systems-manager-ug.pdf
878
operational overhead of sharing the parameters with every single account you own. Parameters can be shared across accounts using the Parameter Store console, the AWS RAM console, or the AWS CLI. For more informati on, see Working with shared parameters. Automation action enhancement You can now use the February 12, 2024 onFailure and isCritica l properties with the aws:approve action. For more information about the aws:approve action, see aws:approve – Pause an automation for manual approval. 3128 AWS Systems Manager User Guide Additional operating version support for Patch Manager We have added to the list of supported operating system January 4, 2024 versions for Patch Manager. Support has been added for the following: • Debian Server 11.x and 12.x • macOS 14.x (Sonoma) • SUSE Linux Enterprise Server (SLES) 15.5 • Ubuntu Server 23.04 Configure automated SSM Agent updates using the You can now use the Applicati on Manager console to Application Manager console automate SSM Agent updates December 21, 2023 Updated process for registeri ng non Amazon EC2 machines in hybrid and multicloud environments for your application instances . For more information, see Working with your application instances. Systems Manager now December 20, 2023 provides the ssm-setup- cli to help you register non Amazon Elastic Compute Cloud (Amazon EC2) machines in hybrid and multicloud environments. For more information, see How to install the SSM Agent on hybrid Linux nodes and How to install the SSM Agent on hybrid Windows nodes. 3129 AWS Systems Manager User Guide Manage Amazon EBS volumes using Fleet Manager You can now use Fleet Manager, a tool in AWS December 14, 2023 Systems Manager, to manage Amazon Elastic Block Store volumes on your managed instances. For example, you can initialize an EBS volume, format a partition, and mount the volume to make it available for use. For more information, see EBS volume management. Added support for passing a StartSession API response as an environment variable to session-manager-plugin. December 4, 2023 Session Manager plugin enhancement New visual design experience for Automation runbooks You can now create and edit runbooks using a new November 26, 2023 visual design experienc e developed by Systems Manager Automation. The visual design experience provides a low-code, drag- and-drop interface so you can create and edit runbooks more easily. For more information, see Visual design experience for Automation runbooks. 3130 AWS Systems Manager User Guide New Systems Manager Automation actions, data element, and functional enhancements for runbooks November 17, 2023 You can now loop over multiple actions in a runbook using the aws:loop action. This new action supports do while and for each style loops. Additionally, using the new variables data element, you can define, reference and update values dynamically within the context of a runbook. To update the value of a variable in your runbook, use the new aws:updateVariable action. Automation has also added support for dynamic data type conversions for outputs. This means that if the value of an output doesn't match the data type you've specified, Automation tries to convert the data type. For example, if the value returned is an Integer, but the Type specified is String, the final output value is a String value. Lastly, Automation now supports JSONPath filter expressions for selectors. For more information, see the following topics: • aws:loop – Iterate over steps in an automation 3131 AWS Systems Manager User Guide Updated Region support for Remote Desktop Protocol (RDP) connections November 15, 2023 • aws:updateVariable – Updates a value for a runbook variable • Data elements and parameters – Top-level data elements • Using action outputs as inputs. • Using JSONPath in runbooks. Fleet Manager Remote Desktop, which is powered by Amazon DCV, provides you with secure connectiv ity to your Windows Server instances directly from the Systems Manager console. The following three additiona l Regions have been enabled for Fleet Manager Remote Desktop connections: • Africa (Cape Town) (af- south-1) • Asia Pacific (Jakarta) (ap- southeast-3) • Israel (Tel Aviv) (il-centr al-1) 3132 AWS Systems Manager User Guide Patch Manager: Expanded OS version support for RHEL and Patch Manager now supports the following additional macOS operating system versions: October 23, 2023 New OpsCenter API - DeleteOpsItem New Quick Setup configura tion type: SSM Agent updates for entire organization • Red Hat Enterprise Linux: version 8.8 • macOS: 11.5–11:7 (Big Sur) • macOS: 12.0–12.6 (Monterey) • macOS: 13.0–13.5 (Ventura) OpsCenter now offers the DeleteOpsItem API for deleting individual OpsItems. For more information, see DeleteOpsItem in the AWS Systems Manager API Reference. October 20, 2023 The new configuration type October 16, 2023 Default Host Managemen t Configuration makes it possible for an organization administrator, as defined in AWS Organizations, to prompt automatic check and updates of SSM Agent on all EC2 instances in the organizat ion's accounts and Regions. For more information, see Default
systems-manager-ug-879
systems-manager-ug.pdf
879
SSM Agent updates for entire organization • Red Hat Enterprise Linux: version 8.8 • macOS: 11.5–11:7 (Big Sur) • macOS: 12.0–12.6 (Monterey) • macOS: 13.0–13.5 (Ventura) OpsCenter now offers the DeleteOpsItem API for deleting individual OpsItems. For more information, see DeleteOpsItem in the AWS Systems Manager API Reference. October 20, 2023 The new configuration type October 16, 2023 Default Host Managemen t Configuration makes it possible for an organization administrator, as defined in AWS Organizations, to prompt automatic check and updates of SSM Agent on all EC2 instances in the organizat ion's accounts and Regions. For more information, see Default Host Management for an organization. 3133 AWS Systems Manager User Guide New title and description format for OpsItems created The title and description for OpsItems created by by CloudWatch Application CloudWatch Application September 29, 2023 Insights Insights is changing to an improved format on October 16, 2023. To view the new format, see Amazon CloudWatch Application Insights. Support for multiple display resolutions in Fleet Manager When you connect to Windows Server managed September 22, 2023 RDP connections nodes using the Remote Desktop protocol (RDP) option in Fleet Manager, you can now choose the display resolution. Previously, all connections used a fixed 720P (1366 x 768) resolution. You can now choose from the following for each connectio n: • Adapt Automatically (determines optimum resolution based on your detected screen size) • 1920 x 1080 • 1400 x 900 • 1366 x 768 • 800 x 600 For information, see Connect to a managed node using Remote Desktop. 3134 AWS Systems Manager User Guide New topic: Random patch baseline IDs in patch policy We have added content to describe how Quick September 22, 2023 operations Setup patch policies use the BaselineOverride parameter in the AWS- RunPatchBaseline SSM Command document to generate random IDs for patch baselines each time a patch policy operation is run. For information, see Random patch baseline IDs in patch policy operations. A new operational insight for managing OpsItems OpsCenter now includes an operational insight called September 22, 2023 Resources generating the most OpsItems. An insight of this type is generated when an AWS resource has more than 10 open OpsItems. Use this insight to locate problematic resources. Use the AWS-BulkResolveOps Items runbook from within an insight to quickly resolve OpsItems associated with a resource. For more informati on, see Analyzing operational insights to reduce OpsItems. A new public key has been created to verify the signature of SSM Agent. For more information, see Verifying the signature of SSM Agent. September 5, 2023 3135 GPG public key updated AWS Systems Manager User Guide Support added for additional versions of AlmaLinux, Oracle The lists of supported operating systems for AWS Linux, RHEL, and Rocky Linux Systems Manager and August 30, 2023 Patch Manager have been updated to reflect support the following additional OS versions: • AlmaLinux: 9.2 • Oracle Linux: 8.7 and 9.2 • Red Hat Enterprise Linux (RHEL): 8.7, 9.1, and 9.2 • Rocky Linux: 8.6 and 8.7, 9.0–9.2 OpsCenter added support for Markdown formatting in the OpsCenter now supports Markdown formatting in the August 18, 2023 OpsItem description field. OpsItem description field. The following types of Markdown formatting are supported: • Paragraphs • Line spacing • Horizontal Lines • Headings • Text Formatting • Links • Lists For more information, see Using Markdown in the Console in the Getting Started with the AWS Management Console Getting Started Guide. 3136 AWS Systems Manager User Guide New versions of the AWS Parameters and Secrets New versions of the AWS Parameters and Secrets Lambda Extension Lambda Extension are August 16, 2023 now available. In addition, extension support has been added for the Asia Pacific (Melbourne) (ap-southeast-4) and Israel (Tel Aviv) (il-centr al-1) Regions (x86_64 and x86 architectures only.) For more information, see Using Parameter Store parameters in AWS Lambda functions. 3137 AWS Systems Manager User Guide Update: Added information about required permissions When you create a patch policy, Quick Setup creates July 6, 2023 for Quick Setup patch policy an Amazon S3 bucket buckets that contains a file named baseline_overrides .json . This file stores information about the patch baselines that you specified for your patch policy. When configuring the patch policy, you have the option of selecting an Add required IAM policies to existing instance profiles attached to your instances check box. If you choose not to select this option, then you must manually provide certain resources with permissions to access this bucket or your policy operations might fail. For more information, see the following topics: • Permissions for the patch policy S3 bucket • Issue: "Invoke-PatchBasel ineOperation : Access Denied" error or "Unable to download file from S3" error for baseline_ overrides.json 3138 AWS Systems Manager User Guide Use Quick Setup to configure OpsCenter for multi-account Quick Setup for
systems-manager-ug-880
systems-manager-ug.pdf
880
policy, you have the option of selecting an Add required IAM policies to existing instance profiles attached to your instances check box. If you choose not to select this option, then you must manually provide certain resources with permissions to access this bucket or your policy operations might fail. For more information, see the following topics: • Permissions for the patch policy S3 bucket • Issue: "Invoke-PatchBasel ineOperation : Access Denied" error or "Unable to download file from S3" error for baseline_ overrides.json 3138 AWS Systems Manager User Guide Use Quick Setup to configure OpsCenter for multi-account Quick Setup for OpsCenter helps you complete the June 19, 2023 OpsItem management following tasks for managing OpsItems across accounts: • Specifying the delegated administrator account • Creating required AWS Identity and Access Management (IAM) policies and roles • Specifying an AWS Organizations organizat ion, or a subset of member accounts, where a delegated administrator can manage OpsItems across accounts For more information, see (Optional) Configure OpsCenter to manage OpsItems across accounts by using Quick Setup. Update Amazon EC2 launch agents using Quick Setup You can now allow Systems Manager to check every 30 June 19, 2023 days for a new version of the launch agent installed on your instance. If a new version is available, Systems Manager updates the agent on your instance. For more informati on, see Quick Setup Host Management. 3139 AWS Systems Manager User Guide Patch Manager now supports Ubuntu Server 22.04 LTS You can now use Patch Manager to patch Ubuntu May 15, 2023 Server 22.04 LTS nodes. Like other supported versions of Ubuntu Server, version 22.04 LTS, uses the AWS managed AWS-UbuntuDefaultP patch atchBaseline baseline. Systems Manager now supports AlmaLinux, including You can now use Systems Manager to manage May 8, 2023 Patch Manager AlmaLinux 8.3-8.7; 9.0-9.1 nodes. Many of the rules that apply to RHEL 8 for patching also apply to AlmaLinux . AlmaLinux uses the new AWS-DefaultAlmaLin uxPatchBaseline more information, see the . For following topics: • Manually install SSM Agent on AlmaLinux instances • How security patches are selected • How patches are installed • How patch baseline rules work on AlmaLinux, RHEL, and Rocky Linux. 3140 AWS Systems Manager User Guide Deploy the EC2Launch v2 agent using Quick Setup April 13, 2023 You can now deploy the EC2Launch v2 agent using Quick Setup. For more information, see Deploy Distributor packages with Quick Setup. Systems Manager now supports Amazon Linux 2023 Systems Manager now supports the new Amazon March 23, 2023 Linux 2023 (AL2023) EC2 instance type, including support for Patch Manager operations. Many of the rules for patching that apply to Amazon Linux 2 also apply to Amazon Linux 2023. (Patch Manager also continues to support the preview release Amazon Linux 2022.) For more information, see the following topics: • How security patches are selected • How patches are installed • How patch baseline rules work on Amazon Linux 1, Amazon Linux 2, Amazon Linux 2022, and Amazon Linux 2023 3141 AWS Systems Manager User Guide Revised setting up content for Amazon EC2 instances We have revised the setting up content for Amazon February 15, 2023 EC2 instances. It is now recommended to use the newly released Default Host Management Configuration for instance permissions. For more information, see Configure instance permissio ns required for Systems Manager. Automatic instance management with the Default You can now automatic ally manage Amazon EC2 Host Management Configura instances in an entire AWS February 15, 2023 tion Region using Systems Manager. For more informati on, see Default Host Management Configuration. Add SSM documents to your favorites To help you find frequentl y used SSM documents, you February 7, 2023 can now add documents to your favorites. You can favorite up to 20 documents per document type, per AWS account and AWS Region. You can choose, modify, and view your favorites from the Systems Manager Documents console. For more informati on, see Adding documents to your favorites. 3142 AWS Systems Manager User Guide Implement change controls for Automation using Change By integrating Automation with Change Calendar, you January 24, 2023 Calendar can now implement change controls to all automatio ns in your AWS account. For more information, see Implement change controls for Automation. New Change Manager approval workflow The Change Manager approval workflow now January 23, 2023 supports per-level approvals instead of per-line approvals . Previously, every approver you added to an approval level had to approve a change request. Otherwise, the level was not approved. Now, you specify how many approvals are required for the level and can add that many or more approvers. For example, you can require three approvals for a level but specify up to five approvers. Approvals from any three of those approvers are sufficien t to approve the level. For more information, see
systems-manager-ug-881
systems-manager-ug.pdf
881
change controls for Automation. New Change Manager approval workflow The Change Manager approval workflow now January 23, 2023 supports per-level approvals instead of per-line approvals . Previously, every approver you added to an approval level had to approve a change request. Otherwise, the level was not approved. Now, you specify how many approvals are required for the level and can add that many or more approvers. For example, you can require three approvals for a level but specify up to five approvers. Approvals from any three of those approvers are sufficien t to approve the level. For more information, see About approvals in your change templates. 3143 AWS Systems Manager User Guide New: Configure patching for an entire organization using a With Quick Setup, a tool in Systems Manager, you can patch policy in Quick Setup now create patch policies December 22, 2022 powered by Patch Manager. A patch policy defines the schedule and patch baseline to use when automatically patching your managed nodes. Using a single patch policy configuration, you can define patching for all accounts in all Regions in your organization, for only the accounts and Regions you choose, or for a single account-Region pair. For more information, see the following topics. • Using Quick Setup patch policies • Automate organization- wide patching using a Quick Setup patch policy 3144 AWS Systems Manager User Guide Application Manager integrates with Amazon EC2 Application Manager displays instance state, status, and to display information about Amazon EC2 Auto Scaling your instances in the context health for a selected applicati December 22, 2022 of an application. on in a graphical format. The Instances tab also includes a table with the following information for each instance in your application. • Instance state (Pending, Stopping, Running, Stopped) • Ping status for SSM Agent • Status and name of the last Systems Manager Automation runbook processed on the instance • A count of Amazon CloudWatch Logs alarms per state. • ALARM – The metric or expression is outside of the defined threshold. • OK – The metric or expression is within the defined threshold. • INSUFFICIENT_DATA – The alarm has just started, the metric is not available, or not enough data is available for the metric to determine the alarm state. 3145 AWS Systems Manager User Guide • Auto Scaling group health for the parent and individua l autoscaling groups Schedule the starting and stopping of your Amazon EC2 You can now deploy the Resource Scheduler solution instances using Quick Setup to automate the starting and December 19, 2022 stopping of your Amazon EC2 instances using Quick Setup. For more information, see Resource Scheduler. 3146 AWS Systems Manager User Guide OpsCenter now supports working with OpsItems across OpsCenter supports working with OpsItems from a November 16, 2022 accounts management account (either an AWS Organizations management account or a Systems Manager delegated administrator account) and a member account during a session. Once configure d, users can perform the following types of actions: • Create, view, and update OpsItems in a member account • View detailed informati on about AWS resources specified in OpsItems in a member account • Start Systems Manager Automation runbooks to remediate issues with AWS resources in a member account For more information, see Setting up OpsCenter to work with OpsItems across accounts. 3147 AWS Systems Manager User Guide Track details of Change Manager change requests You can now use an event data store in AWS CloudTrai using AWS CloudTrail Lake l Lake to capture and review November 11, 2022 details about the change requests that are run in Change Manager for your organization or account. This information includes auditable details about the user identity that created the change request, the IP address from which the request was made, the AWS Regions in which the changes were made, the targeted resources, and more. For information, see Monitoring your change request events and Reviewing change request details, tasks, and timelines. 3148 AWS Systems Manager User Guide Additional Systems Manager Automation task controls You can now implement additional control when using CloudWatch alarms running automations across November 9, 2022 multiple accounts and Regions by using CloudWatch alarms. By applying a metric or composite CloudWatc h alarm to an automation, you can control when an automation stops based on the metrics you define. For more information about applying a CloudWatch alarm to an automation running across multiple accounts and Regions see Run an automatio n in multiple Regions and accounts (console) Updated: 'Using Parameter Store parameters in AWS We have provided additiona l information to help you Lambda functions' use the AWS Parameters and October 25, 2022 Secrets Lambda Extension to retrieve parameter values and cache them for future use in Lambda functions. Using the Lambda extension can reduce your costs by reducing the number of
systems-manager-ug-882
systems-manager-ug.pdf
882
alarm to an automation, you can control when an automation stops based on the metrics you define. For more information about applying a CloudWatch alarm to an automation running across multiple accounts and Regions see Run an automatio n in multiple Regions and accounts (console) Updated: 'Using Parameter Store parameters in AWS We have provided additiona l information to help you Lambda functions' use the AWS Parameters and October 25, 2022 Secrets Lambda Extension to retrieve parameter values and cache them for future use in Lambda functions. Using the Lambda extension can reduce your costs by reducing the number of API calls to Parameter Store. For information, see Using Parameter Store parameters in AWS Lambda functions. 3149 AWS Systems Manager User Guide Additional Systems Manager task controls using CloudWatc You can now implement additional control when September 26, 2022 h alarms running automations and commands by using CloudWatch alarms. A CloudWatch alarm can also be added to an automation or command when it is registere d with a State Manager association or maintenance window task. By applying a composite CloudWatch alarm to an automation or command, you can control when an automation or command stops based on the metric you define. For more information about applying a CloudWatch alarm to an automation or command see the following procedures: • How security patches are selected • How patches are installed • How patch baseline rules work on Amazon Linux 1, Amazon Linux 2, and Amazon Linux 2022. 3150 AWS Systems Manager User Guide Additional Systems Manager task controls using CloudWatc You can now implement additional control when September 26, 2022 h alarms Clarifying advanced-instances tier requirements running automations and commands by using CloudWatch alarms. A CloudWatch alarm can also be added to an automation or command when it is registere d with a State Manager association or maintenance window task. By applying a composite CloudWatch alarm to an automation or command, you can control when an automation or command stops based on the metric you define. For more information about applying a CloudWatch alarm to an automation or command see the following procedures: • Running a simple automation • Running commands from the console • Create an association • Assign tasks to a maintenan ce window Based on customer feedback, we have clarified the scenarios that require you to activate the advanced- instances tier in Configuring instance tiers. September 21, 2022 3151 AWS Systems Manager User Guide Deploy the Amazon CloudWatch Agent using Quick Setup You can now deploy the Amazon CloudWatch agent using Quick Setup. For more information, see Deploy Distributor packages with Quick Setup. September 20, 2022 'PatchGroup' key now supported for patch groups When you allow tags in EC2 instance metadata, the tag when EC2 instance metadata keys you create must not August 31, 2022 is allowed contain any spaces. Previousl y, this prevented customers from adding some of their EC2 instances to patch groups in Patch Manager because the tag key Patch Group had to be applied to the instances. Patch Manager now supports both Patch Group (with a space) and PatchGroup (without a space) as the tag key for identifying instances for a patch group. EC2 instances where tags are allowed in instance metadata can now be added to patch groups in Patch Manager. For informati on, see About patch groups. 3152 AWS Systems Manager User Guide New topic: "How package release dates and update In patch baselines managed by AWS, new patches are dates are calculated" auto-approved 7 days after August 24, 2022 they are released or updated. In custom patch baselines you create, you can optionall y specify how many days to wait after they are released or updated to auto-approve their installation. For Amazon Linux 1 and Amazon Linux 2, various factors influence how the latest release dates and update dates are calculated. To help you avoid unexpecte d results when choosing auto-approval delays, these factors are explained in the topic How package release dates and update dates are calculated. Updated content: Patch an AMI and update an Auto We have updated the Updating AMIs for Auto June 22, 2022 Scaling group Scaling groups walkthrou gh to use launch templates instead of launch configura tions. Additionally, we've implemented the latest Automation actions and runtimes in the runbook content. 3153 AWS Systems Manager User Guide Change Manager: Prevent users from creating auto-appr You can configure change templates in Change Manager June 15, 2022 ovable requests to support automatic approvals, meaning that users with the necessary IAM permissions can choose to start the change request without requiring additiona l approval. Now, you can also restrict individual users, groups, or IAM roles from submitting auto-approval requests, even if a change template supports them. This is achieved through the use of a new IAM condition key, ssm:AutoApprove
systems-manager-ug-883
systems-manager-ug.pdf
883
configura tions. Additionally, we've implemented the latest Automation actions and runtimes in the runbook content. 3153 AWS Systems Manager User Guide Change Manager: Prevent users from creating auto-appr You can configure change templates in Change Manager June 15, 2022 ovable requests to support automatic approvals, meaning that users with the necessary IAM permissions can choose to start the change request without requiring additiona l approval. Now, you can also restrict individual users, groups, or IAM roles from submitting auto-approval requests, even if a change template supports them. This is achieved through the use of a new IAM condition key, ssm:AutoApprove . For more information, see Controlling access to auto- approval runbook workflows 3154 AWS Systems Manager User Guide Updated guidance for maintenance window task Previously, the Systems Manager console provided June 9, 2022 roles you with the ability to choose the AWS managed IAM service-linked role AWSServiceRoleForA mazonSSM to use as the maintenance role for your tasks. Using this role and its associated policy, AmazonSSM ServiceRolePolicy maintenance window tasks , for is no longer recommended. You should create a custom policy and role for maintenan ce window tasks instead. For more information, see Setting up Maintenance Windows. Port forwarding to remote hosts support for Session Session Manager now supports port forwarding May 25, 2022 Manager sessions to remote hosts. The remote host isn't required to be managed by Systems Manager. For more informati on, see Starting a session (port forwarding to remote host). 3155 AWS Systems Manager User Guide Updated content: Instructions for manually installing SSM In response to customer feedback, we have overhaule May 9, 2022 Agent on Amazon EC2 Linux d the topics that provide instances instructions for manually installing SSM Agent on Amazon EC2 instances. These topics now provide commands using globally available files that you can copy and paste for quick installation on EC2 instances in any AWS Region. These topics also provide informati on to help you creating installation commands that use files available in your own working Region. The latter approach is recommended when you are installing the agent on multiple instances using a script or template. For more information, see the instructions for your Linux operating system in the section Manually installing SSM Agent on EC2 instances for Linux. 3156 AWS Systems Manager User Guide New topic: Amazon Machine Images (AMIs) with SSM In response to customer feedback, we have centraliz May 8, 2022 Agent preinstalled New State Manager section ed information about which AWS managed AMIs include SSM Agent preinstalled. This topic also provides instructi ons for how to verify that an Amazon EC2 instance created from these AMIs was successfully installed and is running. For rare cases where the agent might not install successfully, or install but not start, we also provide information about starting or manually installing the agent on these instances . For details, see Amazon Machine Images (AMIs) with SSM Agent preinstalled. Added a new section that describes the details of when State Manager runs associati ons. For more informati on, see About association scheduling. April 27, 2022 3157 AWS Systems Manager User Guide Patch Manager now supports Rocky Linux You can now use Patch Manager to patch Rocky Linux April 14, 2022 nodes. Many of the rules that apply to RHEL 8 for patching also apply to Rocky Linux. Rocky Linux 8 uses the new AWS-DefaultRockyLi nuxPatchBaseline more information, see the . For following topics: • How security patches are selected • How patches are installed • How patch baseline rules work on RHEL, CentOS Stream, and Rocky Linux. 3158 AWS Systems Manager User Guide Patch Manager now supports CentOS Stream 8 You can now use Patch Manager to patch CentOS April 4, 2022 Stream 8 instances and Red Hat Enterprise Linux (RHEL) 4.4-4.5 instances. Many of the rules that apply to RHEL 8 for patching also apply CentOS Stream 8. CentOS Stream 8 uses the AWS-Defau ltCentOSPatchBasel ine . For more information, see the following topics: • How security patches are selected • How patches are installed • How patch baseline rules work on RHEL and CentOS Stream 3159 AWS Systems Manager User Guide Create an assume role for Change Manager A new section clarifies the requirements for creating March 18, 2022 and implementing an assume role for Change Manager. An assume role is an AWS Identity and Access Management (IAM) service role that enables Change Manager to securely run the runbook workflows specified in an approved change request on your behalf. The role grants AWS Systems Manager (AWS STS) AssumeRole trust to Change Manager. For information, see Configuri ng roles and permissions for Change Manager. Approve or reject Change Manager change requests in In the Systems Manager console, you can now select March 8, 2022 bulk multiple change requests to approve or reject in a
systems-manager-ug-884
systems-manager-ug.pdf
884
requirements for creating March 18, 2022 and implementing an assume role for Change Manager. An assume role is an AWS Identity and Access Management (IAM) service role that enables Change Manager to securely run the runbook workflows specified in an approved change request on your behalf. The role grants AWS Systems Manager (AWS STS) AssumeRole trust to Change Manager. For information, see Configuri ng roles and permissions for Change Manager. Approve or reject Change Manager change requests in In the Systems Manager console, you can now select March 8, 2022 bulk multiple change requests to approve or reject in a single operation. For information, see Reviewing and approving or rejecting change requests (console). 3160 AWS Systems Manager User Guide Support for Rocky Linux and Windows Server 2022 Systems Manager supports Rocky Linux and Windows March 1, 2022 managed nodes Server 2022 managed nodes, including edge devices and hybrid machines located on-premises or with other cloud providers. To use Systems Manager with these operating systems, you must complete all required Systems Manager set up procedure s, including procedures for hybrid environments or edge devices, if applicable. For more information, see Setting up Systems Manager. For Rocky Linux machines, you must also manually install SSM Agent. For more information, see Manually install SSM Agent on Rocky Linux instances. For Windows Server 2022 Amazon Elastic Compute Cloud (Amazon EC2) instances, SSM Agent is installed by default. 3161 AWS Systems Manager User Guide Allow Automation to adapt to your concurrency needs You can now allow Automatio n to automatically adjust January 27, 2022 and view Automation usage your concurrent automation metrics quota, and view Automatio n usage metrics that are published to CloudWatch. For more information about adaptive concurrency, see Allowing Automation to adapt to your concurrency needs. For more information about how to view Automation usage metrics, see Monitorin g Automation metrics using Amazon CloudWatch. Allow Automation to adapt to your concurrency needs You can now allow Automatio n to automatically adjust January 27, 2022 and view Automation usage your concurrent automation metrics quota, and view Automatio n usage metrics that are published to CloudWatch. For more information about adaptive concurrency, see Allowing Automation to adapt to your concurrency needs. For more information about how to view Automation usage metrics, see Monitorin g Automation metrics using Amazon CloudWatch. 3162 AWS Systems Manager User Guide Systems Manager documents organized by categories Amazon owned Systems Manager documents are January 13, 2022 now organized by type and categories to help you find the documents you need. Create and invoke integrati ons for Automation You can now send messages using webhooks during an January 13, 2022 automation by creating an integration. Integrations can be invoked during an automation using the new aws:invokeWebhook action in your runbook. For more information about creating integrations, see Creating webhook integrati ons for Automation. To learn more about the aws:invok eWebhook action, see aws:invokeWebhook – Invoke an Automation webhook integration. Capabilities not available in new AWS Region The following Systems Manager tools currently aren't December 13, 2021 available in the new Asia Pacific (Jakarta) Region. • Application Manager • Change Calendar • Change Manager • Explorer • Fleet Manager • Incident Manager • Quick Setup 3163 AWS Systems Manager User Guide View resource cost details for an application Application Manager is integrated with AWS Billing December 7, 2021 and Cost Management through the Cost Explorer widget. After you enable Cost Explorer in the Billing and Cost Management console, the Cost Explorer widget in Application Manager shows cost data for a specific non- container application or application component. You can use filters in the widget to view cost data according to different time periods, granularities, and cost types in either a bar or line chart. For more information, see Viewing overview information about an application. Manage processes using Fleet Manager You can now use Fleet Manager to manage processes December 6, 2021 on your nodes. For more information, see Working with processes. 3164 AWS Systems Manager User Guide Terminology change: managed instances are now With support for AWS IoT Greengrass core devices, the managed nodes phrase managed instance has November 29, 2021 been changed to managed node in most of the Systems Manager documentation. The Systems Manager console, API calls, error messages, and SSM documents still use the term instance. 3165 AWS Systems Manager User Guide Support for edge devices November 29, 2021 Systems Manager supports the following edge device configurations. • AWS IoT Greengrass: Systems Manager now supports any device that is configured for AWS IoT Greengrass and runs the AWS IoT Greengrass Core software. To onboard your AWS IoT Greengras s core devices, you must create an AWS Identity and Access Managemen t (IAM) service role. You must also use the AWS IoT Greengrass console to deploy SSM Agent as a
systems-manager-ug-885
systems-manager-ug.pdf
885
documentation. The Systems Manager console, API calls, error messages, and SSM documents still use the term instance. 3165 AWS Systems Manager User Guide Support for edge devices November 29, 2021 Systems Manager supports the following edge device configurations. • AWS IoT Greengrass: Systems Manager now supports any device that is configured for AWS IoT Greengrass and runs the AWS IoT Greengrass Core software. To onboard your AWS IoT Greengras s core devices, you must create an AWS Identity and Access Managemen t (IAM) service role. You must also use the AWS IoT Greengrass console to deploy SSM Agent as a AWS IoT Greengrass component on your devices. For more information, see Setting up AWS Systems Manager for edge devices. • Edge devices in a hybrid environment: Systems Manager also supports AWS IoT Core devices and non-AWS IoT devices after you configure them as on- premises machines. To onboard your devices, you must create an IAM service role, create a managed-n ode activation for a hybrid environment, and manually 3166 AWS Systems Manager User Guide install SSM Agent on your devices. For more informati on, see Setting up AWS Systems Manager for hybrid environments Connect to managed instances using Remote You can now use Fleet Manager to connect to November 23, 2021 Desktop managed Windows instances using the Remote Desktop Protocol (RDP). These Remote Desktop sessions powered by Amazon DCV provide secure connections to your instances directly from your browser. For more informati on, see Connect using Remote Desktop. Specify a maximum session duration and provide reasons You can now specify a maximum session duration for November 16, 2021 for sessions all Session Manager sessions in an AWS Region in your AWS account. When a session reaches reaches the duration you specify, it's terminated. You can now also optionally add a reason when starting a session. For more informati on, see Specify maximum session duration. 3167 AWS Systems Manager User Guide Patch Manager now supports the Raspberry Pi OS operating You can now use Patch Manager to patch Raspberry November 16, 2021 system Access the Red Hat Knowledgebase portal Pi OS instances. Patch Manager supports patching Raspberry Pi OS 9 (Stretch) and 10 (Buster). Because the Raspberry Pi OS is Debian- based OS, many of the same patching rules apply to it as to Debian Server. For more information, see the following topics: • How security patches are selected • How patches are installed • How patch baseline rules work on Debian Server and Raspberry Pi OS Use Fleet Manager to access the RHEL Knowledgebase portal to find solutions, articles, documentation, and videos about using Red Hat products. For more informati on, see Accessing the Red Hat Knowledge base portal. November 3, 2021 3168 AWS Systems Manager Bulk edit OpsItems User Guide October 15, 2021 OpsCenter now supports bulk editing OpsItems. You can select multiple OpsItems and edit one of the following fields: Status, Priority, Severity, Category. For more information, see Editing OpsItems. Create input parameters that populate AWS resources You can now create input parameters in Automatio October 14, 2021 n runbooks that populate AWS resources in the AWS Management Console. For information, see Creating input parameters that populate AWS resources. New task invocation cutoff option for maintenance You can now choose to block any new task invocatio October 13, 2021 windows ns from starting after the cutoff time specified for a maintenance window is reached. For information, see Assign tasks to a maintenance window (console). 3169 AWS Systems Manager User Guide Patch Manager support for macOS 11.3.1 and 11.4 (Big Amazon Elastic Compute Cloud (Amazon EC2) instances October 1, 2021 Sur) for macOS 11.3.1 and 11.4 (Big Sur) can now be patched using Patch Manager. This is in addition to existing support for macOS 10.14.x (Mojave) and 10.15.x (Catalina). For information about working with Patch Manager, see AWS Systems Manager Patch Manager. 3170 AWS Systems Manager Application insights in Application Manager User Guide September 21, 2021 Application Manager integrates with Amazon CloudWatch Application Insights. Application Insights identifies and sets up key metrics, logs, and alarms across your application resources and technology stack. Application Insights continually monitors metrics and logs to detect and correlate anomalies and errors. When the system detects errors or anomalies, Application Insights generates CloudWatch Events that you can use to set up notificat ions or take actions. You can enable and view Applicati on Insights on the Overview and Monitoring tabs in Application Manager. For more information about Application Insights, see What is Amazon CloudWatc h Application Insights in the Amazon CloudWatch User Guide. 3171 AWS Systems Manager User Guide Import events from other calendars into Change Calendar September 8, 2021 You can now import the events from a third-party calendar into a calendar in Change Calendar. Previously, each event had to be entered manually into
systems-manager-ug-886
systems-manager-ug.pdf
886
detects errors or anomalies, Application Insights generates CloudWatch Events that you can use to set up notificat ions or take actions. You can enable and view Applicati on Insights on the Overview and Monitoring tabs in Application Manager. For more information about Application Insights, see What is Amazon CloudWatc h Application Insights in the Amazon CloudWatch User Guide. 3171 AWS Systems Manager User Guide Import events from other calendars into Change Calendar September 8, 2021 You can now import the events from a third-party calendar into a calendar in Change Calendar. Previously, each event had to be entered manually into a calendar. After you export a calendar from a supported third-par ty calendar provider to an iCalendar (.ics) file, import it into Change Calendar, and its events are included in the rules for your open or closed calendar in Systems Manager. Supported providers include iCloud Calendar, Google Calendar, and Microsoft Outlook. For more informati on, see Importing and managing events from third- party calendars. 3172 AWS Systems Manager User Guide New tagging and runbook features in Application Tagging enhancements include the ability to add Manager tags to or delete tags from August 31, 2021 a specific resource or all resources in an Applicati on Manager application. Runbook enhancements include the ability to view a filtered list of runbooks for a specific resource type or initiate a runbook on all resources of the same type. For more information, see Working with tags in Applicati on Manager and Working with runbooks in Application Manager. New example: Create a change request using the An example of creating a change request with the AWS August 20, 2021 AWS CLI CLI has been added to the Change Manager chapter. The example uses the sample AWS-HelloWorldChan change geTemplate template and AWS-Hello World runbook : • Creating change requests (AWS CLI) 3173 AWS Systems Manager User Guide New section: Use parameters in Amazon EKS A new section has been added to the Parameter August 19, 2021 Store chapter. This topic is a walkthrough on how to use your parameters in Amazon EKS clusters. For more information, see Use Parameter Store parameters in Amazon Elastic Kubernetes Service. Updated Patch Manager lifecycle hooks Patch Manager now provides a lifecycle hook–the ability August 9, 2021 to run a Systems Manager Command document–for an additional point during a Patch now patching operation. If you schedule instance reboots after running Patch now, you can specify a lifecycle hook to run after the reboot is complete. For more information, see Using 'Patch now' lifecycle hooks and About the AWS-RunPa tchBaselineWithHoo ks SSM document. 3174 AWS Systems Manager User Guide Auto-approvals now supported for Change You can now configure change templates in Manager requests Change Manager to support July 30, 2021 automatic approvals, meaning that users with the necessary IAM permissions can choose to start the change request without requiring additiona l approval. Users who have access to auto-approval templates can still choose to specify approvers if they choose. To help you control your Change Manager processes, approvals are still required for all requests during change freeze periods. For more information, see the following topics: • Creating change templates • Creating change requests • Try out the AWS managed Hello World change template 3175 User Guide July 13, 2021 AWS Systems Manager OpsCenter operational insights OpsCenter automatically analyzes OpsItems in your account and generates insights. An insight includes information to help you understand how many duplicate OpsItems are in your account and which sources are creating them. Insights also provide recommended best practices and Automation runbooks to help you resolve duplicate OpsItems. For more informati on, see Working with operational insights. View stopped instances in Fleet Manager New topic: Authoring Automation runbooks You can now view which July 12, 2021 instances are running and which instances are stopped from the Fleet Manager console. For more information, see AWS Systems Manager Fleet Manager. A new topic, Authoring Automation runbooks, provides guidance and narrative examples of how to author content for custom Automation runbooks. July 8, 2021 3176 AWS Systems Manager User Guide AWS CloudFormation stack and template creation in Application Manager helps you provision and manage Application Manager resources for your applicati July 8, 2021 ons by integrating with CloudFormation. You can create, edit, and delete AWS CloudFormation templates and stacks in Applicati on Manager. Application Manager also includes a template library where you can clone, create, and store templates. Application Manager and CloudFormation display the same informati on about the current status of a stack. Templates and template updates are stored in Systems Manager until you provision the stack, at which time the changes are also displayed in CloudFormation. For more information, see Working with AWS CloudForm ation Stacks in Application Manager. A new topic, Setting up private key auto rotation, provides instructions on
systems-manager-ug-887
systems-manager-ug.pdf
887
ons by integrating with CloudFormation. You can create, edit, and delete AWS CloudFormation templates and stacks in Applicati on Manager. Application Manager also includes a template library where you can clone, create, and store templates. Application Manager and CloudFormation display the same informati on about the current status of a stack. Templates and template updates are stored in Systems Manager until you provision the stack, at which time the changes are also displayed in CloudFormation. For more information, see Working with AWS CloudForm ation Stacks in Application Manager. A new topic, Setting up private key auto rotation, provides instructions on how to strengthen your security posture by configuring SSM Agent to rotate the hybrid environment private key automatically. June 15, 2021 3177 New topic: Automatically rotate private keys for SSM Agent on hybrid instances AWS Systems Manager User Guide Session Manager plugin for the AWS CLI version 1.2.205.0 A new version of the Session Manager plugin for the AWS June 10, 2021 New IAM service-linked role June 9, 2021 CLI has been released. For more information, see Session Manager plugin latest version and release history. When you enable OpsCenter operational insights, Systems Manager creates a new AWS Identity and Access Management (IAM) service-linked role called AWSSSMOpsInsightsS . erviceRolePolicy For more information about this role, see Using roles to create operational insight OpsItems in Systems Manager OpsCenter: AWSSSMOps InsightsServiceRol ePolicy . New Patch Manager troublesh ooting content for Linux A new topic, Errors when June 8, 2021 running AWS-RunPa tchBaseline on Linux, provides descriptions and solutions for several issues that might be encountered when patching managed instances with Linux operating systems. 3178 AWS Systems Manager User Guide Improved support for maintenance window tasks You can now create maintenance window tasks in May 28, 2021 that don't require specified the console without having to targets (console) specify a target in the task if one isn't required. Previousl y, this option was available only when using the AWS CLI or API. This option applies to Automation, AWS Lambda, and AWS Step Functions task types. For example, if you create an Automation task and the resources to update are specified in the Automatio n document parameters, you no longer need to specify a target in the task itself. For more information, see Registering maintenance window tasks without targets, Assign tasks to a maintenan ce window (console), and Schedule automations with maintenance windows. The Automation runbook reference has been moved to a new location. For more information, see Systems Manager Automation runbook reference. May 10, 2021 Automation runbook reference relocated 3179 AWS Systems Manager User Guide AWS Systems Manager Incident Manager launch Incident Manager is an incident management console May 10, 2021 State Manager supports Change Calendar Clone Systems Manager documents designed to help users mitigate and recover from incidents affecting their AWS hosted applications. For more information, see the AWS Systems Manager Incident Manager User Guide. You can now specify Change Calendar names or Amazon Resource Names (ARNs) when you create or update a State Manager association. State Manager applies associati ons only when the change calendar is open, not when it's closed. For more information, see Creating associations and Editing and creating a new version of an association. Using the Systems Manager Documents console, you can now copy content from an existing document to a new document that you can modify. To learn more, see Cloning an SSM document. May 6, 2021 May 4, 2021 3180 AWS Systems Manager User Guide Integrate Security Hub with Explorer and OpsCenter You can now integrate Explorer and OpsCenter April 27, 2021 with AWS Security Hub. Security Hub provides a comprehensive view of your security state in AWS and helps you check your environment against security industry standards and best practices. When integrate d with Explorer, you can view security findings in the Security Hub widget on the Explorer dashboard. When integrated with OpsCenter , you can create OpsItems for Security Hub findings. For more information, see Receiving findings from AWS Security Hub in Explorer and Receiving findings from AWS Security Hub in OpsCenter. We've added a new topic to help users understand the common typographical conventions for the AWS Systems Manager User Guide. For more information, see Document conventions. April 21, 2021 New topic: Document conventions 3181 AWS Systems Manager User Guide Updated topic: About patching applications The topic About patching applications released by April 12, 2021 released by Microsoft on Microsoft on Windows Server Windows Server now clarifies that, in order for Patch Manager to be able to patch applications released by Microsoft on your Windows Server managed instances, the Windows update option Give me updates for other Microsoft products when I update Windows must be allowed on the instance. Automation runbook reference reorganization To help you find the runbooks you need and navigate the