Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Myvmworld - Packer demo
"builders": [
{
"type": "amazon-ebs",
"region": "eu-central-1",
"source_ami": "ami-0f2ff760",
"instance_type": "t2.micro",
"ami_name": "windows-base-{{timestamp}}",
"user_data_file":"scripts/ec2-userdata.ps1",
"security_group_id":"sg-4e700e25",
"communicator": "winrm",
"winrm_username": "packer",
"winrm_password": "MySuperPassword",
"winrm_use_ssl": true,
"winrm_insecure": true,
"access_key": "MyAWSAccessKey",
"secret_key": "MyAWSSecretKey"
}
]
> packer
usage: packer [--version] [--help] <command> [<args>]
Available commands are:
    build build image(s) from template
    fix fixes templates from old versions of packer
    inspect see components of a template
    push push a template and supporting files to a Packer build service
    validate check that a template is valid
    version Prints the Packer version
==> amazon-ebs: Prevalidating AMI Name...
       amazon-ebs: Found Image ID: ami-4703ad28
==> amazon-ebs: Creating temporary keypair: packer_59b170e0-79ff-cc92-ab38-1b2b0d1d0bb6
==> amazon-ebs: Creating temporary security group for this instance...
==> amazon-ebs: Authorizing access to port 5986 the temporary security group...
==> amazon-ebs: Launching a source AWS instance...
      amazon-ebs: Instance ID: i-05bc36e34c65ecbe4
==> amazon-ebs: Waiting for instance (i-05bc36e34c65ecbe4) to become ready...
==> amazon-ebs: Adding tags to source instance
==> amazon-ebs: Skipping waiting for password since WinRM password set...
==> amazon-ebs: Waiting for WinRM to become available...
==> amazon-ebs: Connected to WinRM!
==> amazon-ebs: Provisioning with Powershell...
==> amazon-ebs: Provisioning with shell script: scripts/configure_PSGallery.ps1
      amazon-ebs: #< CLIXML
      amazon-ebs: [script.ps1] Executing script
      amazon-ebs: [script.ps1] Installing Package Provider NuGet       amazon-ebs:       [script.ps1]       Installing Package Provider NuGet
...

==> amazon-ebs: Stopping the source instance...
==> amazon-ebs: Waiting for the instance to stop...
==> amazon-ebs: Creating the AMI: windows-base-1504800991
       amazon-ebs: AMI: ami-cd6dd9a2
==> amazon-ebs: Waiting for AMI to become ready...
==> amazon-ebs: Terminating the source AWS instance...
==> amazon-ebs: Cleaning up any extra volumes...
==> amazon-ebs: No volumes to clean up, skipping
==> amazon-ebs: Deleting temporary security group...
==> amazon-ebs: Deleting temporary keypair...
Build 'amazon-ebs' finished.

==> Builds finished. The artifacts of successful builds are:
--> amazon-ebs: AMIs were created:

eu-central-1: ami-cd6dd9a2
"provisioners": [
{
"type": "powershell",
"scripts": [
"scripts/configure_PSGallery.ps1",
"scripts/install_ps_modules.ps1",
"scripts/DSC_choco_applications.ps1",
"scripts/DSC_install_microsoft_updates.ps1"
]
},
{
"type": "windows-restart",
"restart_timeout": "20m"
},
{
"type": "powershell",
"inline": [
"C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\InitializeInstance.ps1 -Schedule",
"C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\SysprepInstance.ps1 -NoShutdown"
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment