aliases
Creates, updates, deletes or gets an alias resource or lists aliases in a region
Overview
| Name | aliases |
| Type | Resource |
| Description | The Adding, deleting, or updating an alias can allow or deny permission to the KMS key. For details, see ABAC for in the Developer Guide. |
| Id | awscc.kms.aliases |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
target_key_id | string | 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-1234567890abTo get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. |
alias_name | string | Specifies the alias name. This value must begin with If you change the value of the |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
alias_name | string | Specifies the alias name. This value must begin with If you change the value of the |
region | string | AWS region. |
For more information, see AWS::KMS::Alias.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | aliases | INSERT | AliasName, TargetKeyId, region |
delete_resource | aliases | DELETE | Identifier, region |
update_resource | aliases | UPDATE | Identifier, PatchDocument, region |
list_resources | aliases_list_only | SELECT | region |
get_resource | aliases | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
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 }}';
Lists all aliases in a region.
SELECT
region,
alias_name
FROM awscc.kms.aliases_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new alias resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ 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
;
/*+ 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
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: alias
props:
- name: target_key_id
value: '{{ target_key_id }}'
- name: alias_name
value: '{{ alias_name }}'
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:
| Parameter | Description |
|---|---|
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:
- Read
- Create
- Update
- List
- Delete
kms:ListAliases
kms:CreateAlias
kms:UpdateAlias
kms:ListAliases
kms:DeleteAlias