lifecycle_policies
Creates, updates, deletes or gets a lifecycle_policy resource or lists lifecycle_policies in a region
Overview
| Name | lifecycle_policies |
| Type | Resource |
| Description | Resource schema for AWS::ImageBuilder::LifecyclePolicy |
| Id | awscc.imagebuilder.lifecycle_policies |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
arn | string | The Amazon Resource Name (ARN) of the lifecycle policy. |
name | string | The name of the lifecycle policy. |
description | string | The description of the lifecycle policy. |
status | string | The status of the lifecycle policy. |
execution_role | string | The execution role of the lifecycle policy. |
resource_type | string | The resource type of the lifecycle policy. |
policy_details | array | The policy details of the lifecycle policy. |
resource_selection | object | The resource selection of the lifecycle policy. |
tags | object | The tags associated with the lifecycle policy. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
arn | string | The Amazon Resource Name (ARN) of the lifecycle policy. |
region | string | AWS region. |
For more information, see AWS::ImageBuilder::LifecyclePolicy.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | lifecycle_policies | INSERT | Name, ExecutionRole, ResourceType, PolicyDetails, ResourceSelection, region |
delete_resource | lifecycle_policies | DELETE | Identifier, region |
update_resource | lifecycle_policies | UPDATE | Identifier, PatchDocument, region |
list_resources | lifecycle_policies_list_only | SELECT | region |
get_resource | lifecycle_policies | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual lifecycle_policy.
SELECT
region,
arn,
name,
description,
status,
execution_role,
resource_type,
policy_details,
resource_selection,
tags
FROM awscc.imagebuilder.lifecycle_policies
WHERE
region = 'us-east-1' AND
Identifier = '{{ arn }}';
Lists all lifecycle_policies in a region.
SELECT
region,
arn
FROM awscc.imagebuilder.lifecycle_policies_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new lifecycle_policy resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.imagebuilder.lifecycle_policies (
Name,
ExecutionRole,
ResourceType,
PolicyDetails,
ResourceSelection,
region
)
SELECT
'{{ name }}',
'{{ execution_role }}',
'{{ resource_type }}',
'{{ policy_details }}',
'{{ resource_selection }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.imagebuilder.lifecycle_policies (
Name,
Description,
Status,
ExecutionRole,
ResourceType,
PolicyDetails,
ResourceSelection,
Tags,
region
)
SELECT
'{{ name }}',
'{{ description }}',
'{{ status }}',
'{{ execution_role }}',
'{{ resource_type }}',
'{{ policy_details }}',
'{{ resource_selection }}',
'{{ tags }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: lifecycle_policy
props:
- name: name
value: '{{ name }}'
- name: description
value: '{{ description }}'
- name: status
value: '{{ status }}'
- name: execution_role
value: '{{ execution_role }}'
- name: resource_type
value: '{{ resource_type }}'
- name: policy_details
value:
- action:
type: '{{ type }}'
include_resources:
amis: '{{ amis }}'
containers: '{{ containers }}'
snapshots: '{{ snapshots }}'
filter:
type: '{{ type }}'
value: '{{ value }}'
unit: '{{ unit }}'
retain_at_least: '{{ retain_at_least }}'
exclusion_rules:
tag_map: {}
amis:
is_public: '{{ is_public }}'
regions:
- '{{ regions[0] }}'
shared_accounts:
- '{{ shared_accounts[0] }}'
last_launched:
value: '{{ value }}'
unit: null
tag_map: {}
- name: resource_selection
value:
recipes:
- name: '{{ name }}'
semantic_version: '{{ semantic_version }}'
tag_map: {}
- name: tags
value: {}
UPDATE example
Use the following StackQL query and manifest file to update a lifecycle_policy resource, using stack-deploy.
/*+ update */
UPDATE awscc.imagebuilder.lifecycle_policies
SET PatchDocument = string('{{ {
"Description": description,
"Status": status,
"ExecutionRole": execution_role,
"ResourceType": resource_type,
"PolicyDetails": policy_details,
"ResourceSelection": resource_selection,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ arn }}';
DELETE example
/*+ delete */
DELETE FROM awscc.imagebuilder.lifecycle_policies
WHERE
Identifier = '{{ arn }}' AND
region = 'us-east-1';
Permissions
To operate on the lifecycle_policies resource, the following permissions are required:
- Create
- Update
- Read
- Delete
- List
iam:PassRole,
imagebuilder:CreateLifecyclePolicy,
imagebuilder:GetLifecyclePolicy,
imagebuilder:TagResource
iam:PassRole,
imagebuilder:GetLifecyclePolicy,
imagebuilder:UpdateLifecyclePolicy,
imagebuilder:TagResource,
imagebuilder:UntagResource
imagebuilder:GetLifecyclePolicy
imagebuilder:GetLifecyclePolicy,
imagebuilder:DeleteLifecyclePolicy,
imagebuilder:UntagResource
imagebuilder:ListLifecyclePolicies