Code Monkey home page Code Monkey logo

packer-winserver2016-ec2-ami-example's Introduction

Example of building a Windows Server 2016 AMI for EC2 using Packer

Packer makes building Linux AMIs extremely easy - it uses standard SSH under the hood to interact with a server throughout the build process and can seamlessly copy files, execute commands, etc. Windows, on the other hand, is a bit of a pain to get right with Packer, especially on AWS. You have to make sure you have everything configured just right, or things will not work and you'll be left wondering why.

The code in this repository is meant to give an example of a basic Windows Server 2016 AMI build for use on EC2 instances in AWS.

Details

  • server2016_template.json - this is actual Packer template JSON which will define what Packer should do when actually building out an AMI.
    • Note within this template that the last Provisioner step is to run specific EC2Launch scripts to SysPrep the instance. These scripts are available on all Windows Server 2016 AMIs provided by AWS, but EC2Launch is out of the scope of this example.
  • user_data.ps1 - this will run natively within the EC2 instance on first boot, exactly the same as if you defined UserData for an EC2 instance in the console, CloudFormation, or Terraform. This will be responsible for configuring WinRM and Windows Firewall to allow Packer to actually connect in to the EC2 instance and run the remaining steps in the process.
  • bootstrap.ps1 - this is an example PowerShell script which can be used in a Provisioner step of the Packer AMI build process. In order for this to work, you must first have successfully enabled and configured WinRM security via UserData execution.

Gotchas

  • Make sure that the proper ports are open between your network / computer and the EC2 instance which Packer is building to create your AMI. Specifically, you will need to make sure that ports required by WinRM are available.

Resources

There are a few different sites and resources I came across which helped me figure this out initially. They are listed here in no particular order:

packer-winserver2016-ec2-ami-example's People

Contributors

mda590 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.