AWS-MigrateSSMDocumentSharingToRAM
Description
The AWS-MigrateSSMDocumentSharingToRAM runbook migrates a Systems Manager document to an
AWS Resource Access Manager (AWS RAM) resource share. The document moves from account-permission sharing, which
you manage with the ModifyDocumentPermission API operation. The migration
preserves the document's existing consumers. You can migrate a single document. You can also
migrate every document in your account that uses account-permission sharing. To migrate all
documents, specify * for the DocumentName parameter.
The runbook automatically rolls back the migration if it fails or is canceled, so your existing sharing configuration is restored.
We recommend that you complete the migration by using the Migrate to RAM page in the AWS Systems Manager console. This migration wizard selects the documents to migrate and sets the runbook parameters for you, which reduces the chance of error. For the steps, see To migrate a document from its Permissions view (console).
Important
After a document is migrated to AWS RAM, the ModifyDocumentPermission and
DescribeDocumentPermission API operations return a 4xx error
for that document. After migration, manage sharing for the document through AWS RAM.
Note
Before you run this runbook, verify that the target document currently uses account-permission sharing and that you have configured the IAM permissions described in this topic.
Note
You can't migrate a document that is shared publicly, because AWS RAM supports private
sharing only. If you specify a publicly shared document for
DocumentName, the runbook fails. If you migrate all documents by specifying
*, the runbook skips publicly shared documents. To migrate a publicly shared
document, first stop sharing it publicly, and then share it with the accounts,
organizational units (OUs), or organization that you want.
Document type
Automation
Owner
Amazon
Parameters
-
DocumentName (Required):
-
Description: (Required) The name of the Systems Manager document to migrate. Specify
*to migrate all documents in the account that use account-permission sharing. -
Type:
String
-
-
AutomationAssumeRole (Required):
-
Description: (Required) The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that allows Systems Manager Automation to perform the actions on your behalf.
-
Type:
String
-
-
OrganizationalUnits (Optional):
-
Description: (Optional) A map of document name to a list of organizational unit IDs (
ou-*) and organization IDs (o-*) to share the document with. Use the*key to set a default for documents that don't have their own entry. When you provide this parameter for a document, the migration grants access to the specified organizational units or organizations instead of enumerating individual accounts. This approach:-
Keeps the resource share small.
-
Automatically grants access to accounts that later join the organizational unit or organization.
-
Helps you stay under the AWS RAM limit of 5,000 principal associations per resource share.
-
-
Type:
StringMap
-
Required IAM permissions
The AutomationAssumeRole parameter requires a trust policy and a permissions
policy. Attach the following trust policy so that Systems Manager Automation can assume the
role.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "ssm.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }
Attach the following permissions policy. The statements are organized into three groups so that you can grant only the permissions you need for your migration.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "Group1AlwaysRequired", "Effect": "Allow", "Action": [ "ssm:DescribeDocumentPermission", "ssm:GetResourcePolicies", "ssm:PutResourcePolicy", "ssm:DeleteResourcePolicy", "ram:ListResources", "ram:GetResourceShares", "ram:PromoteResourceShareCreatedFromPolicy", "ram:DeleteResourceShare" ], "Resource": "*" }, { "Sid": "Group2BulkMigration", "Effect": "Allow", "Action": [ "ssm:ListDocuments", "ssm:StartAutomationExecution", "ssm:GetAutomationExecution" ], "Resource": "*" }, { "Sid": "Group2BulkMigrationPassRole", "Effect": "Allow", "Action": "iam:PassRole", "Resource": "arn:aws:iam::ACCOUNT_ID:role/ROLE_NAME", "Condition": { "StringEquals": { "iam:PassedToService": "ssm.amazonaws.com" } } }, { "Sid": "Group3OrganizationalUnits", "Effect": "Allow", "Action": [ "organizations:DescribeOrganization", "organizations:ListParents" ], "Resource": "*" } ] }
Note
-
Group 1 is always required, for both single-document and bulk migration.
-
Group 2 is required only for bulk migration (when you specify
*forDocumentName). For bulk migration, the runbook lists your documents and starts one automation execution for each document, passing your role to each execution. Scopeiam:PassRoleto theAutomationAssumeRolerole's own ARN as shown. Do not use"Resource": "*"foriam:PassRole. ReplaceACCOUNT_IDandROLE_NAMEwith your account ID and role name. -
Group 3 is required only when you use the
OrganizationalUnitsparameter to share with organizational units or organizations.
How to run this runbook
To migrate a document from its Permissions view (console) (recommended)
The Migrate to RAM page sets the runbook parameters for you.
-
Open the AWS Systems Manager console and, in the navigation pane, choose Documents.
-
Choose the document that you want to migrate.
-
Choose the Details tab.
-
In the Permissions section, choose Migrate to RAM. Systems Manager opens the Migrate to RAM page, which helps you set the parameters for the
AWS-MigrateSSMDocumentSharingToRAMrunbook. -
For Documents to migrate, select the documents to migrate. Select individual documents, or choose All documents to migrate every document in the account that uses account-permission sharing. This sets the
DocumentNameparameter. -
For AutomationAssumeRole, choose the IAM role that Systems Manager Automation assumes to run the migration. This sets the
AutomationAssumeRoleparameter. -
(Optional) For Organizational units, add an organization ID or organizational unit (OU) ID to share the documents with. This sets the
OrganizationalUnitsparameter. -
Choose Start migration to run the
AWS-MigrateSSMDocumentSharingToRAMrunbook.
To run the automation (console)
-
Open the AWS Systems Manager console and, in the navigation pane, choose Automation.
-
Choose Execute automation.
-
In the Automation document list, choose
AWS-MigrateSSMDocumentSharingToRAM. -
For the input parameters, enter values for
DocumentNameandAutomationAssumeRole, and optionallyOrganizationalUnits. -
Choose Execute.
To run the automation (AWS CLI)
aws ssm start-automation-execution \ --document-name AWS-MigrateSSMDocumentSharingToRAM \ --parameters '{"DocumentName":["MyDocument"],"AutomationAssumeRole":["arn:aws:iam::ACCOUNT_ID:role/ROLE_NAME"]}'
Note
Running this runbook uses Systems Manager Automation and incurs charges. For more information,
see AWS Systems Manager
pricing