Last active
August 30, 2016 05:37
-
-
Save miztiik/0029ede6b994c25b089e351ef053c2cb to your computer and use it in GitHub Desktop.
chef-workstation-quick-setup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum install deltarpm wget unzip python-pip -y | |
cd /tmp | |
wget https://github.com/miztiik/Learn-Chef/blob/master/init/init.zip?raw=true -O init.zip | |
mv init.zip / | |
cd / | |
unzip init.zip | |
cd /chef-repo | |
# curl -L https://www.opscode.com/chef/install.sh | bash | |
curl -L https://www.opscode.com/chef/install.sh | bash -s -v 12.13.30 && rm install.sh | |
service chef-client restart | |
knife ssl check && knife client list | |
# Install AWS CLI | |
pip install awscli | |
# Install Boto | |
pip install -U boto | |
# Get the AWS EC2 plugin | |
## Set chef ruby as default in profile | |
export PATH="/opt/chefdk/embedded/bin:${HOME}/.chefdk/gem/ruby/2.1.0/bin:$PATH" | |
chef gem install knife-ec2 | |
# Configure AWS Profile | |
## in /chef-repo/.chef/knife.rb file | |
knife[:aws_access_key_id] = "Your_AWS_Access_Key" | |
knife[:aws_secret_access_key] = "Your_AWS_Secret_Access_Key" | |
# To set your default AWS region, | |
knife[:region] = "us-east-1" | |
# To set your instance launching keypair, | |
knife[:ssh_key_name] = "kum-key" | |
# Launch an instance | |
# This will launch a Red-Hat free tier instance | |
knife ec2 server create --image ami-2051294a \ | |
--ssh-key kum-key \ | |
--flavor t2.micro \ | |
--ssh-user ec2-user \ | |
--identity-file /chef-repo/.chef/kum-key.pem \ | |
--region us-east-1a \ | |
--node-name "webNode01" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Create an EC2 instance using Chef
knife