dgulli / ami-builder-packer

An example of an AMI Builder using CI/CD with AWS CodePipeline, AWS CodeBuild, Hashicorp Packer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Purpose

This Packer AMI Builder creates a new AMI out of the latest Amazon Windows 2016 AMI, and also provides a cloudformation template that leverages AWS CodePipeline to orchestrate the entire process.

Source code structure

├── buildspec.yml                           <-- CodeBuild spec 
├── cloudformation                          
│   └── pipeline.yaml                       <-- Cloudformation to create entire pipeline
│   └── CodeBuild_VPC.yml                   <--- VPC for codebuild CFN template, if you dont alreayd have one.
├── packer_WinServer.json                   <-- Packer template for Pipeline
├── user_data.ps1                           <-- Powershell userdata
├── bootstrap.ps1                           <-- Powershell needed for WinRM bootstrap

Cloudformation template

Cloudformation will create the following resources as part of the AMI Builder for Packer:

  • cloudformation/pipeline.yaml
    • GitHub - Git repository
    • AWS CodeBuild - Downloads Packer and run Packer to build AMI
    • AWS CodePipeline - Orchestrates pipeline and listen for new commits in CodeCommit
    • Amazon SNS Topic - AMI Builds Notification via subscribed email
    • Amazon Cloudwatch Events Rule - Custom Event for AMI Builder that will trigger SNS upon AMI completion

HOWTO

Before you start

Launch the Cloudformation stack

Region AMI Builder Launch Template
Sydney (ap-southeast-2) Launch Stack

About

An example of an AMI Builder using CI/CD with AWS CodePipeline, AWS CodeBuild, Hashicorp Packer

License:Apache License 2.0


Languages

Language:PowerShell 100.0%