#packer - November 2018

packerArchived
55 messages

Discuss Packer for building AMIs and Docker Images
Archive: https://archive.sweetops.com/packer/

November 2018
erik
erikalmost 8 years ago
@Erik Osterman (Cloud Posse) has joined the channel
erik
erikalmost 8 years ago
set the channel description: Discuss Packer for building AMIs and Docker Images
rohit
rohitalmost 8 years ago
@rohit has joined the channel
tamsky
tamskyalmost 8 years ago
@tamsky has joined the channel
catdevman
catdevmanalmost 8 years ago
@catdevman has joined the channel
Rohit Verma
Rohit Vermaalmost 8 years ago
@Rohit Verma has joined the channel
rohit
rohitalmost 8 years ago
so i am just thinking about creating a custom ami off of redhat ami in aws using packer
tamsky
tamskyalmost 8 years ago
😃
rohit
rohitalmost 8 years ago
anything i should know before i go down that path ?
tamsky
tamskyalmost 8 years ago
I'm not a huge fan of humans reading or writing json; I use a python tool that generates ephemeral packer.json files from version-controlled packer.yaml
https://gist.github.com/tamsky/c7df19684e5605023f2e
biggest additional feature that tool has is: it supports !include which encourages good re-use of code.
rohit
rohitalmost 8 years ago
what happens when you say !include ?
davidvasandani
davidvasandanialmost 8 years ago
@davidvasandani has joined the channel
joshmyers
joshmyersalmost 8 years ago
@joshmyers has joined the channel
joshmyers
joshmyersalmost 8 years ago
@rohit what are you wanting to accomplish?
jsanchez
jsanchezalmost 8 years ago
@jsanchez has joined the channel
rohit
rohitalmost 8 years ago
@joshmyers we are planning to encrypt our root volume and by default it is not
rohit
rohitalmost 8 years ago
so we are planning to create a custom ami off of redhat ami and also apply yum updates, install aws cli, chef-client so that when there is an autoscaling event it doesn't take lot of time
rohit
rohitalmost 8 years ago
so we are planning to solve 2 problems with this solution
joshmyers
joshmyersalmost 8 years ago
are going you going build in one account and distribute to others, or build in all accounts and regions?
joshmyers
joshmyersalmost 8 years ago
Have done 👆️ before and it was a royal PITA (namely because of some of the IAM policies we had in place)
joshmyers
joshmyersalmost 8 years ago
AMIs are region and account specific as are the KMS keys that are used
joshmyers
joshmyersalmost 8 years ago
At the time we had to write a wrapper script with packer to: provision new AMI and bootstrap, take that underlying EBS volume and create a new AMI out of that
joshmyers
joshmyersalmost 8 years ago
with a custom KMS key to allow for cross account policies
joshmyers
joshmyersalmost 8 years ago
(you couldn’t share a default KMS key across accounts AFAICR)
joshmyers
joshmyersalmost 8 years ago
I believe that this has been built natively into packer now though, not digged to see what it is doing under the covers
joshmyers
joshmyersalmost 8 years ago
Note that shunting AMIs around is slooooowww
joshmyers
joshmyersalmost 8 years ago
are you planning on doing this for each Chef role you have? There is overhead in managing all those AMIs (pruning script or the like)
joshmyers
joshmyersalmost 8 years ago
how do your cookbooks end up on the instances in the ASG?
rohit
rohitalmost 8 years ago
this will be for one aws account but in multiple regions
rohit
rohitalmost 8 years ago
we would only install chef-client but the cookbook will end up later when the ami is used in a launch template
rohit
rohitalmost 8 years ago
makes sense ?
joshmyers
joshmyersalmost 8 years ago
Yeah, you want to block for the entire first chef run on a node before it is provisioned
joshmyers
joshmyersalmost 8 years ago
You are going to have to shunt AMIs around regions
joshmyers
joshmyersalmost 8 years ago
How long does your Chef bootstrap run take?
rohit
rohitalmost 8 years ago
chef bootstrap currently takes somewhere aroung 8-10 mins
rohit
rohitalmost 8 years ago
because the user data includes yum updates, instaling awscli, installing chef-client
rohit
rohitalmost 8 years ago
by creating the custom ami we are planning to reduce this time
rohit
rohitalmost 8 years ago
now that you know my usecase, is there an example that you could recommend ?
joshmyers
joshmyersalmost 8 years ago
well, if you are going down this route, may as well do a first chef run during packer build, right?
joshmyers
joshmyersalmost 8 years ago
Even if you don’t do it for each role you have, there is a lot common base across all I’m sure.
joshmyers
joshmyersalmost 8 years ago
Can take an initial chef run from 10mins to 1 min or so
joshmyers
joshmyersalmost 8 years ago
Basically updates and anything on top of base
rohit
rohitalmost 8 years ago
no, we don't want to do that because then we will have to create an AMI for each app
joshmyers
joshmyersalmost 8 years ago
how much do you care about it being the exact same artefact in different regions/accounts vs building in each
joshmyers
joshmyersalmost 8 years ago
each app or each role?
joshmyers
joshmyersalmost 8 years ago
even if you do base, the common denominator between all your roles will shave some time off that first run
joshmyers
joshmyersalmost 8 years ago(edited)
Also not suggesting baking apps into the AMI
joshmyers
joshmyersalmost 8 years ago(edited)
or do you use Chef runs for app deployments?
rohit
rohitalmost 8 years ago
we use chef run for app deployments
joshmyers
joshmyersalmost 8 years ago
You may want to split that out.
rohit
rohitalmost 8 years ago
we use chef to pull/extract artifact from artifactory
joshmyers
joshmyersalmost 8 years ago
OK, I’d look into benefits of splitting out that deployment process
joshmyers
joshmyersalmost 8 years ago
do a base role during packer build and have cloud-init pull in the extra role to add on?
erik
erikalmost 8 years ago
set the channel topic: :packer:
tamsky
tamskyalmost 8 years ago(edited)

do a base role during packer build and have cloud-init pull in the extra role to add on?


I've typically followed this pattern as well, @rohit -- a base image, also built by packer, that other app-specific images use as their source_ami when they get built in packer.
No earlier messagesBrowse by dateDecember 2018