draios / sysdig-workshop-infra

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sysdig Workstation

Cookbooks and Packer config to create a workstation for use during Sysdig workshops. Thanks to the Chef team for letting us copy their code.

Pre-requisites

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'

Current Amazon Machine Image IDs

You can find the current AMI IDs by running:

$ rake list:amis

Build the Amazon Machine Images (AMIs)

This rake task updates the vendored cookbooks before building the AMIs.

$ rake cookbook:vendor

To create a single AMI

$ rake "ami:build[centos-7]"

To build all AMIs

$ rake "ami:build_all"

List available templates

$ rake list:templates
centos-7
ubuntu-1604
ubuntu-1714

Share the AMIs with other Amazon accounts

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

Copy the AMIs other Amazon regions

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

Deploy the CloudFormation stack

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

List Workstation IPs for a CloudFormation stack

$ 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

About


Languages

Language:Ruby 64.9%Language:HTML 27.7%Language:Shell 5.9%Language:Dockerfile 1.4%