Skip to content

Instantly share code, notes, and snippets.

@nathenharvey
Last active August 29, 2015 14:17
Show Gist options
  • Save nathenharvey/2aca1ac8f28b3836be63 to your computer and use it in GitHub Desktop.
Save nathenharvey/2aca1ac8f28b3836be63 to your computer and use it in GitHub Desktop.
---
driver:
name: ec2
aws_ssh_key_id: <%= ENV['AWS_KEYPAIR_NAME'] %>
transport.ssh_key: <%= ENV['AWS_KEY_PATH'] %>
provisioner:
name: chef_zero
platforms:
- name: centos-6.4
driver:
image_id: ami-0fd22064
availability_zone: us-east-1c
tags:
class: intro-to-chef
name: intro-to-chef
remove_after: '2015-06-16'
security_group_ids: ['sg-16899172']
<% number_of_students = 40 %>
<% count_of_instances = 0 %>
suites:
<%
%w[ ♣︎ ♠︎ ♥︎ ♦︎ ].each do |suit|
%w[ A K Q J 10 9 8 7 6 5 4 3 2].each do |symbol|
if count_of_instances < number_of_students %>
- name: <%= symbol %><%= suit %>
<% count_of_instances +=1 %>
<% end %>
<% end %>
<% end %>
@nathenharvey
Copy link
Author

  • Update line 21, change the value of number_of_students
  • Create the instances using kitchen create
  • Find the IP Addresses via knife with this command:

knife ec2 server list --region $AWS_REGION -A $AWS_ACCESS_KEY_ID -K $AWS_SECRET_ACCESS_KEY |grep $AWS_KEYPAIR_NAME | grep ami-3605295e | grep running |awk '{print $2}'

  • When you are done, destroy all the instances using kitchen destroy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment