Cookbooks and Packer config to create a workstation for use during Sysdig workshops. Thanks to the Chef team for letting us copy their code.
You'll need a valid ~/.aws/config
file that might look like:
[default]
region=us-east-1
aws_access_key_id = MYKEYID
aws_secret_access_key = MYACCESSKEY
You'll also need to export the name of you AWS KeyPair as AWS_KEYPAIR_NAME
.
# The name of the AWS KeyPair (your SSH key) to use for deployment
export AWS_KEYPAIR_NAME='your_aws_keypair_name'
You can find the current AMI IDs by running:
$ rake list:amis
This rake task updates the vendored cookbooks before building the AMIs.
$ rake cookbook:vendor
$ rake "ami:build[centos-7]"
$ rake "ami:build_all"
$ rake list:templates
centos-7
ubuntu-1604
ubuntu-1714
subscribers.yml
is a YAML file with account IDs to share an image with.
$ export AMI_ID=the_ami_id_generated_by_packer
$ rake ami:share
regions.yml
is a YAML file with regions to copy an image to. The source region is the region set in the config.yml
file, and the source image is the value of $AMI_ID
.
$ export AMI_ID=the_ami_id_generated_by_packer
$ rake ami:copy
This deploys a CloudFormation stack with the number of hosts and a TTL in days.
A template will be created in stacks/
with the arguments above using values from
config.yml
. An example, config.example.yml
, is included
# rake deploy[name,num_hosts,ttl]
$ export AMI_ID=the AMI_ID #(generated by the rake task "ami:build above)
$ rake "deploy[sysdigcts-stack,10,3]"
$ cat config.example.yml
---
contact: Your Name Here
dept: Marketing
project: Sysdig Workshops
region: us-east-1
sg: sg-57fa1720
subnet: subnet-dae6d691
type: t2.medium
$ rake "list:ips[sysdigcts-stack]"
workstation1: 54.172.141.159
workstation2: 54.87.195.76
workstation3: 54.91.122.177
workstation4: 54.86.46.187
workstation5: 54.227.190.60