The reader is expected to have basic knowledge about below technologies/concepts.
- Nagios Core
- AWS Auto Scaling Group (ASG)
- PHP REST API
- DevOps
| #!/bin/bash | |
| # Install docker | |
| apt-get update | |
| apt-get install -y apt-transport-https ca-certificates curl software-properties-common | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
| add-apt-repository \ | |
| "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | |
| $(lsb_release -cs) \ | |
| stable" | |
| apt-get update |
| #!/bin/bash | |
| # Authorize TCP, SSH & ICMP for default Security Group | |
| #ec2-authorize default -P icmp -t -1:-1 -s 0.0.0.0/0 | |
| #ec2-authorize default -P tcp -p 22 -s 0.0.0.0/0 | |
| # The Static IP Address for this instance: | |
| IP_ADDRESS=$(cat ~/.ec2/ip_address) | |
| # Create new t1.micro instance using ami-cef405a7 (64 bit Ubuntu Server 10.10 Maverick Meerkat) |
| #! /bin/bash | |
| # Shell script to install apache/mysql/php/wordpress into an EC2 instance of Amazon AMI Linux. | |
| # Step 1: Create an AWS EC2 instance | |
| # Step 2: ssh in like: ssh -v -i wordpress.pem [email protected] | |
| # Step 3: Run this as root/superuser, do sudo su | |
| echo "Shell script to install apache/mysql/php/wordpress into an EC2 instance of Amazon AMI Linux." | |
| echo "Please run as root, if you're not, choose N now and enter 'sudo su' before running the script." | |
| echo "Run script? (y/n)" |
| #!/bin/bash -v | |
| sudo yum update -y | |
| sudo yum install -y tomcat7-webapps tomcat7-docs-webapp tomcat7-admin-webapps | |
| sudo service tomcat7 start | |
| # Copying a war to /usr/share/tomcat7/webapps directory |
| import boto3 | |
| import datetime | |
| def lambda_handler(event, context): | |
| print("Connecting to RDS") | |
| client = boto3.client('rds') | |
| print("RDS snapshot backups stated at %s...\n" % datetime.datetime.now()) | |
| client.create_db_snapshot( | |
| DBInstanceIdentifier='web-platform-slave', |
| # Automated AMI Backups | |
| # | |
| # @author Bobby Kozora | |
| # | |
| # This script will search for all instances having a tag with the name "backup" | |
| # and value "Backup" on it. As soon as we have the instances list, we loop | |
| # through each instance | |
| # and create an AMI of it. Also, it will look for a "Retention" tag key which | |
| # will be used as a retention policy number in days. If there is no tag with | |
| # that name, it will use a 7 days default value for each AMI. |
| # Usage: | |
| # aws cloudformation --region <region> create-stack --stack-name <stack name> --template-body file://vpc-fargate.yaml | |
| # This template will: | |
| # Create a VPC with: | |
| # 2 Public Subnets | |
| # 2 Private Subnets | |
| # An Internet Gateway (with routes to it for Public Subnets) | |
| # A NAT Gateway for outbound access (with routes from Private Subnets set to use it) | |
| # |