Skip to content

Instantly share code, notes, and snippets.

@gsmurali
gsmurali / README.md
Created January 18, 2017 21:13 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


Index:

@gsmurali
gsmurali / gist:1116363c1cae293bccc818d15f857df2
Last active January 8, 2017 01:47
09 Linux Academy - Certified Chef Developer Basic Chef Fluency Badge- Lecture: Understanding Chef Cookbooks & Generating a Cookbook
#Cookbooks
+ A cookbook is the fundamental unit of configuration and policy distribution when using Chef
+ Cookbook contains
1. Recipes
1. Attribute Files
1. File distributions
1. Templates
1. Any extensions to Chef such as libraries and custom resources
+ Chef cookbook defines a scenario. For example, in case of an Apache cookbook
@gsmurali
gsmurali / gist:d7159fabbcc3e0535fa09d50472445f8
Last active January 7, 2017 18:09
08 Linux Academy - Certified Chef Developer Basic Chef Fluency Badge- Lecture: Understanding Chef Recipes and Run Lists
#Understanding Chef Recipes and Run Lists
+ Recipes are a collection of resources, defined and written using patterns.
+ Helper code, such as loops and if statements, can be written around those resources to help customize the configurations of specific nodes. For example, if or case statements around package names.
+ Recipe is the most fundamental configuration element within the organization
+ A recipe is created using Ruby
+ must define everything that is required to configure part of a system
+ Recipe stored in a cookbook
+ May be included in a recipe(include_recipe)
+ May use the results of a search query and read the contents of a data bag
+ May have a dependency on one (or more) recipes
@gsmurali
gsmurali / gist:c45fa1913ef9ef5b79ba78df057e0272
Last active January 8, 2017 01:51
06 Linux Academy - Certified Chef Developer Basic Chef Fluency Badge- Lecture: Working with not_if and only_if Guards
+Terminal log:
C:\Users\shinidharan\Documents\GitHub> ssh [email protected]
Warning: Permanently added '54.86.131.236' (ECDSA) to the list of known hosts
[email protected]'s password:
Last login: Wed Jan 4 05:06:13 2017 from c-76-104-43-10.hsd1.va.comcast.net
[user@gsmurali1 ~]$ vim learn.rb
[user@gsmurali1 ~]$ cat learn.rb
package 'apache' do
package_name 'httpd'
end
@gsmurali
gsmurali / gist:0e80095ad831c3ff86995b64adaa7991
Last active January 4, 2017 06:11
05 Linux Academy - Certified Chef Developer Basic Chef Fluency Badge- Lecture: Applying Chef Resources Hands On
[root@gsmurali1 user]# vim learn.rb
[root@gsmurali1 user]# cat learn.rb
package 'apache' do
end
This is the pre-convergence checks; to check ruby syntax and chef syntax
------------------------------------------------------------------------
[root@gsmurali1 user]# ruby -c learn.rb
Syntax OK
@gsmurali
gsmurali / gist:8d0bd3f2ee88f5950993fef91053adf1
Created January 4, 2017 04:17
02 Linux Academy - Certified Chef Developer Basic Chef Fluency Badge- Lecture: Understanding Chef and Chef Convergence
Convergence
*Pre-convergence - Phase before a node is configured. Lint tests, foodcritic
*Convergence - Tests the defined resources to ensure they are in the desired state,"Providers' are what do the work (yum, apt-get etc.,) to enforce the desired configuration
*Post-Convergence - Occurs after the Chef convergence - Run tests that verifies a node is in the desired state of configuration/ Unit testing
Chef can be run over and over again without changing configurations if configurations are already in place (Idempotency)
@gsmurali
gsmurali / gist:80dbad99e2d331bdbcbd09508116daa3
Last active January 3, 2017 00:51
01 Linux Academy - Certified Chef Developer Basic Chef Fluency Badge- Lecture: Setting up the Lab environment
Configure user 'user' for sudo access and change root password and user password
* use passwd command to change passwords for user and root
Add user 'user' to sudo
* usermod -g wheel user
Download chef development kit
* go to https://downloads.chef.io/chefdk/1.1.16 and copy url for RHEL - https://packages.chef.io/files/stable/chefdk/1.1.16/el/7/chefdk-1.1.16-1.el7.x86_64.rpm
wget the above link in the server to download the software
Install using the command - sudo rpm -ivh chefdk-1.1.16-1.el7.x86_64.rpm
To verify installation, type 'sudo chef-client --local-mode' (running chef-client in local mode)
@gsmurali
gsmurali / gist:3965c62d9f5eb4106045cf784a9d3246
Created January 2, 2017 23:13 — forked from mikepfeiffer/gist:7c949e2d04c9e51ef204fb9a7f3d2978
Userdata script to setup a basic web page with instance id and tag instance
#!/bin/bash
yum install httpd -y
/sbin/chkconfig --levels 235 httpd on
service httpd start
instanceId=$(curl http://169.254.169.254/latest/meta-data/instance-id)
region=$(curl http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | awk -F\" '{print $4}')
echo "<h1>$instanceId</h1>" > /var/www/html/index.html
aws ec2 create-tags --resources "$instanceId" --tags Key=Name,Value="PROD-$instanceId" --region "$region"
@gsmurali
gsmurali / gist:1f4d3cf116836943d0aede48aee54a68
Created January 2, 2017 23:12 — forked from mikepfeiffer/gist:6f9e6cac7607fc365874cd7d31dbb141
Example to Create AWS ELB, Launch Config, and Auto Scaling Group
aws elb create-load-balancer \
--load-balancer-name MyELB \
--listeners Protocol=TCP,LoadBalancerPort=80,InstanceProtocol=TCP,InstancePort=80 \
--subnets subnet-46e6506c subnet-57b8010f \
--scheme internet-facing \
--security-groups sg-aec570d4
aws autoscaling create-launch-configuration \
--launch-configuration-name MyLC \
--key-name virginia \
@gsmurali
gsmurali / gist:73b99ff8d6ed313579aae0bbc22f8f25
Created January 2, 2017 23:12 — forked from mikepfeiffer/gist:4aea8cba143ff31fa90a33ff4818b809
How to create and complete a lifecycle hook
aws autoscaling put-lifecycle-hook \
--lifecycle-hook-name scale-out-hook \
--auto-scaling-group-name MyASG \
--lifecycle-transition autoscaling:EC2_INSTANCE_LAUNCHING
aws autoscaling complete-lifecycle-action \
--lifecycle-action-result CONTINUE \
--instance-id i-0680775fb68bc97a5 \
--lifecycle-hook-name scale-out-hook \
--auto-scaling-group-name MyASG