Skip to content

Instantly share code, notes, and snippets.

@akbargit20
akbargit20 / Ubuntu 16.04
Created September 14, 2021 12:05 — forked from dhoeric/Ubuntu 16.04
install-docker-aws-ec2-user-data
#!/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
@akbargit20
akbargit20 / ec2_instance_create_and_setup.sh
Created August 27, 2021 05:02 — forked from Pablosan/ec2_instance_create_and_setup.sh
A bash script that will set up a new EC2 instance and ssh into it.
#!/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)
@akbargit20
akbargit20 / wp.sh
Created July 14, 2021 04:31 — forked from robertogalan/wp.sh
Shell script to install apache/mysql/php/wordpress into an EC2 instance of Amazon AMI Linux.
#! /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)"
@akbargit20
akbargit20 / AUTO_REGISTER_NAGIOS.md
Created June 22, 2021 09:11 — forked from ravibhure/AUTO_REGISTER_NAGIOS.md
How to use Nagios to monitor services running under AWS auto scaling group (ASG)

How to use Nagios to monitor services running under AWS auto scaling group (ASG)

What is expected from reader

The reader is expected to have basic knowledge about below technologies/concepts.

  • Nagios Core
  • AWS Auto Scaling Group (ASG)
  • PHP REST API
  • DevOps
@akbargit20
akbargit20 / installing-tomcat-7-on-amazon-linux-ami
Created June 17, 2021 07:01 — forked from eMahtab/installing-tomcat-7-on-amazon-linux-ami
Installing Tomcat 7 on Amazon Linux AMI through UserData
#!/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
@akbargit20
akbargit20 / lambda.py
Created June 8, 2021 05:19 — forked from mzupan/lambda.py
AWS Lambda job to backup RDS instances
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',
@akbargit20
akbargit20 / lambdaAMIBackups.py
Created June 8, 2021 05:18 — forked from bkozora/lambdaAMIBackups.py
AWS Lambda AMI Backups
# 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.
@akbargit20
akbargit20 / vpc-fargate.yaml
Created June 7, 2021 12:52 — forked from lizrice/vpc-fargate.yaml
Cloudformation template for setting up VPC and subnets for Fargate
# 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)
#