Skip to content

KMS  >  Operations  >  revoke_grant

revoke_grant

Operation

revoke_grant async

revoke_grant(request: RevokeGrantInput | RevokeGrantInputDict, /, *, plugins: list[Plugin] | None = None) -> RevokeGrantOutput
revoke_grant(*, plugins: list[Plugin] | None = None, **kwargs: Unpack[RevokeGrantInputDict]) -> RevokeGrantOutput

Deletes the specified grant. You revoke a grant to terminate the permissions that the grant allows. For more information, see Retiring and revoking grants in the Key Management Service Developer Guide .

When you create, retire, or revoke a grant, there might be a brief delay, usually less than five minutes, until the grant is available throughout KMS. This state is known as eventual consistency. For details, see Eventual consistency in the Key Management Service Developer Guide .

For detailed information about grants, including grant terminology, see Grants in KMS in the Key Management Service Developer Guide . For examples of creating grants in several programming languages, see Use CreateGrant with an Amazon Web Services SDK or CLI.

Cross-account use: Yes. To perform this operation on a KMS key in a different Amazon Web Services account, specify the key ARN in the value of the KeyId parameter.

Required permissions: kms:RevokeGrant (key policy).

Related operations:

  • CreateGrant

  • ListGrants

  • ListRetirableGrants

  • RetireGrant

Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency.

Parameters:

Name Type Description Default
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
RevokeGrantOutput

An instance of RevokeGrantOutput.

Input

Pass the input fields as keyword arguments, or pass a model or dictionary as the first positional argument. Pass plugins separately as a keyword argument.

Model

RevokeGrantInput dataclass

Bases: _SerdeShape

Dataclass for RevokeGrantInput structure.

Attributes
dry_run class-attribute instance-attribute
dry_run: bool | None = ...

Checks if your request will succeed. DryRun is an optional parameter.

To learn more about how to use this parameter, see Testing your permissions in the Key Management Service Developer Guide.

grant_id class-attribute instance-attribute
grant_id: str | None = ...

Identifies the grant to revoke. To get the grant ID, use CreateGrant, ListGrants, or ListRetirableGrants.

key_id class-attribute instance-attribute
key_id: str | None = ...

A unique identifier for the KMS key associated with the grant. To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

Specify the key ID or key ARN of the KMS key. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN.

For example:

  • Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab

  • Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

Dictionaries

RevokeGrantInputDict

Bases: TypedDict

Dictionary form of RevokeGrantInput.

Attributes
dry_run instance-attribute
dry_run: bool | None

Checks if your request will succeed. DryRun is an optional parameter.

To learn more about how to use this parameter, see Testing your permissions in the Key Management Service Developer Guide.

grant_id instance-attribute
grant_id: Required[str]

Identifies the grant to revoke. To get the grant ID, use CreateGrant, ListGrants, or ListRetirableGrants.

key_id instance-attribute
key_id: Required[str]

A unique identifier for the KMS key associated with the grant. To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

Specify the key ID or key ARN of the KMS key. To specify a KMS key in a different Amazon Web Services account, you must use the key ARN.

For example:

  • Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab

  • Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

Output

RevokeGrantOutput dataclass

Bases: _SerdeShape

Dataclass for RevokeGrantOutput structure.

Attributes

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.