Skip to main content

aliases

Creates, updates, deletes or gets an alias resource or lists aliases in a region

Overview

Namealiases
TypeResource
Description
The AWS::KMS::Alias resource specifies a display name for a KMS key. You can use an alias to identify a KMS key in the KMS console, in the DescribeKey operation, and in cryptographic operations, such as Decrypt and GenerateDataKey.Adding, deleting, or updating an alias can allow or deny permission to the KMS key. For details, see ABAC for in the Developer Guide.
Using an alias to refer to a KMS key can help you simplify key management. For example, an alias in your code can be associated with different KMS keys in different AWS-Regions. For more information, see Using aliases in the Developer Guide.
When specifying an alias, observe the following rules.
+ Each alias is associated with one KMS key, but multiple aliases can be associated with the same KMS key.
+ The alias and its associated KMS key must be in the same AWS-account and Region.
+ The alias name must be unique in the AWS-account and Region. However, you can create aliases with the same name in different AWS-Regions. For example, you can have an alias/projectKey in multiple Regions, each of which is associated with a KMS key in its Region.
+ Each alias name must begin with alias/ followed by a name, such as alias/exampleKey. The alias name can contain only alphanumeric characters, forward slashes (/), underscores (_), and dashes (-). Alias names cannot begin with alias/aws/. That alias name prefix is reserved for .
Regions
KMS CloudFormation resources are available in all AWS-Regions in which KMS and CFN are supported.
Idawscc.kms.aliases

Fields

NameDatatypeDescription
target_key_idstring
Associates the alias with the specified [](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk). The KMS key must be in the same AWS-account and Region.A valid key ID is required. If you supply a null or empty string value, this operation returns an error.
For help finding the key ID and ARN, see Finding the key ID and ARN in the Developer Guide.
Specify the key ID or the key ARN of the KMS key.
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.
alias_namestring
Specifies the alias name. This value must begin with alias/ followed by a name, such as alias/ExampleAlias.If you change the value of the AliasName property, the existing alias is deleted and a new alias is created for the specified KMS key. This change can disrupt applications that use the alias. It can also allow or deny access to a KMS key affected by attribute-based access control (ABAC).
The alias must be string of 1-256 characters. It can contain only alphanumeric characters, forward slashes (/), underscores (_), and dashes (-). The alias name cannot begin with alias/aws/. The alias/aws/ prefix is reserved for [](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk).
regionstringAWS region.

For more information, see AWS::KMS::Alias.

Methods

NameResourceAccessible byRequired Params
create_resourcealiasesINSERTAliasName, TargetKeyId, region
delete_resourcealiasesDELETEIdentifier, region
update_resourcealiasesUPDATEIdentifier, PatchDocument, region
list_resourcesaliases_list_onlySELECTregion
get_resourcealiasesSELECTIdentifier, region

SELECT examples

Gets all properties from an individual alias.

SELECT
region,
target_key_id,
alias_name
FROM awscc.kms.aliases
WHERE
region = '{{ region }}' AND
Identifier = '{{ alias_name }}';

INSERT example

Use the following StackQL query and manifest file to create a new alias resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.kms.aliases (
TargetKeyId,
AliasName,
region
)
SELECT
'{{ target_key_id }}',
'{{ alias_name }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

UPDATE example

Use the following StackQL query and manifest file to update a alias resource, using stack-deploy.

/*+ update */
UPDATE awscc.kms.aliases
SET PatchDocument = string('{{ {
"TargetKeyId": target_key_id
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ alias_name }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

DELETE example

/*+ delete */
DELETE FROM awscc.kms.aliases
WHERE
Identifier = '{{ alias_name }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

Additional Parameters

Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:

ParameterDescription
ClientToken
A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.
A client token is valid for 36 hours once used.
After that, a resource request with the same client token is treated as a new request.
If you do not specify a client token, one is generated for inclusion in the request.
RoleArn
The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.
If you do not specify a role, a temporary session is created using your AWS user credentials.
TypeVersionId
For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used.

Permissions

To operate on the aliases resource, the following permissions are required:

kms:ListAliases