How Amazon Systems Manager works with IAM
Before you use Amazon Identity and Access Management (IAM) to manage access to Amazon Systems Manager, you should understand what IAM features are available to use with Systems Manager. To get a high-level view of how Systems Manager and other Amazon Web Services services work with IAM, see Amazon Web Services services that work with IAM in the IAM User Guide.
Topics
Systems Manager identity-based policies
With IAM identity-based policies, you can specify allowed or denied actions and resources and the conditions under which actions are allowed or denied. Systems Manager supports specific actions, resources, and condition keys. To learn about all of the elements that you use in a JSON policy, see IAM JSON policy elements reference in the IAM User Guide.
Actions
Administrators can use Amazon JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions.
The Action
element of a JSON policy describes the
actions that you can use to allow or deny access in a policy. Policy
actions usually have the same name as the associated Amazon API operation. There are some exceptions, such as permission-only
actions that don't have a matching API operation. There are also some operations that require multiple actions in a policy.
These additional actions are called dependent actions.
Include actions in a policy to grant permissions to perform the associated operation.
Policy actions in Systems Manager use the following prefix before the
action: ssm:
. For example, to grant someone
permission to create a Systems Manager parameter (SSM parameter) with the
Systems Manager PutParameter
API operation, you include the
ssm:PutParameter
action in their policy. Policy statements
must include either an Action
or NotAction
element. Systems Manager defines its own set of actions that describe tasks
that you can perform with this service.
To specify multiple actions in a single statement, separate them with commas as follows:
"Action": [ "ssm:action1", "ssm:action2" ]
Note
The following capabilities of Amazon Systems Manager use different prefixes before actions.
-
Amazon AppConfig uses the prefix
appconfig:
before actions. -
Incident Manager uses the prefix
ssm-incidents:
orssm-contacts:
before actions. -
Systems Manager GUI Connect uses the prefix
ssm-guiconnect:
before actions. -
Quick Setup uses the prefix
ssm-quicksetup:
before actions.
You can specify multiple actions using wildcards (*). For example, to
specify all actions that begin with the word Describe
, include
the following action:
"Action": "ssm:Describe*"
To see a list of Systems Manager actions, see Actions Defined by Amazon Systems Manager in the Service Authorization Reference.
Resources
Administrators can use Amazon JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions.
The Resource
JSON policy element specifies the object or objects to which the action applies. Statements must include either a
Resource
or a NotResource
element. As a best practice, specify a resource using its Amazon Resource Name (ARN). You can do this for actions that support a
specific resource type, known as resource-level permissions.
For actions that don't support resource-level permissions, such as listing operations, use a wildcard (*) to indicate that the statement applies to all resources.
"Resource": "*"
For example, the Systems Manager maintenance window resource has the following ARN format.
arn:aws-cn:ssm:
region
:account-id
:maintenancewindow/window-id
To specify the mw-0c50858d01EXAMPLE maintenance windows in your statement in the Region, you would use an ARN similar to the following.
"Resource": "arn:aws-cn:ssm:us-west-2:
123456789012
:maintenancewindow/mw-0c50858d01EXAMPLE"
To specify all maintenance windows that belong to a specific account, use the wildcard (*).
"Resource": "arn:aws-cn:ssm:
region
:123456789012
:maintenancewindow/*"
For Parameter Store
API operations, you can provide or restrict
access to all parameters in one level of a hierarchy by using hierarchical
names and Amazon Identity and Access Management (IAM) policies as follows.
"Resource": "arn:aws-cn:ssm:
region
:123456789012:parameter/Dev/ERP/Oracle/*"
Some Systems Manager actions, such as those for creating resources, can't be performed on a specific resource. In those cases, you must use the wildcard (*).
"Resource": "*"
Some Systems Manager API operations accept multiple resources. To specify multiple resources in a single statement, separate their ARNs with commas as follows.
"Resource": [ "resource1", "resource2"
Note
Most Amazon Web Services services treat a colon (:) or a forward slash (/) as the same character in ARNs. However, Systems Manager requires an exact match in resource patterns and rules. When creating event patterns, be sure to use the correct ARN characters so that they match the resource's ARN.
The table below describes the ARN formats for the resource types supported by Systems Manager.
Note
Note the following exceptions to ARN formats.
-
The following capabilities of Amazon Systems Manager use different prefixes before actions.
-
Amazon AppConfig uses the prefix
appconfig:
before actions. -
Incident Manager uses the prefix
ssm-incidents:
orssm-contacts:
before actions. -
Systems Manager GUI Connect uses the prefix
ssm-guiconnect
before actions.
-
-
Documents and automation definition resources that are owned by Amazon, as well as public parameters that are provided by both Amazon and third-party sources, do not include account IDs in their ARN formats. For example:
-
The SSM document
AWS-RunPatchBaseline
:arn:aws:ssm:us-east-2::document/AWS-RunPatchBaseline
-
The automation runbook
AWS-ConfigureMaintenanceWindows
:arn:aws:ssm:us-east-2::automation-definition/AWS-ConfigureMaintenanceWindows
-
The public parameter
/aws/service/bottlerocket/aws-ecs-1-nvidia/x86_64/1.13.4/image_version
:arn:aws:ssm:us-east-2::parameter/aws/service/bottlerocket/aws-ecs-1-nvidia/x86_64/1.13.4/image_version
For more information about these three resource types, see the following topics:
-
-
Quick Setup uses the prefix
ssm-quicksetup:
before actions.
Resource type | ARN format |
---|---|
Application (Amazon AppConfig) | arn:aws-cn:appconfig:region :account-id :application/application-id |
Association | arn:aws-cn:ssm:region :account-id :association/association-id |
Automation execution | arn:aws-cn:ssm:region :account-id :automation-execution/automation-execution-id |
Automation definition (with version subresource) |
arn:aws-cn:ssm: |
Configuration profile (Amazon AppConfig) | arn:aws-cn:appconfig:region :account-id :application/application-id /configurationprofile/configurationprofile-id |
Contact (Incident Manager) |
arn:aws-cn:ssm-contacts: |
Deployment strategy (Amazon AppConfig) | arn:aws-cn:appconfig:region :account-id :deploymentstrategy/deploymentstrategy-id |
Document |
arn:aws-cn:ssm: |
Environment (Amazon AppConfig) | arn:aws-cn:appconfig:region :account-id :application/application-id /environment/environment-id |
Incident |
arn:aws-cn:ssm-incidents: |
Maintenance window |
arn:aws-cn:ssm: |
Managed node |
arn:aws-cn:ssm: |
Managed node inventory | arn:aws-cn:ssm:region :account-id :managed-instance-inventory/managed-node-id |
OpsItem | arn:aws-cn:ssm:region :account-id :opsitem/OpsItem-id |
Parameter |
A one-level parameter:
A parameter named with a hierarchical construction:
|
Patch baseline |
arn:aws-cn:ssm: |
Response plan |
arn:aws-cn:ssm-incidents: |
Session |
arn:aws-cn:ssm: |
All Systems Manager resources |
arn:aws-cn:ssm:* |
All Systems Manager resources owned by the specified Amazon Web Services account in the specified Amazon Web Services Region |
arn:aws-cn:ssm: |
For automation definitions, Systems Manager supports a
second-level resource, version ID. In Amazon, these
second-level resources are known as subresources.
Specifying a version subresource for an automation definition resource
allows you to provide access to certain versions of an automation
definition. For example, you might want to ensure that only the latest
version of an automation definition is used in your node management.
To organize and manage parameters, you can create names for
parameters with a hierarchical construction. With hierarchical construction,
a parameter name can include a path that you define by using forward
slashes. You can name a parameter resource with a maximum of fifteen levels.
We suggest that you create hierarchies that reflect an existing hierarchical
structure in your environment. For more information, see Creating Systems Manager parameters.
In most cases, the session ID is constructed using the ID of
the account user who started the session, plus an alphanumeric suffix. For
example:
arn:aws:us-east-2:111122223333:session/JohnDoe-1a2b3c4sEXAMPLE
However, if the user ID isn't available, the ARN is constructed this way instead:
arn:aws:us-east-2:111122223333:session/session-1a2b3c4sEXAMPLE
For more information about the format of ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference.
For a list of Systems Manager resource types and their ARNs, see Resources Defined by Amazon Systems Manager in the Service Authorization Reference. To learn with which actions you can specify the ARN of each resource, see Actions Defined by Amazon Systems Manager.
Condition keys for Systems Manager
Administrators can use Amazon JSON policies to specify who has access to what. That is, which principal can perform actions on what resources, and under what conditions.
The Condition
element (or Condition
block) lets you specify conditions in which a
statement is in effect. The Condition
element is optional. You can create
conditional expressions that use condition
operators, such as equals or less than, to match the condition in the
policy with values in the request.
If you specify multiple Condition
elements in a statement, or
multiple keys in a single Condition
element, Amazon evaluates them using
a logical AND
operation. If you specify multiple values for a single
condition key, Amazon evaluates the condition using a logical OR
operation. All of the conditions must be met before the statement's permissions are
granted.
You can also use placeholder variables when you specify conditions. For example, you can grant an IAM user permission to access a resource only if it is tagged with their IAM user name. For more information, see IAM policy elements: variables and tags in the IAM User Guide.
Amazon supports global condition keys and service-specific condition keys. To see all Amazon global condition keys, see Amazon global condition context keys in the IAM User Guide.
To see a list of Systems Manager condition keys, see Condition Keys for Amazon Systems Manager in the Service Authorization Reference. To learn with which actions and resources you can use a condition key, see Actions Defined by Amazon Systems Manager.
For information about using the ssm:resourceTag/*
condition
key, see the following topics:
For information about using the ssm:Recursive
,
ssm:Policies
, and ssm:Overwrite
condition
keys, see Preventing access to Parameter Store
API operations.
Examples
To view examples of Systems Manager identity-based policies, see Amazon Systems Manager identity-based policy examples.
Systems Manager resource-based policies
Other Amazon Web Services services, such as Amazon Simple Storage Service (Amazon S3), support resource-based permissions policies. For example, you can attach a permissions policy to an S3 bucket to manage access permissions to that bucket.
Systems Manager doesn't support resource-based policies.
Authorization based on Systems Manager tags
You can attach tags to Systems Manager resources or pass tags in a request to
Systems Manager. To control access based on tags, you provide tag information
in the condition element of a policy using the
ssm:resourceTag/
,
key-name
aws:ResourceTag/
,
key-name
aws:RequestTag/
, or
key-name
aws:TagKeys
condition keys. You can add tags to the following
resource types when you create or update them:
-
Document
-
Managed node
-
Maintenance window
-
Parameter
-
Patch baseline
-
OpsItem
For information about tagging Systems Manager resources, see Tagging Systems Manager resources.
To view an example identity-based policy for limiting access to a resource based on the tags on that resource, see Viewing Systems Manager documents based on tags.
Systems Manager IAM roles
An IAM role is an entity within your Amazon Web Services account that has specific permissions.
Using temporary credentials with Systems Manager
You can use temporary credentials to sign in with federation, assume an IAM role, or to assume a cross-account role. You obtain temporary security credentials by calling Amazon Security Token Service (Amazon STS) API operations such as AssumeRole or GetFederationToken.
Systems Manager supports using temporary credentials.
Service-linked roles
Service-linked roles allow Amazon Web Services services to access resources in other services to complete an action on your behalf. Service-linked roles are listed in your IAM account and are owned by the service. An administrator can view but not edit the permissions for service-linked roles.
Systems Manager supports service-linked roles. For details about creating or managing Systems Manager service-linked roles, see Using service-linked roles for Systems Manager.
Service roles
This feature allows a service to assume a service role on your behalf. This role allows the service to access resources in other services to complete an action on your behalf. Service roles are displayed in your IAM account and are owned by the account. This means that an administrator can change the permissions for this role. However, doing so might break the functionality of the service.
Systems Manager supports service roles.
Choosing an IAM role in Systems Manager
For Systems Manager to interact with your managed nodes, you must choose a role to allow Systems Manager to access nodes on your behalf. If you have previously created a service role or service-linked role, then Systems Manager provides you with a list of roles to choose from. It's important to choose a role that allows access to start and stop managed nodes.
To access EC2 instances, you must configure instance permissions. For information, see Configure instance permissions required for Systems Manager.
To access non-EC2 nodes in a hybrid and multicloud, the role your Amazon Web Services account needs is an IAM service role. For information, see Create the IAM service role required for Systems Manager in hybrid and multicloud environments.
An Automation workflow can be initiated under the context of a service role (or assume role). This allows the service to perform actions on your behalf. If you don't specify an assume role, Automation uses the context of the user who invoked the execution. However, certain situations require that you specify a service role for Automation. For more information, see Configuring a service role (assume role) access for automations.
Amazon Systems Manager managed policies
Amazon addresses many common use cases by providing standalone IAM policies that are created and administered by Amazon. These Amazon managed policies grant necessary permissions for common use cases so you can avoid having to investigate which permissions are needed. (You can also create your own custom IAM policies to allow permissions for Systems Manager actions and resources.)
For more information about managed policies for Systems Manager, see Amazon managed policies for Amazon Systems Manager
For general information about managed policies, see Amazon managed policies in the IAM User Guide.