NOTE: You can view the raw contents of a file by clicking on the Raw
button that appears above the file view.
curl -Lo https://raw.githubusercontent.com/path/to/file
# Create internet gateways, route tables, and corresponding ACLs in AWS VPC to secure our network. | |
# create internet gateway | |
aws ec2 create-internet-gateway | |
# attach internet gateway to a vpc | |
aws ec2 attach-internet-gateway --internet-gateway-id igw-06604b3e --vpc-id vpc-ad6bd2f7 | |
# create a route table | |
aws ec2 create-route-table --vpc-id vpc-ad6bd2f7 |
# example: installation of `kops` utility | |
curl -Lo kops https://github.com/kubernetes/kops/releases/download/$(curl -s https://api.github.com/repos/kubernetes/kops/releases/latest | grep tag_name | cut -d '"' -f 4)/kops-darwin-amd64 | |
chmod +x kops | |
sudo mv kops /usr/local/bin/kops |
apt update && apt upgrade # update apt utility and upgrade already installed packages | |
apt install python-pip # install tool | |
# tip: if unable to install older version of pip, run this: | |
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py; python get-pip.py |
cat /proc/meminfo # print memory info about the machine | |
sudo /etc/init.d/<app> start # start an app/service | |
sudo /etc/init.d/<app> stop # stop an app/service |
kubectl rollout restart deploy <release> # bounce a release | |
kubectl delete ns <name> # destroy a namespace |
vagrant --version | |
vagrant box add bento/ubuntu-14.04 # install Ubuntu image | |
vagrant init bento/ubuntu-14.04 # initialize image | |
vagrant up # run image | |
vagrant ssh # ssh into running container | |
# addition vagrant commands | |
vagrant status # check status of the VM | |
vagrant suspend # suspend the VM |
sudo chef-client --local-mode --runlist 'recipe[chef-workstation]' | |
sudo chef-client --help | |
# /etc/chef/client.rb => manages the execution of the chef client run |
# Copy this into an irb session for easy benchmark testing | |
require 'benchmark' | |
# @param labels_and_procs [Hash{String=>Proc}] | |
def bm_test(labels_and_procs, n = 1000, label_width = 7) | |
puts "running #{n} times" | |
::Benchmark.bm(label_width) do |x| | |
labels_and_procs.each do |label, proc| | |
x.report("#{label}:") { n.times { proc.call } } |
### Walkthrough #1: Create our first virtual machine in the cloud | |
# get list of commands useful for EC2 | |
aws ec2 help | grep "\sdescribe" | |
# create an SSH keypair for AWS | |
aws ec2 create-key-pair --key-name MyKeyPair --query 'KeyMaterial' --output text > MyKeyPair.pem | |
# verify that AWS knows about our newly created key | |
aws ec2 describe-key-pairs --key-name MyKeyPair |