1. Packages
  2. AWS
  3. API Docs
  4. imagebuilder
  5. LifecyclePolicy
AWS v6.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

aws.imagebuilder.LifecyclePolicy

Explore with Pulumi AI

Manages an Image Builder Lifecycle Policy.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const current = aws.getRegion({});
const currentGetPartition = aws.getPartition({});
const example = new aws.iam.Role("example", {
    assumeRolePolicy: JSON.stringify({
        Version: "2012-10-17",
        Statement: [{
            Action: "sts:AssumeRole",
            Effect: "Allow",
            Principal: {
                Service: currentGetPartition.then(currentGetPartition => `imagebuilder.${currentGetPartition.dnsSuffix}`),
            },
        }],
    }),
    name: "example",
});
const exampleRolePolicyAttachment = new aws.iam.RolePolicyAttachment("example", {
    policyArn: currentGetPartition.then(currentGetPartition => `arn:${currentGetPartition.partition}:iam::aws:policy/service-role/EC2ImageBuilderLifecycleExecutionPolicy`),
    role: example.name,
});
const exampleLifecyclePolicy = new aws.imagebuilder.LifecyclePolicy("example", {
    name: "name",
    description: "Example description",
    executionRole: example.arn,
    resourceType: "AMI_IMAGE",
    policyDetails: [{
        action: {
            type: "DELETE",
        },
        filter: {
            type: "AGE",
            value: 6,
            retainAtLeast: 10,
            unit: "YEARS",
        },
    }],
    resourceSelection: {
        tagMap: {
            key1: "value1",
            key2: "value2",
        },
    },
}, {
    dependsOn: [exampleRolePolicyAttachment],
});
Copy
import pulumi
import json
import pulumi_aws as aws

current = aws.get_region()
current_get_partition = aws.get_partition()
example = aws.iam.Role("example",
    assume_role_policy=json.dumps({
        "Version": "2012-10-17",
        "Statement": [{
            "Action": "sts:AssumeRole",
            "Effect": "Allow",
            "Principal": {
                "Service": f"imagebuilder.{current_get_partition.dns_suffix}",
            },
        }],
    }),
    name="example")
example_role_policy_attachment = aws.iam.RolePolicyAttachment("example",
    policy_arn=f"arn:{current_get_partition.partition}:iam::aws:policy/service-role/EC2ImageBuilderLifecycleExecutionPolicy",
    role=example.name)
example_lifecycle_policy = aws.imagebuilder.LifecyclePolicy("example",
    name="name",
    description="Example description",
    execution_role=example.arn,
    resource_type="AMI_IMAGE",
    policy_details=[{
        "action": {
            "type": "DELETE",
        },
        "filter": {
            "type": "AGE",
            "value": 6,
            "retain_at_least": 10,
            "unit": "YEARS",
        },
    }],
    resource_selection={
        "tag_map": {
            "key1": "value1",
            "key2": "value2",
        },
    },
    opts = pulumi.ResourceOptions(depends_on=[example_role_policy_attachment]))
Copy
package main

