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 | aws.imagebuilder.lifecycle_policies |
Fields
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. |
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | Name, ExecutionRole, ResourceType, PolicyDetails, ResourceSelection, region |
delete_resource | DELETE | data__Identifier, region |
update_resource | UPDATE | data__Identifier, data__PatchDocument, region |
list_resources | SELECT | region |
get_resource | SELECT | data__Identifier, region |
SELECT
examples
Gets all lifecycle_policies
in a region.
SELECT
region,
arn,
name,
description,
status,
execution_role,
resource_type,
policy_details,
resource_selection,
tags
FROM aws.imagebuilder.lifecycle_policies
WHERE region = 'us-east-1';
Gets all properties from an individual lifecycle_policy
.
SELECT
region,
arn,
name,
description,
status,
execution_role,
resource_type,
policy_details,
resource_selection,
tags
FROM aws.imagebuilder.lifecycle_policies
WHERE region = 'us-east-1' AND data__Identifier = '<Arn>';
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 aws.imagebuilder.lifecycle_policies (
Name,
ExecutionRole,
ResourceType,
PolicyDetails,
ResourceSelection,
region
)
SELECT
'{{ Name }}',
'{{ ExecutionRole }}',
'{{ ResourceType }}',
'{{ PolicyDetails }}',
'{{ ResourceSelection }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.imagebuilder.lifecycle_policies (
Name,
Description,
Status,
ExecutionRole,
ResourceType,
PolicyDetails,
ResourceSelection,
Tags,
region
)
SELECT
'{{ Name }}',
'{{ Description }}',
'{{ Status }}',
'{{ ExecutionRole }}',
'{{ ResourceType }}',
'{{ PolicyDetails }}',
'{{ ResourceSelection }}',
'{{ 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: ExecutionRole
value: '{{ ExecutionRole }}'
- name: ResourceType
value: '{{ ResourceType }}'
- name: PolicyDetails
value:
- Action:
Type: '{{ Type }}'
IncludeResources:
Amis: '{{ Amis }}'
Containers: '{{ Containers }}'
Snapshots: '{{ Snapshots }}'
Filter:
Type: '{{ Type }}'
Value: '{{ Value }}'
Unit: '{{ Unit }}'
RetainAtLeast: '{{ RetainAtLeast }}'
ExclusionRules:
TagMap: {}
Amis:
IsPublic: '{{ IsPublic }}'
Regions:
- '{{ Regions[0] }}'
SharedAccounts:
- '{{ SharedAccounts[0] }}'
LastLaunched:
Value: '{{ Value }}'
Unit: null
TagMap: {}
- name: ResourceSelection
value:
Recipes:
- Name: '{{ Name }}'
SemanticVersion: '{{ SemanticVersion }}'
TagMap: {}
- name: Tags
value: {}
DELETE
example
/*+ delete */
DELETE FROM aws.imagebuilder.lifecycle_policies
WHERE data__Identifier = '<Arn>'
AND region = 'us-east-1';
Permissions
To operate on the lifecycle_policies
resource, the following permissions are required:
Create
iam:PassRole,
imagebuilder:CreateLifecyclePolicy,
imagebuilder:GetLifecyclePolicy,
imagebuilder:TagResource
Update
iam:PassRole,
imagebuilder:GetLifecyclePolicy,
imagebuilder:UpdateLifecyclePolicy
Read
imagebuilder:GetLifecyclePolicy
Delete
imagebuilder:GetLifecyclePolicy,
imagebuilder:DeleteLifecyclePolicy,
imagebuilder:UnTagResource
List
imagebuilder:ListLifecyclePolicies