How Amazon QLDB works with IAM - Amazon Quantum Ledger Database (Amazon QLDB)

How Amazon QLDB works with IAM

Before you use AWS Identity and Access Management (IAM) to manage access to QLDB, you should understand what IAM features are available to use with QLDB. To get a high-level view of how QLDB and other AWS services work with IAM, see AWS services that work with IAM in the IAM User Guide.

QLDB identity-based policies

With IAM identity-based policies, you can specify allowed or denied actions and resources in addition to the conditions under which actions are allowed or denied. QLDB 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

The Action element of an IAM identity-based policy describes the specific action or actions that will be allowed or denied by the policy. Policy actions usually have the same name as the associated AWS API operation. The action is used in a policy to grant permissions to perform the associated operation.

Policy actions in QLDB use a qldb: prefix before the action. For example, to grant someone permission to describe a QLDB ledger with the QLDB DescribeLedger API operation, you include the qldb:DescribeLedger action in their policy. Policy statements must include either an Action element or a NotAction element. QLDB 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": [ "qldb:CreateLedger", "qldb:UpdateLedger"

You can specify multiple actions using wildcards (*). For example, to specify all actions that begin with the word Describe, include the following action.

"Action": "qldb:Describe*"

To interact with the QLDB transactional data API by executing PartiQL statements on a ledger, you must grant permission to the SendCommand action as follows.

"Action": "qldb:SendCommand"

To see a list of QLDB actions, see Actions defined by Amazon QLDB in the IAM User Guide.

Resources

The Resource element specifies the object or objects to which the action applies. Statements must include either a Resource or a NotResource element. You specify a resource using an ARN or using the wildcard (*) to indicate that the statement applies to all resources.

QLDB defines the following resource types and their ARNs.

Resource Type ARN
ledger arn:${Partition}:qldb:${Region}:${Account}:ledger/${LedgerName}
stream arn:${Partition}:qldb:${Region}:${Account}:stream/${LedgerName}/${StreamId}

For more information about the format of ARNs, see Amazon Resource Names (ARNs).

For example, to specify the exampleLedger resource in your statement, use the following ARN.

"Resource": "arn:aws:qldb:us-east-1:123456789012:ledger/exampleLedger"

To specify all ledgers that belong to a specific account, use the wildcard (*).

"Resource": "arn:aws:qldb:us-east-1:123456789012:ledger/*"

Some QLDB actions, such as those for creating resources, cannot be performed on a specific resource. In those cases, you must use the wildcard (*).

"Resource": "*"

To specify multiple resources in a single statement, separate the ARNs with commas.

"Resource": [ "arn:aws:qldb:us-east-1:123456789012:ledger/exampleLedger1", "arn:aws:qldb:us-east-1:123456789012:ledger/exampleLedger2"

To see a list of QLDB resource types and their ARNs, see Resources defined by Amazon QLDB in the IAM User Guide. To learn with which actions you can specify the ARN of each resource, see Actions defined by Amazon QLDB.

Condition keys

QLDB does not provide any service-specific condition keys, but it does support using some global condition keys. To see all AWS global condition keys, see AWS global condition context keys in the IAM User Guide.

Examples

To view examples of QLDB identity-based policies, see Amazon QLDB identity-based policy examples.

QLDB resource-based policies

QLDB does not support resource-based policies.

Authorization based on QLDB tags

You can attach tags to QLDB resources or pass tags in a request to QLDB. To control access based on tags, you provide tag information in the condition element of a policy using the aws:ResourceTag/key-name, aws:RequestTag/key-name, or aws:TagKeys condition keys. For more information about tagging QLDB resources, see Tagging Amazon QLDB resources.

To view an example of an identity-based policy for limiting access to a resource based on the tags on that resource, see Updating QLDB ledgers based on tags.

QLDB IAM roles

An IAM role is an entity within your AWS account that has specific permissions.

Using temporary credentials with QLDB

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 AWS Security Token Service (AWS STS) API operations such as AssumeRole or GetFederationToken.

QLDB supports using temporary credentials.

Service-linked roles

Service-linked roles allow AWS services to access resources in other services to complete an action on your behalf. Service-linked roles appear in your IAM account and are owned by the service. An IAM administrator can view but cannot edit the permissions for service-linked roles.

QLDB does not support service-linked roles.

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 appear in your IAM account and are owned by the account. This means that an IAM administrator can change the permissions for this role. However, doing so might break the functionality of the service.

QLDB supports service roles for the ExportJournalToS3 and StreamJournalToKinesis API operations, as described in the following section.

Choosing an IAM role in QLDB

When you export or stream journal blocks in QLDB, you must choose a role to allow QLDB to write objects to the given destination on your behalf. If you have previously created a service role, then QLDB provides you with a list of roles to choose from. Make sure that you choose a role that allows access to write into your specified Amazon S3 bucket for an export, or to your specified Amazon Kinesis Data Streams resource for a stream. For more information, see Journal export permissions in QLDB or Stream permissions in QLDB.