import (
	"encoding/json"
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/imagebuilder"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := aws.GetRegion(ctx, &aws.GetRegionArgs{}, nil)
		if err != nil {
			return err
		}
		currentGetPartition, err := aws.GetPartition(ctx, &aws.GetPartitionArgs{}, nil)
		if err != nil {
			return err
		}
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"Version": "2012-10-17",
			"Statement": []map[string]interface{}{
				map[string]interface{}{
					"Action": "sts:AssumeRole",
					"Effect": "Allow",
					"Principal": map[string]interface{}{
						"Service": fmt.Sprintf("imagebuilder.%v", currentGetPartition.DnsSuffix),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		example, err := iam.NewRole(ctx, "example", &iam.RoleArgs{
			AssumeRolePolicy: pulumi.String(json0),
			Name:             pulumi.String("example"),
		})
		if err != nil {
			return err
		}
		exampleRolePolicyAttachment, err := iam.NewRolePolicyAttachment(ctx, "example", &iam.RolePolicyAttachmentArgs{
			PolicyArn: pulumi.Sprintf("arn:%v:iam::aws:policy/service-role/EC2ImageBuilderLifecycleExecutionPolicy", currentGetPartition.Partition),
			Role:      example.Name,
		})
		if err != nil {
			return err
		}
		_, err = imagebuilder.NewLifecyclePolicy(ctx, "example", &imagebuilder.LifecyclePolicyArgs{
			Name:          pulumi.String("name"),
			Description:   pulumi.String("Example description"),
			ExecutionRole: example.Arn,
			ResourceType:  pulumi.String("AMI_IMAGE"),
			PolicyDetails: imagebuilder.LifecyclePolicyPolicyDetailArray{
				&imagebuilder.LifecyclePolicyPolicyDetailArgs{
					Action: &imagebuilder.LifecyclePolicyPolicyDetailActionArgs{
						Type: pulumi.String("DELETE"),
					},
					Filter: &imagebuilder.LifecyclePolicyPolicyDetailFilterArgs{
						Type:          pulumi.String("AGE"),
						Value:         pulumi.Int(6),
						RetainAtLeast: pulumi.Int(10),
						Unit:          pulumi.String("YEARS"),
					},
				},
			},
			ResourceSelection: &imagebuilder.LifecyclePolicyResourceSelectionArgs{
				TagMap: pulumi.StringMap{
					"key1": pulumi.String("value1"),
					"key2": pulumi.String("value2"),
				},
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			exampleRolePolicyAttachment,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var current = Aws.GetRegion.Invoke();

    var currentGetPartition = Aws.GetPartition.Invoke();

    var example = new Aws.Iam.Role("example", new()
    {
        AssumeRolePolicy = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["Version"] = "2012-10-17",
            ["Statement"] = new[]
            {
                new Dictionary<string, object?>
                {
                    ["Action"] = "sts:AssumeRole",
                    ["Effect"] = "Allow",
                    ["Principal"] = new Dictionary<string, object?>
                    {
                        ["Service"] = $"imagebuilder.{currentGetPartition.Apply(getPartitionResult => getPartitionResult.DnsSuffix)}",
                    },
                },
            },
        }),
        Name = "example",
    });

    var exampleRolePolicyAttachment = new Aws.Iam.RolePolicyAttachment("example", new()
    {
        PolicyArn = $"arn:{currentGetPartition.Apply(getPartitionResult => getPartitionResult.Partition)}:iam::aws:policy/service-role/EC2ImageBuilderLifecycleExecutionPolicy",
        Role = example.Name,
    });

    var exampleLifecyclePolicy = new Aws.ImageBuilder.LifecyclePolicy("example", new()
    {
        Name = "name",
        Description = "Example description",
        ExecutionRole = example.Arn,
        ResourceType = "AMI_IMAGE",
        PolicyDetails = new[]
        {
            new Aws.ImageBuilder.Inputs.LifecyclePolicyPolicyDetailArgs
            {
                Action = new Aws.ImageBuilder.Inputs.LifecyclePolicyPolicyDetailActionArgs
                {
                    Type = "DELETE",
                },
                Filter = new Aws.ImageBuilder.Inputs.LifecyclePolicyPolicyDetailFilterArgs
                {
                    Type = "AGE",
                    Value = 6,
                    RetainAtLeast = 10,
                    Unit = "YEARS",
                },
            },
        },
        ResourceSelection = new Aws.ImageBuilder.Inputs.LifecyclePolicyResourceSelectionArgs
        {
            TagMap = 
            {
                { "key1", "value1" },
                { "key2", "value2" },
            },
        },
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            exampleRolePolicyAttachment,
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.inputs.GetRegionArgs;
import com.pulumi.aws.inputs.GetPartitionArgs;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.iam.RolePolicyAttachment;
import com.pulumi.aws.iam.RolePolicyAttachmentArgs;
import com.pulumi.aws.imagebuilder.LifecyclePolicy;
import com.pulumi.aws.imagebuilder.LifecyclePolicyArgs;
import com.pulumi.aws.imagebuilder.inputs.LifecyclePolicyPolicyDetailArgs;
import com.pulumi.aws.imagebuilder.inputs.LifecyclePolicyPolicyDetailActionArgs;
import com.pulumi.aws.imagebuilder.inputs.LifecyclePolicyPolicyDetailFilterArgs;
import com.pulumi.aws.imagebuilder.inputs.LifecyclePolicyResourceSelectionArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var current = AwsFunctions.getRegion();

        final var currentGetPartition = AwsFunctions.getPartition();

        var example = new Role("example", RoleArgs.builder()
            .assumeRolePolicy(serializeJson(
                jsonObject(
                    jsonProperty("Version", "2012-10-17"),
                    jsonProperty("Statement", jsonArray(jsonObject(
                        jsonProperty("Action", "sts:AssumeRole"),
                        jsonProperty("Effect", "Allow"),
                        jsonProperty("Principal", jsonObject(
                            jsonProperty("Service", String.format("imagebuilder.%s", currentGetPartition.applyValue(getPartitionResult -> getPartitionResult.dnsSuffix())))
                        ))
                    )))
                )))
            .name("example")
            .build());

        var exampleRolePolicyAttachment = new RolePolicyAttachment("exampleRolePolicyAttachment", RolePolicyAttachmentArgs.builder()
            .policyArn(String.format("arn:%s:iam::aws:policy/service-role/EC2ImageBuilderLifecycleExecutionPolicy", currentGetPartition.applyValue(getPartitionResult -> getPartitionResult.partition())))
            .role(example.name())
            .build());

        var exampleLifecyclePolicy = new LifecyclePolicy("exampleLifecyclePolicy", LifecyclePolicyArgs.builder()
            .name("name")
            .description("Example description")
            .executionRole(example.arn())
            .resourceType("AMI_IMAGE")
            .policyDetails(LifecyclePolicyPolicyDetailArgs.builder()
                .action(LifecyclePolicyPolicyDetailActionArgs.builder()
                    .type("DELETE")
                    .build())
                .filter(LifecyclePolicyPolicyDetailFilterArgs.builder()
                    .type("AGE")
                    .value(6)
                    .retainAtLeast(10)
                    .unit("YEARS")
                    .build())
                .build())
            .resourceSelection(LifecyclePolicyResourceSelectionArgs.builder()
                .tagMap(Map.ofEntries(
                    Map.entry("key1", "value1"),
                    Map.entry("key2", "value2")
                ))
                .build())
            .build(), CustomResourceOptions.builder()
                .dependsOn(exampleRolePolicyAttachment)
                .build());

    }
}
Copy
resources:
  example:
    type: aws:iam:Role
    properties:
      assumeRolePolicy:
        fn::toJSON:
          Version: 2012-10-17
          Statement:
            - Action: sts:AssumeRole
              Effect: Allow
              Principal:
                Service: imagebuilder.${currentGetPartition.dnsSuffix}
      name: example
  exampleRolePolicyAttachment:
    type: aws:iam:RolePolicyAttachment
    name: example
    properties:
      policyArn: arn:${currentGetPartition.partition}:iam::aws:policy/service-role/EC2ImageBuilderLifecycleExecutionPolicy
      role: ${example.name}
  exampleLifecyclePolicy:
    type: aws:imagebuilder:LifecyclePolicy
    name: example
    properties:
      name: name
      description: Example description
      executionRole: ${example.arn}
      resourceType: AMI_IMAGE
      policyDetails:
        - action:
            type: DELETE
          filter:
            type: AGE
            value: 6
            retainAtLeast: 10
            unit: YEARS
      resourceSelection:
        tagMap:
          key1: value1
          key2: value2
    options:
      dependsOn:
        - ${exampleRolePolicyAttachment}
variables:
  current:
    fn::invoke:
      function: aws:getRegion
      arguments: {}
  currentGetPartition:
    fn::invoke:
      function: aws:getPartition
      arguments: {}
Copy

Create LifecyclePolicy Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new LifecyclePolicy(name: string, args: LifecyclePolicyArgs, opts?: CustomResourceOptions);
@overload
def LifecyclePolicy(resource_name: str,
                    args: LifecyclePolicyArgs,
                    opts: Optional[ResourceOptions] = None)

@overload
def LifecyclePolicy(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    execution_role: Optional[str] = None,
                    resource_type: Optional[str] = None,
                    description: Optional[str] = None,
                    name: Optional[str] = None,
                    policy_details: Optional[Sequence[LifecyclePolicyPolicyDetailArgs]] = None,
                    resource_selection: Optional[LifecyclePolicyResourceSelectionArgs] = None,
                    status: Optional[str] = None,
                    tags: Optional[Mapping[str, str]] = None)
func NewLifecyclePolicy(ctx *Context, name string, args LifecyclePolicyArgs, opts ...ResourceOption) (*LifecyclePolicy, error)
public LifecyclePolicy(string name, LifecyclePolicyArgs args, CustomResourceOptions? opts = null)
public LifecyclePolicy(String name, LifecyclePolicyArgs args)
public LifecyclePolicy(String name, LifecyclePolicyArgs args, CustomResourceOptions options)
type: aws:imagebuilder:LifecyclePolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. LifecyclePolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. LifecyclePolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. LifecyclePolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. LifecyclePolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. LifecyclePolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var examplelifecyclePolicyResourceResourceFromImagebuilderlifecyclePolicy = new Aws.ImageBuilder.LifecyclePolicy("examplelifecyclePolicyResourceResourceFromImagebuilderlifecyclePolicy", new()
{
    ExecutionRole = "string",
    ResourceType = "string",
    Description = "string",
    Name = "string",
    PolicyDetails = new[]
    {
        new Aws.ImageBuilder.Inputs.LifecyclePolicyPolicyDetailArgs
        {
            Action = new Aws.ImageBuilder.Inputs.LifecyclePolicyPolicyDetailActionArgs
            {
                Type = "string",
                IncludeResources = new Aws.ImageBuilder.Inputs.LifecyclePolicyPolicyDetailActionIncludeResourcesArgs
                {
                    Amis = false,
                    Containers = false,
                    Snapshots = false,
                },
            },
            ExclusionRules = new Aws.ImageBuilder.Inputs.LifecyclePolicyPolicyDetailExclusionRulesArgs
            {
                Amis = new Aws.ImageBuilder.Inputs.LifecyclePolicyPolicyDetailExclusionRulesAmisArgs
                {
                    IsPublic = false,
                    LastLaunched = new Aws.ImageBuilder.Inputs.LifecyclePolicyPolicyDetailExclusionRulesAmisLastLaunchedArgs
                    {
                        Unit = "string",
                        Value = 0,
                    },
                    Regions = new[]
                    {
                        "string",
                    },
                    SharedAccounts = new[]
                    {
                        "string",
                    },
                    TagMap = 
                    {
                        { "string", "string" },
                    },
                },
                TagMap = 
                {
                    { "string", "string" },
                },
            },
            Filter = new Aws.ImageBuilder.Inputs.LifecyclePolicyPolicyDetailFilterArgs
            {
                Type = "string",
                Value = 0,
                RetainAtLeast = 0,
                Unit = "string",
            },
        },
    },
    ResourceSelection = new Aws.ImageBuilder.Inputs.LifecyclePolicyResourceSelectionArgs
    {
        Recipes = new[]
        {
            new Aws.ImageBuilder.Inputs.LifecyclePolicyResourceSelectionRecipeArgs
            {
                Name = "string",
                SemanticVersion = "string",
            },
        },
        TagMap = 
        {
            { "string", "string" },
        },
    },
    Status = "string",
    Tags = 
    {
        { "string", "string" },
    },
});
Copy
example, err := imagebuilder.NewLifecyclePolicy(ctx, "examplelifecyclePolicyResourceResourceFromImagebuilderlifecyclePolicy", &imagebuilder.LifecyclePolicyArgs{
	ExecutionRole: pulumi.String("string"),
	ResourceType:  pulumi.String("string"),
	Description:   pulumi.String("string"),
	Name:          pulumi.String("string"),
	PolicyDetails: imagebuilder.LifecyclePolicyPolicyDetailArray{
		&imagebuilder.LifecyclePolicyPolicyDetailArgs{
			Action: &imagebuilder.LifecyclePolicyPolicyDetailActionArgs{
				Type: pulumi.String("string"),
				IncludeResources: &imagebuilder.LifecyclePolicyPolicyDetailActionIncludeResourcesArgs{
					Amis:       pulumi.Bool(false),
					Containers: pulumi.Bool(false),
					Snapshots:  pulumi.Bool(false),
				},
			},
			ExclusionRules: &imagebuilder.LifecyclePolicyPolicyDetailExclusionRulesArgs{
				Amis: &imagebuilder.LifecyclePolicyPolicyDetailExclusionRulesAmisArgs{
					IsPublic: pulumi.Bool(false),
					LastLaunched: &imagebuilder.LifecyclePolicyPolicyDetailExclusionRulesAmisLastLaunchedArgs{
						Unit:  pulumi.String("string"),
						Value: pulumi.Int(0),
					},
					Regions: pulumi.StringArray{
						pulumi.String("string"),
					},
					SharedAccounts: pulumi.StringArray{
						pulumi.String("string"),
					},
					TagMap: pulumi.StringMap{
						"string": pulumi.String("string"),
					},
				},
				TagMap: pulumi.StringMap{
					"string": pulumi.String("string"),
				},
			},
			Filter: &imagebuilder.LifecyclePolicyPolicyDetailFilterArgs{
				Type:          pulumi.String("string"),
				Value:         pulumi.Int(0),
				RetainAtLeast: pulumi.Int(0),
				Unit:          pulumi.String("string"),
			},
		},
	},
	ResourceSelection: &imagebuilder.LifecyclePolicyResourceSelectionArgs{
		Recipes: imagebuilder.LifecyclePolicyResourceSelectionRecipeArray{
			&imagebuilder.LifecyclePolicyResourceSelectionRecipeArgs{
				Name:            pulumi.String("string"),
				SemanticVersion: pulumi.String("string"),
			},
		},
		TagMap: pulumi.StringMap{
			"string": pulumi.String("string"),
		},
	},
	Status: pulumi.String("string"),
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
})
Copy
var examplelifecyclePolicyResourceResourceFromImagebuilderlifecyclePolicy = new LifecyclePolicy("examplelifecyclePolicyResourceResourceFromImagebuilderlifecyclePolicy", LifecyclePolicyArgs.builder()
    .executionRole("string")
    .resourceType("string")
    .description("string")
    .name("string")
    .policyDetails(LifecyclePolicyPolicyDetailArgs.builder()
        .action(LifecyclePolicyPolicyDetailActionArgs.builder()
            .type("string")
            .includeResources(LifecyclePolicyPolicyDetailActionIncludeResourcesArgs.builder()
                .amis(false)
                .containers(false)
                .snapshots(false)
                .build())
            .build())
        .exclusionRules(LifecyclePolicyPolicyDetailExclusionRulesArgs.builder()
            .amis(LifecyclePolicyPolicyDetailExclusionRulesAmisArgs.builder()
                .isPublic(false)
                .lastLaunched(LifecyclePolicyPolicyDetailExclusionRulesAmisLastLaunchedArgs.builder()
                    .unit("string")
                    .value(0)
                    .build())
                .regions("string")
                .sharedAccounts("string")
                .tagMap(Map.of("string", "string"))
                .build())
            .tagMap(Map.of("string", "string"))
            .build())
        .filter(LifecyclePolicyPolicyDetailFilterArgs.builder()
            .type("string")
            .value(0)
            .retainAtLeast(0)
            .unit("string")
            .build())
        .build())
    .resourceSelection(LifecyclePolicyResourceSelectionArgs.builder()
        .recipes(LifecyclePolicyResourceSelectionRecipeArgs.builder()
            .name("string")
            .semanticVersion("string")
            .build())
        .tagMap(Map.of("string", "string"))
        .build())
    .status("string")
    .tags(Map.of("string", "string"))
    .build());
Copy
examplelifecycle_policy_resource_resource_from_imagebuilderlifecycle_policy = aws.imagebuilder.LifecyclePolicy("examplelifecyclePolicyResourceResourceFromImagebuilderlifecyclePolicy",
    execution_role="string",
    resource_type="string",
    description="string",
    name="string",
    policy_details=[{
        "action": {
            "type": "string",
            "include_resources": {
                "amis": False,
                "containers": False,
                "snapshots": False,
            },
        },
        "exclusion_rules": {
            "amis": {
                "is_public": False,
                "last_launched": {
                    "unit": "string",
                    "value": 0,
                },
                "regions": ["string"],
                "shared_accounts": ["string"],
                "tag_map": {
                    "string": "string",
                },
            },
            "tag_map": {
                "string": "string",
            },
        },
        "filter": {
            "type": "string",
            "value": 0,
            "retain_at_least": 0,
            "unit": "string",
        },
    }],
    resource_selection={
        "recipes": [{
            "name": "string",
            "semantic_version": "string",
        }],
        "tag_map": {
            "string": "string",
        },
    },
    status="string",
    tags={
        "string": "string",
    })
Copy
const examplelifecyclePolicyResourceResourceFromImagebuilderlifecyclePolicy = new aws.imagebuilder.LifecyclePolicy("examplelifecyclePolicyResourceResourceFromImagebuilderlifecyclePolicy", {
    executionRole: "string",
    resourceType: "string",
    description: "string",
    name: "string",
    policyDetails: [{
        action: {
            type: "string",
            includeResources: {
                amis: false,
                containers: false,
                snapshots: false,
            },
        },
        exclusionRules: {
            amis: {
                isPublic: false,
                lastLaunched: {
                    unit: "string",
                    value: 0,
                },
                regions: ["string"],
                sharedAccounts: ["string"],
                tagMap: {
                    string: "string",
                },
            },
            tagMap: {
                string: "string",
            },
        },
        filter: {
            type: "string",
            value: 0,
            retainAtLeast: 0,
            unit: "string",
        },
    }],
    resourceSelection: {
        recipes: [{
            name: "string",
            semanticVersion: "string",
        }],
        tagMap: {
            string: "string",
        },
    },
    status: "string",
    tags: {
        string: "string",
    },
});
Copy
type: aws:imagebuilder:LifecyclePolicy
properties:
    description: string
    executionRole: string
    name: string
    policyDetails:
        - action:
            includeResources:
                amis: false
                containers: false
                snapshots: false
            type: string
          exclusionRules:
            amis:
                isPublic: false
                lastLaunched:
                    unit: string
                    value: 0
                regions:
                    - string
                sharedAccounts:
                    - string
                tagMap:
                    string: string
            tagMap:
                string: string
          filter:
            retainAtLeast: 0
            type: string
            unit: string
            value: 0
    resourceSelection:
        recipes:
            - name: string
              semanticVersion: string
        tagMap:
            string: string
    resourceType: string
    status: string
    tags:
        string: string
Copy

LifecyclePolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The LifecyclePolicy resource accepts the following input properties:

ExecutionRole This property is required. string
The Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run lifecycle actions. More information about this role can be found here.
ResourceType This property is required. string
The type of Image Builder resource that the lifecycle policy applies to. Valid values: AMI_IMAGE or CONTAINER_IMAGE.
Description string
description for the lifecycle policy.
Name string
The name of the lifecycle policy to create.
PolicyDetails List<LifecyclePolicyPolicyDetail>
Configuration block with policy details. Detailed below.
ResourceSelection LifecyclePolicyResourceSelection

Selection criteria for the resources that the lifecycle policy applies to. Detailed below.

The following arguments are optional:

Status string
The status of the lifecycle policy.
Tags Dictionary<string, string>
Key-value map of resource tags for the Image Builder Lifecycle Policy. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
ExecutionRole This property is required. string
The Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run lifecycle actions. More information about this role can be found here.
ResourceType This property is required. string
The type of Image Builder resource that the lifecycle policy applies to. Valid values: AMI_IMAGE or CONTAINER_IMAGE.
Description string
description for the lifecycle policy.
Name string
The name of the lifecycle policy to create.
PolicyDetails []LifecyclePolicyPolicyDetailArgs
Configuration block with policy details. Detailed below.
ResourceSelection LifecyclePolicyResourceSelectionArgs

Selection criteria for the resources that the lifecycle policy applies to. Detailed below.

The following arguments are optional:

Status string
The status of the lifecycle policy.
Tags map[string]string
Key-value map of resource tags for the Image Builder Lifecycle Policy. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
executionRole This property is required. String
The Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run lifecycle actions. More information about this role can be found here.
resourceType This property is required. String
The type of Image Builder resource that the lifecycle policy applies to. Valid values: AMI_IMAGE or CONTAINER_IMAGE.
description String
description for the lifecycle policy.
name String
The name of the lifecycle policy to create.
policyDetails List<LifecyclePolicyPolicyDetail>
Configuration block with policy details. Detailed below.
resourceSelection LifecyclePolicyResourceSelection

Selection criteria for the resources that the lifecycle policy applies to. Detailed below.

The following arguments are optional:

status String
The status of the lifecycle policy.
tags Map<String,String>
Key-value map of resource tags for the Image Builder Lifecycle Policy. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
executionRole This property is required. string
The Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run lifecycle actions. More information about this role can be found here.
resourceType This property is required. string
The type of Image Builder resource that the lifecycle policy applies to. Valid values: AMI_IMAGE or CONTAINER_IMAGE.
description string
description for the lifecycle policy.
name string
The name of the lifecycle policy to create.
policyDetails LifecyclePolicyPolicyDetail[]
Configuration block with policy details. Detailed below.
resourceSelection LifecyclePolicyResourceSelection

Selection criteria for the resources that the lifecycle policy applies to. Detailed below.

The following arguments are optional:

status string
The status of the lifecycle policy.
tags {[key: string]: string}
Key-value map of resource tags for the Image Builder Lifecycle Policy. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
execution_role This property is required. str
The Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run lifecycle actions. More information about this role can be found here.
resource_type This property is required. str
The type of Image Builder resource that the lifecycle policy applies to. Valid values: AMI_IMAGE or CONTAINER_IMAGE.
description str
description for the lifecycle policy.
name str
The name of the lifecycle policy to create.
policy_details Sequence[LifecyclePolicyPolicyDetailArgs]
Configuration block with policy details. Detailed below.
resource_selection LifecyclePolicyResourceSelectionArgs

Selection criteria for the resources that the lifecycle policy applies to. Detailed below.

The following arguments are optional:

status str
The status of the lifecycle policy.
tags Mapping[str, str]
Key-value map of resource tags for the Image Builder Lifecycle Policy. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
executionRole This property is required. String
The Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run lifecycle actions. More information about this role can be found here.
resourceType This property is required. String
The type of Image Builder resource that the lifecycle policy applies to. Valid values: AMI_IMAGE or CONTAINER_IMAGE.
description String
description for the lifecycle policy.
name String
The name of the lifecycle policy to create.
policyDetails List<Property Map>
Configuration block with policy details. Detailed below.
resourceSelection Property Map

Selection criteria for the resources that the lifecycle policy applies to. Detailed below.

The following arguments are optional:

status String
The status of the lifecycle policy.
tags Map<String>
Key-value map of resource tags for the Image Builder Lifecycle Policy. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Outputs

All input properties are implicitly available as output properties. Additionally, the LifecyclePolicy resource produces the following output properties:

Arn string
Amazon Resource Name (ARN) of the lifecycle policy.
Id string
The provider-assigned unique ID for this managed resource.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Arn string
Amazon Resource Name (ARN) of the lifecycle policy.
Id string
The provider-assigned unique ID for this managed resource.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
Amazon Resource Name (ARN) of the lifecycle policy.
id String
The provider-assigned unique ID for this managed resource.
tagsAll Map<String,String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn string
Amazon Resource Name (ARN) of the lifecycle policy.
id string
The provider-assigned unique ID for this managed resource.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn str
Amazon Resource Name (ARN) of the lifecycle policy.
id str
The provider-assigned unique ID for this managed resource.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
Amazon Resource Name (ARN) of the lifecycle policy.
id String
The provider-assigned unique ID for this managed resource.
tagsAll Map<String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Look up Existing LifecyclePolicy Resource

Get an existing LifecyclePolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: LifecyclePolicyState, opts?: CustomResourceOptions): LifecyclePolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arn: Optional[str] = None,
        description: Optional[str] = None,
        execution_role: Optional[str] = None,
        name: Optional[str] = None,
        policy_details: Optional[Sequence[LifecyclePolicyPolicyDetailArgs]] = None,
        resource_selection: Optional[LifecyclePolicyResourceSelectionArgs] = None,
        resource_type: Optional[str] = None,
        status: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None) -> LifecyclePolicy
func GetLifecyclePolicy(ctx *Context, name string, id IDInput, state *LifecyclePolicyState, opts ...ResourceOption) (*LifecyclePolicy, error)
public static LifecyclePolicy Get(string name, Input<string> id, LifecyclePolicyState? state, CustomResourceOptions? opts = null)
public static LifecyclePolicy get(String name, Output<String> id, LifecyclePolicyState state, CustomResourceOptions options)
resources:  _:    type: aws:imagebuilder:LifecyclePolicy    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Arn string
Amazon Resource Name (ARN) of the lifecycle policy.
Description string
description for the lifecycle policy.
ExecutionRole string
The Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run lifecycle actions. More information about this role can be found here.
Name string
The name of the lifecycle policy to create.
PolicyDetails List<LifecyclePolicyPolicyDetail>
Configuration block with policy details. Detailed below.
ResourceSelection LifecyclePolicyResourceSelection

Selection criteria for the resources that the lifecycle policy applies to. Detailed below.

The following arguments are optional:

ResourceType string
The type of Image Builder resource that the lifecycle policy applies to. Valid values: AMI_IMAGE or CONTAINER_IMAGE.
Status string
The status of the lifecycle policy.
Tags Dictionary<string, string>
Key-value map of resource tags for the Image Builder Lifecycle Policy. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Arn string
Amazon Resource Name (ARN) of the lifecycle policy.
Description string
description for the lifecycle policy.
ExecutionRole string
The Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run lifecycle actions. More information about this role can be found here.
Name string
The name of the lifecycle policy to create.
PolicyDetails []LifecyclePolicyPolicyDetailArgs
Configuration block with policy details. Detailed below.
ResourceSelection LifecyclePolicyResourceSelectionArgs

Selection criteria for the resources that the lifecycle policy applies to. Detailed below.

The following arguments are optional:

ResourceType string
The type of Image Builder resource that the lifecycle policy applies to. Valid values: AMI_IMAGE or CONTAINER_IMAGE.
Status string
The status of the lifecycle policy.
Tags map[string]string
Key-value map of resource tags for the Image Builder Lifecycle Policy. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
Amazon Resource Name (ARN) of the lifecycle policy.
description String
description for the lifecycle policy.
executionRole String
The Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run lifecycle actions. More information about this role can be found here.
name String
The name of the lifecycle policy to create.
policyDetails List<LifecyclePolicyPolicyDetail>
Configuration block with policy details. Detailed below.
resourceSelection LifecyclePolicyResourceSelection

Selection criteria for the resources that the lifecycle policy applies to. Detailed below.

The following arguments are optional:

resourceType String
The type of Image Builder resource that the lifecycle policy applies to. Valid values: AMI_IMAGE or CONTAINER_IMAGE.
status String
The status of the lifecycle policy.
tags Map<String,String>
Key-value map of resource tags for the Image Builder Lifecycle Policy. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll Map<String,String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn string
Amazon Resource Name (ARN) of the lifecycle policy.
description string
description for the lifecycle policy.
executionRole string
The Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run lifecycle actions. More information about this role can be found here.
name string
The name of the lifecycle policy to create.
policyDetails LifecyclePolicyPolicyDetail[]
Configuration block with policy details. Detailed below.
resourceSelection LifecyclePolicyResourceSelection

Selection criteria for the resources that the lifecycle policy applies to. Detailed below.

The following arguments are optional:

resourceType string
The type of Image Builder resource that the lifecycle policy applies to. Valid values: AMI_IMAGE or CONTAINER_IMAGE.
status string
The status of the lifecycle policy.
tags {[key: string]: string}
Key-value map of resource tags for the Image Builder Lifecycle Policy. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn str
Amazon Resource Name (ARN) of the lifecycle policy.
description str
description for the lifecycle policy.
execution_role str
The Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run lifecycle actions. More information about this role can be found here.
name str
The name of the lifecycle policy to create.
policy_details Sequence[LifecyclePolicyPolicyDetailArgs]
Configuration block with policy details. Detailed below.
resource_selection LifecyclePolicyResourceSelectionArgs

Selection criteria for the resources that the lifecycle policy applies to. Detailed below.

The following arguments are optional:

resource_type str
The type of Image Builder resource that the lifecycle policy applies to. Valid values: AMI_IMAGE or CONTAINER_IMAGE.
status str
The status of the lifecycle policy.
tags Mapping[str, str]
Key-value map of resource tags for the Image Builder Lifecycle Policy. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
Amazon Resource Name (ARN) of the lifecycle policy.
description String
description for the lifecycle policy.
executionRole String
The Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run lifecycle actions. More information about this role can be found here.
name String
The name of the lifecycle policy to create.
policyDetails List<Property Map>
Configuration block with policy details. Detailed below.
resourceSelection Property Map

Selection criteria for the resources that the lifecycle policy applies to. Detailed below.

The following arguments are optional:

resourceType String
The type of Image Builder resource that the lifecycle policy applies to. Valid values: AMI_IMAGE or CONTAINER_IMAGE.
status String
The status of the lifecycle policy.
tags Map<String>
Key-value map of resource tags for the Image Builder Lifecycle Policy. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll Map<String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Supporting Types

LifecyclePolicyPolicyDetail
, LifecyclePolicyPolicyDetailArgs

Action LifecyclePolicyPolicyDetailAction
Configuration details for the policy action.
ExclusionRules LifecyclePolicyPolicyDetailExclusionRules
Additional rules to specify resources that should be exempt from policy actions.
Filter LifecyclePolicyPolicyDetailFilter

Specifies the resources that the lifecycle policy applies to.

The following arguments are optional:

Action LifecyclePolicyPolicyDetailAction
Configuration details for the policy action.
ExclusionRules LifecyclePolicyPolicyDetailExclusionRules
Additional rules to specify resources that should be exempt from policy actions.
Filter LifecyclePolicyPolicyDetailFilter

Specifies the resources that the lifecycle policy applies to.

The following arguments are optional:

action LifecyclePolicyPolicyDetailAction
Configuration details for the policy action.
exclusionRules LifecyclePolicyPolicyDetailExclusionRules
Additional rules to specify resources that should be exempt from policy actions.
filter LifecyclePolicyPolicyDetailFilter

Specifies the resources that the lifecycle policy applies to.

The following arguments are optional:

action LifecyclePolicyPolicyDetailAction
Configuration details for the policy action.
exclusionRules LifecyclePolicyPolicyDetailExclusionRules
Additional rules to specify resources that should be exempt from policy actions.
filter LifecyclePolicyPolicyDetailFilter

Specifies the resources that the lifecycle policy applies to.

The following arguments are optional:

action LifecyclePolicyPolicyDetailAction
Configuration details for the policy action.
exclusion_rules LifecyclePolicyPolicyDetailExclusionRules
Additional rules to specify resources that should be exempt from policy actions.
filter LifecyclePolicyPolicyDetailFilter

Specifies the resources that the lifecycle policy applies to.

The following arguments are optional:

action Property Map
Configuration details for the policy action.
exclusionRules Property Map
Additional rules to specify resources that should be exempt from policy actions.
filter Property Map

Specifies the resources that the lifecycle policy applies to.

The following arguments are optional:

LifecyclePolicyPolicyDetailAction
, LifecyclePolicyPolicyDetailActionArgs

Type This property is required. string

Specifies the lifecycle action to take. Valid values: DELETE, DEPRECATE or DISABLE.

The following arguments are optional:

IncludeResources LifecyclePolicyPolicyDetailActionIncludeResources
Specifies the resources that the lifecycle policy applies to. Detailed below.
Type This property is required. string

Specifies the lifecycle action to take. Valid values: DELETE, DEPRECATE or DISABLE.

The following arguments are optional:

IncludeResources LifecyclePolicyPolicyDetailActionIncludeResources
Specifies the resources that the lifecycle policy applies to. Detailed below.
type This property is required. String

Specifies the lifecycle action to take. Valid values: DELETE, DEPRECATE or DISABLE.

The following arguments are optional:

includeResources LifecyclePolicyPolicyDetailActionIncludeResources
Specifies the resources that the lifecycle policy applies to. Detailed below.
type This property is required. string

Specifies the lifecycle action to take. Valid values: DELETE, DEPRECATE or DISABLE.

The following arguments are optional:

includeResources LifecyclePolicyPolicyDetailActionIncludeResources
Specifies the resources that the lifecycle policy applies to. Detailed below.
type This property is required. str

Specifies the lifecycle action to take. Valid values: DELETE, DEPRECATE or DISABLE.

The following arguments are optional:

include_resources LifecyclePolicyPolicyDetailActionIncludeResources
Specifies the resources that the lifecycle policy applies to. Detailed below.
type This property is required. String

Specifies the lifecycle action to take. Valid values: DELETE, DEPRECATE or DISABLE.

The following arguments are optional:

includeResources Property Map
Specifies the resources that the lifecycle policy applies to. Detailed below.

LifecyclePolicyPolicyDetailActionIncludeResources
, LifecyclePolicyPolicyDetailActionIncludeResourcesArgs

Amis bool
Specifies whether the lifecycle action should apply to distributed AMIs.
Containers bool
Specifies whether the lifecycle action should apply to distributed containers.
Snapshots bool
Specifies whether the lifecycle action should apply to snapshots associated with distributed AMIs.
Amis bool
Specifies whether the lifecycle action should apply to distributed AMIs.
Containers bool
Specifies whether the lifecycle action should apply to distributed containers.
Snapshots bool
Specifies whether the lifecycle action should apply to snapshots associated with distributed AMIs.
amis Boolean
Specifies whether the lifecycle action should apply to distributed AMIs.
containers Boolean
Specifies whether the lifecycle action should apply to distributed containers.
snapshots Boolean
Specifies whether the lifecycle action should apply to snapshots associated with distributed AMIs.
amis boolean
Specifies whether the lifecycle action should apply to distributed AMIs.
containers boolean
Specifies whether the lifecycle action should apply to distributed containers.
snapshots boolean
Specifies whether the lifecycle action should apply to snapshots associated with distributed AMIs.
amis bool
Specifies whether the lifecycle action should apply to distributed AMIs.
containers bool
Specifies whether the lifecycle action should apply to distributed containers.
snapshots bool
Specifies whether the lifecycle action should apply to snapshots associated with distributed AMIs.
amis Boolean
Specifies whether the lifecycle action should apply to distributed AMIs.
containers Boolean
Specifies whether the lifecycle action should apply to distributed containers.
snapshots Boolean
Specifies whether the lifecycle action should apply to snapshots associated with distributed AMIs.

LifecyclePolicyPolicyDetailExclusionRules
, LifecyclePolicyPolicyDetailExclusionRulesArgs

Amis LifecyclePolicyPolicyDetailExclusionRulesAmis
Lists configuration values that apply to AMIs that Image Builder should exclude from the lifecycle action. Detailed below.
TagMap Dictionary<string, string>
Contains a list of tags that Image Builder uses to skip lifecycle actions for Image Builder image resources that have them.
Amis LifecyclePolicyPolicyDetailExclusionRulesAmis
Lists configuration values that apply to AMIs that Image Builder should exclude from the lifecycle action. Detailed below.
TagMap map[string]string
Contains a list of tags that Image Builder uses to skip lifecycle actions for Image Builder image resources that have them.
amis LifecyclePolicyPolicyDetailExclusionRulesAmis
Lists configuration values that apply to AMIs that Image Builder should exclude from the lifecycle action. Detailed below.
tagMap Map<String,String>
Contains a list of tags that Image Builder uses to skip lifecycle actions for Image Builder image resources that have them.
amis LifecyclePolicyPolicyDetailExclusionRulesAmis
Lists configuration values that apply to AMIs that Image Builder should exclude from the lifecycle action. Detailed below.
tagMap {[key: string]: string}
Contains a list of tags that Image Builder uses to skip lifecycle actions for Image Builder image resources that have them.
amis LifecyclePolicyPolicyDetailExclusionRulesAmis
Lists configuration values that apply to AMIs that Image Builder should exclude from the lifecycle action. Detailed below.
tag_map Mapping[str, str]
Contains a list of tags that Image Builder uses to skip lifecycle actions for Image Builder image resources that have them.
amis Property Map
Lists configuration values that apply to AMIs that Image Builder should exclude from the lifecycle action. Detailed below.
tagMap Map<String>
Contains a list of tags that Image Builder uses to skip lifecycle actions for Image Builder image resources that have them.

LifecyclePolicyPolicyDetailExclusionRulesAmis
, LifecyclePolicyPolicyDetailExclusionRulesAmisArgs

IsPublic bool
Configures whether public AMIs are excluded from the lifecycle action.
LastLaunched LifecyclePolicyPolicyDetailExclusionRulesAmisLastLaunched
Specifies configuration details for Image Builder to exclude the most recent resources from lifecycle actions. Detailed below.
Regions List<string>
Configures AWS Regions that are excluded from the lifecycle action.
SharedAccounts List<string>
Specifies AWS accounts whose resources are excluded from the lifecycle action.
TagMap Dictionary<string, string>
Lists tags that should be excluded from lifecycle actions for the AMIs that have them.
IsPublic bool
Configures whether public AMIs are excluded from the lifecycle action.
LastLaunched LifecyclePolicyPolicyDetailExclusionRulesAmisLastLaunched
Specifies configuration details for Image Builder to exclude the most recent resources from lifecycle actions. Detailed below.
Regions []string
Configures AWS Regions that are excluded from the lifecycle action.
SharedAccounts []string
Specifies AWS accounts whose resources are excluded from the lifecycle action.
TagMap map[string]string
Lists tags that should be excluded from lifecycle actions for the AMIs that have them.
isPublic Boolean
Configures whether public AMIs are excluded from the lifecycle action.
lastLaunched LifecyclePolicyPolicyDetailExclusionRulesAmisLastLaunched
Specifies configuration details for Image Builder to exclude the most recent resources from lifecycle actions. Detailed below.
regions List<String>
Configures AWS Regions that are excluded from the lifecycle action.
sharedAccounts List<String>
Specifies AWS accounts whose resources are excluded from the lifecycle action.
tagMap Map<String,String>
Lists tags that should be excluded from lifecycle actions for the AMIs that have them.
isPublic boolean
Configures whether public AMIs are excluded from the lifecycle action.
lastLaunched LifecyclePolicyPolicyDetailExclusionRulesAmisLastLaunched
Specifies configuration details for Image Builder to exclude the most recent resources from lifecycle actions. Detailed below.
regions string[]
Configures AWS Regions that are excluded from the lifecycle action.
sharedAccounts string[]
Specifies AWS accounts whose resources are excluded from the lifecycle action.
tagMap {[key: string]: string}
Lists tags that should be excluded from lifecycle actions for the AMIs that have them.
is_public bool
Configures whether public AMIs are excluded from the lifecycle action.
last_launched LifecyclePolicyPolicyDetailExclusionRulesAmisLastLaunched
Specifies configuration details for Image Builder to exclude the most recent resources from lifecycle actions. Detailed below.
regions Sequence[str]
Configures AWS Regions that are excluded from the lifecycle action.
shared_accounts Sequence[str]
Specifies AWS accounts whose resources are excluded from the lifecycle action.
tag_map Mapping[str, str]
Lists tags that should be excluded from lifecycle actions for the AMIs that have them.
isPublic Boolean
Configures whether public AMIs are excluded from the lifecycle action.
lastLaunched Property Map
Specifies configuration details for Image Builder to exclude the most recent resources from lifecycle actions. Detailed below.
regions List<String>
Configures AWS Regions that are excluded from the lifecycle action.
sharedAccounts List<String>
Specifies AWS accounts whose resources are excluded from the lifecycle action.
tagMap Map<String>
Lists tags that should be excluded from lifecycle actions for the AMIs that have them.

LifecyclePolicyPolicyDetailExclusionRulesAmisLastLaunched
, LifecyclePolicyPolicyDetailExclusionRulesAmisLastLaunchedArgs

Unit This property is required. string
Defines the unit of time that the lifecycle policy uses to calculate elapsed time since the last instance launched from the AMI. For example: days, weeks, months, or years. Valid values: DAYS, WEEKS, MONTHS or YEARS.
Value This property is required. int
The integer number of units for the time period. For example 6 (months).
Unit This property is required. string
Defines the unit of time that the lifecycle policy uses to calculate elapsed time since the last instance launched from the AMI. For example: days, weeks, months, or years. Valid values: DAYS, WEEKS, MONTHS or YEARS.
Value This property is required. int
The integer number of units for the time period. For example 6 (months).
unit This property is required. String
Defines the unit of time that the lifecycle policy uses to calculate elapsed time since the last instance launched from the AMI. For example: days, weeks, months, or years. Valid values: DAYS, WEEKS, MONTHS or YEARS.
value This property is required. Integer
The integer number of units for the time period. For example 6 (months).
unit This property is required. string
Defines the unit of time that the lifecycle policy uses to calculate elapsed time since the last instance launched from the AMI. For example: days, weeks, months, or years. Valid values: DAYS, WEEKS, MONTHS or YEARS.
value This property is required. number
The integer number of units for the time period. For example 6 (months).
unit This property is required. str
Defines the unit of time that the lifecycle policy uses to calculate elapsed time since the last instance launched from the AMI. For example: days, weeks, months, or years. Valid values: DAYS, WEEKS, MONTHS or YEARS.
value This property is required. int
The integer number of units for the time period. For example 6 (months).
unit This property is required. String
Defines the unit of time that the lifecycle policy uses to calculate elapsed time since the last instance launched from the AMI. For example: days, weeks, months, or years. Valid values: DAYS, WEEKS, MONTHS or YEARS.
value This property is required. Number
The integer number of units for the time period. For example 6 (months).

LifecyclePolicyPolicyDetailFilter
, LifecyclePolicyPolicyDetailFilterArgs

Type This property is required. string
Filter resources based on either age or count. Valid values: AGE or COUNT.
Value This property is required. int

The number of units for the time period or for the count. For example, a value of 6 might refer to six months or six AMIs.

The following arguments are optional:

RetainAtLeast int
For age-based filters, this is the number of resources to keep on hand after the lifecycle DELETE action is applied. Impacted resources are only deleted if you have more than this number of resources. If you have fewer resources than this number, the impacted resource is not deleted.
Unit string
Defines the unit of time that the lifecycle policy uses to determine impacted resources. This is required for age-based rules. Valid values: DAYS, WEEKS, MONTHS or YEARS.
Type This property is required. string
Filter resources based on either age or count. Valid values: AGE or COUNT.
Value This property is required. int

The number of units for the time period or for the count. For example, a value of 6 might refer to six months or six AMIs.

The following arguments are optional:

RetainAtLeast int
For age-based filters, this is the number of resources to keep on hand after the lifecycle DELETE action is applied. Impacted resources are only deleted if you have more than this number of resources. If you have fewer resources than this number, the impacted resource is not deleted.
Unit string
Defines the unit of time that the lifecycle policy uses to determine impacted resources. This is required for age-based rules. Valid values: DAYS, WEEKS, MONTHS or YEARS.
type This property is required. String
Filter resources based on either age or count. Valid values: AGE or COUNT.
value This property is required. Integer

The number of units for the time period or for the count. For example, a value of 6 might refer to six months or six AMIs.

The following arguments are optional:

retainAtLeast Integer
For age-based filters, this is the number of resources to keep on hand after the lifecycle DELETE action is applied. Impacted resources are only deleted if you have more than this number of resources. If you have fewer resources than this number, the impacted resource is not deleted.
unit String
Defines the unit of time that the lifecycle policy uses to determine impacted resources. This is required for age-based rules. Valid values: DAYS, WEEKS, MONTHS or YEARS.
type This property is required. string
Filter resources based on either age or count. Valid values: AGE or COUNT.
value This property is required. number

The number of units for the time period or for the count. For example, a value of 6 might refer to six months or six AMIs.

The following arguments are optional:

retainAtLeast number
For age-based filters, this is the number of resources to keep on hand after the lifecycle DELETE action is applied. Impacted resources are only deleted if you have more than this number of resources. If you have fewer resources than this number, the impacted resource is not deleted.
unit string
Defines the unit of time that the lifecycle policy uses to determine impacted resources. This is required for age-based rules. Valid values: DAYS, WEEKS, MONTHS or YEARS.
type This property is required. str
Filter resources based on either age or count. Valid values: AGE or COUNT.
value This property is required. int

The number of units for the time period or for the count. For example, a value of 6 might refer to six months or six AMIs.

The following arguments are optional:

retain_at_least int
For age-based filters, this is the number of resources to keep on hand after the lifecycle DELETE action is applied. Impacted resources are only deleted if you have more than this number of resources. If you have fewer resources than this number, the impacted resource is not deleted.
unit str
Defines the unit of time that the lifecycle policy uses to determine impacted resources. This is required for age-based rules. Valid values: DAYS, WEEKS, MONTHS or YEARS.
type This property is required. String
Filter resources based on either age or count. Valid values: AGE or COUNT.
value This property is required. Number

The number of units for the time period or for the count. For example, a value of 6 might refer to six months or six AMIs.

The following arguments are optional:

retainAtLeast Number
For age-based filters, this is the number of resources to keep on hand after the lifecycle DELETE action is applied. Impacted resources are only deleted if you have more than this number of resources. If you have fewer resources than this number, the impacted resource is not deleted.
unit String
Defines the unit of time that the lifecycle policy uses to determine impacted resources. This is required for age-based rules. Valid values: DAYS, WEEKS, MONTHS or YEARS.

LifecyclePolicyResourceSelection
, LifecyclePolicyResourceSelectionArgs

Recipes List<LifecyclePolicyResourceSelectionRecipe>
A list of recipe that are used as selection criteria for the output images that the lifecycle policy applies to. Detailed below.
TagMap Dictionary<string, string>
A list of tags that are used as selection criteria for the Image Builder image resources that the lifecycle policy applies to.
Recipes []LifecyclePolicyResourceSelectionRecipe
A list of recipe that are used as selection criteria for the output images that the lifecycle policy applies to. Detailed below.
TagMap map[string]string
A list of tags that are used as selection criteria for the Image Builder image resources that the lifecycle policy applies to.
recipes List<LifecyclePolicyResourceSelectionRecipe>
A list of recipe that are used as selection criteria for the output images that the lifecycle policy applies to. Detailed below.
tagMap Map<String,String>
A list of tags that are used as selection criteria for the Image Builder image resources that the lifecycle policy applies to.
recipes LifecyclePolicyResourceSelectionRecipe[]
A list of recipe that are used as selection criteria for the output images that the lifecycle policy applies to. Detailed below.
tagMap {[key: string]: string}
A list of tags that are used as selection criteria for the Image Builder image resources that the lifecycle policy applies to.
recipes Sequence[LifecyclePolicyResourceSelectionRecipe]
A list of recipe that are used as selection criteria for the output images that the lifecycle policy applies to. Detailed below.
tag_map Mapping[str, str]
A list of tags that are used as selection criteria for the Image Builder image resources that the lifecycle policy applies to.
recipes List<Property Map>
A list of recipe that are used as selection criteria for the output images that the lifecycle policy applies to. Detailed below.
tagMap Map<String>
A list of tags that are used as selection criteria for the Image Builder image resources that the lifecycle policy applies to.

LifecyclePolicyResourceSelectionRecipe
, LifecyclePolicyResourceSelectionRecipeArgs

Name This property is required. string
The name of an Image Builder recipe that the lifecycle policy uses for resource selection.
SemanticVersion This property is required. string
The version of the Image Builder recipe specified by the name field.
Name This property is required. string
The name of an Image Builder recipe that the lifecycle policy uses for resource selection.
SemanticVersion This property is required. string
The version of the Image Builder recipe specified by the name field.
name This property is required. String
The name of an Image Builder recipe that the lifecycle policy uses for resource selection.
semanticVersion This property is required. String
The version of the Image Builder recipe specified by the name field.
name This property is required. string
The name of an Image Builder recipe that the lifecycle policy uses for resource selection.
semanticVersion This property is required. string
The version of the Image Builder recipe specified by the name field.
name This property is required. str
The name of an Image Builder recipe that the lifecycle policy uses for resource selection.
semantic_version This property is required. str
The version of the Image Builder recipe specified by the name field.
name This property is required. String
The name of an Image Builder recipe that the lifecycle policy uses for resource selection.
semanticVersion This property is required. String
The version of the Image Builder recipe specified by the name field.

Import

Using pulumi import, import aws_imagebuilder_lifecycle_policy using the Amazon Resource Name (ARN). For example:

$ pulumi import aws:imagebuilder/lifecyclePolicy:LifecyclePolicy example arn:aws:imagebuilder:us-east-1:123456789012:lifecycle-policy/example
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.