All Projects → wata727 → packer-plugin-amazon-ami-management

wata727 / packer-plugin-amazon-ami-management

Licence: MPL-2.0 license
Packer post-processor plugin for Amazon AMI management

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects
shell
77523 projects

Projects that are alternatives of or similar to packer-plugin-amazon-ami-management

Packer Provisioner Windows Update
Packer plugin for installing Windows updates
Stars: ✭ 172 (+81.05%)
Mutual labels:  packer
Detectionlab
Automate the creation of a lab environment complete with security tooling and logging best practices
Stars: ✭ 3,237 (+3307.37%)
Mutual labels:  packer
ansible-role-cardano-node
Ansible role for the provisioning of Shelly Cardano binaries from source.
Stars: ✭ 20 (-78.95%)
Mutual labels:  packer
Nixbox
NixOS Vagrant boxes [[email protected]]
Stars: ✭ 189 (+98.95%)
Mutual labels:  packer
Graylog2 Images
Ready to run machine images
Stars: ✭ 234 (+146.32%)
Mutual labels:  packer
wireguard-setup
WireGuard and Unbound setup with Packer and Terraform.
Stars: ✭ 55 (-42.11%)
Mutual labels:  packer
Binpacker
A binary stream packer and unpacker
Stars: ✭ 162 (+70.53%)
Mutual labels:  packer
unprotect
Unprotect is a python tool for parsing PE malware and extract evasion techniques.
Stars: ✭ 75 (-21.05%)
Mutual labels:  packer
Packer
Packer helpers and templates for Docker, IIS, SQL Server and Visual Studio on Windows and Ubuntu
Stars: ✭ 242 (+154.74%)
Mutual labels:  packer
ecs-ansible-packer-terraform-wordpress
Proof of concept: Install wordpress environment using ansible, packer, docker, terraform and AWS.
Stars: ✭ 29 (-69.47%)
Mutual labels:  packer
Packer Build
Packer Automated VM Image and Vagrant Box Builds
Stars: ✭ 199 (+109.47%)
Mutual labels:  packer
Packer Centos 7
This build has been moved - see README.md
Stars: ✭ 223 (+134.74%)
Mutual labels:  packer
packer-centos
Create CentOS images for different hypervisors with Packer
Stars: ✭ 18 (-81.05%)
Mutual labels:  packer
Detect It Easy
Program for determining types of files for Windows, Linux and MacOS.
Stars: ✭ 2,982 (+3038.95%)
Mutual labels:  packer
nvim-fennel-lsp-conjure-as-clojure-ide
Basic config to transform your NVIM in a powerful Clojure IDE using fennel, clojure-lsp and conjure.
Stars: ✭ 144 (+51.58%)
Mutual labels:  packer
Windows Vagrant
Windows 2012R2/10/2016/2019 Base Vagrant Box (https://app.vagrantup.com/rgl)
Stars: ✭ 169 (+77.89%)
Mutual labels:  packer
Runpe In Memory
Run a Exe File (PE Module) in memory (like an Application Loader)
Stars: ✭ 249 (+162.11%)
Mutual labels:  packer
nvim-config
My neovim config
Stars: ✭ 63 (-33.68%)
Mutual labels:  packer
gulp-myth
[DEPRECATED] Myth - Postprocessor that polyfills CSS
Stars: ✭ 39 (-58.95%)
Mutual labels:  post-processor
django-angular2-fullstack-devops
All-in-one django/angular2 seed with cli interface for multi-environment devops on aws using ansible/packer/terraform
Stars: ✭ 54 (-43.16%)
Mutual labels:  packer

packer-plugin-amazon-ami-management

Build Status GitHub release License: MPL 2.0

Packer post-processor plugin for Amazon AMI management

Description

This post-processor cleanups old AMIs and EBS snapshots after baking a new AMI.

Installation

Packer >= v1.7.0 supports third-party plugin installation by init command. You can install the plugin automatically after adding the required_plugin block.

packer {
  required_plugins {
    amazon-ami-management = {
      version = ">= 1.0.0"
      source = "github.com/wata727/amazon-ami-management"
    }
  }
}

See the Packer documentation for more details.

Usage

The following example is a template to keep only the latest 3 AMIs.

source "amazon-ebs" "example" {
  region = "us-east-1"
  source_ami = "ami-6869aa05"
  instance_type = "t2.micro"
  ssh_username = "ec2-user"
  ssh_pty = true
  ami_name = "packer-example ${formatdate("YYYYMMDDhhmmss", timestamp())}"
  tags = {
    Amazon_AMI_Management_Identifier = "packer-example"
  }
}

build {
  sources = ["source.amazon-ebs.example"]

  provisioner "shell" {
    inline = ["echo 'running...'"]
  }

  post-processor "amazon-ami-management" {
    regions = ["us-east-1"]
    identifier = "packer-example"
    keep_releases = 3
  }
}

Configuration

Type: amazon-ami-management

Required:

  • identifier (string) - An identifier of AMIs. This plugin looks Amazon_AMI_Management_Identifier tag. If identifier matches tag value, these AMI becomes to management target.
  • keep_releases (integer) - The number of AMIs. This value is invalid when keep_days is set.
  • keep_days (integer) - The number of days to keep AMIs. For example, if you specify 10, AMIs created before 10 days will be deleted. This value is invalid when keep_releases is set.
  • regions (array of strings) - A list of regions, such as us-east-1 in which to manage AMIs. NOTE: Before v0.3.0, this parameter was region. Since 0.4.0, region is not used.

Optional:

  • dry_run (boolean) - If true, the post-processor doesn't actually delete AMIs.

The following attibutes are also available. These are optional and used in the same way as AWS Builder:

  • access_key
  • secret_key
  • assume_role
  • custom_endpoint_ec2
  • mfa_code
  • profile
  • skip_metadata_api_check
  • token

IAM Task or Instance Role

The post-processor requires additional permissions to work. Below is the difference from the minimum permissions required by Packer.

{
  "Version": "2012-10-17",
  "Statement": [{
      "Effect": "Allow",
      "Action" : [
+       "autoscaling:DescribeLaunchConfigurations",
        "ec2:AttachVolume",
        "ec2:AuthorizeSecurityGroupIngress",
        "ec2:CopyImage",
        "ec2:CreateImage",
        "ec2:CreateKeypair",
        "ec2:CreateSecurityGroup",
        "ec2:CreateSnapshot",
        "ec2:CreateTags",
        "ec2:CreateVolume",
        "ec2:DeleteKeyPair",
        "ec2:DeleteSecurityGroup",
        "ec2:DeleteSnapshot",
        "ec2:DeleteVolume",
        "ec2:DeregisterImage",
        "ec2:DescribeImageAttribute",
        "ec2:DescribeImages",
        "ec2:DescribeInstances",
        "ec2:DescribeInstanceStatus",
+       "ec2:DescribeLaunchTemplates",
+       "ec2:DescribeLaunchTemplateVersions",
        "ec2:DescribeRegions",
        "ec2:DescribeSecurityGroups",
        "ec2:DescribeSnapshots",
        "ec2:DescribeSubnets",
        "ec2:DescribeTags",
        "ec2:DescribeVolumes",
        "ec2:DetachVolume",
        "ec2:GetPasswordData",
        "ec2:ModifyImageAttribute",
        "ec2:ModifyInstanceAttribute",
        "ec2:ModifySnapshotAttribute",
        "ec2:RegisterImage",
        "ec2:RunInstances",
        "ec2:StopInstances",
        "ec2:TerminateInstances"
      ],
      "Resource" : "*"
  }]
}

Developing Plugin

If you wish to build this plugin on your environment, you can use GNU Make build system. But this Makefile depends on Go 1.19 or more. At First, you should install Go.

$ make build
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].