Following client script will help to publish message in sns topic
#!/usr/bin/env python
import boto3
import json
REGION = "eu-west-1"
-- Create database assignment | |
SELECT 'CREATE DATABASE assignment' | |
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'assignment')\gexec | |
-- Switch DATABASE | |
\c assignment | |
-- | |
-- Name: categories; Type: TABLE; Owner: -; Tablespace: |
#!/bin/bash | |
# This script will run from ec2 user data | |
# and it will deattach secondary network interface(ENI) | |
# from previous instance if any old instance found | |
# If ENI is not attach then it will not run deattach command | |
# at the last it will run eni attach command to add eni in current instance | |
# | |
# Note: Make sure to update ENI Name Tag in variable NAME_TAG |
Following client script will help to publish message in sns topic
#!/usr/bin/env python
import boto3
import json
REGION = "eu-west-1"
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
YesOrNo() { | |
while : | |
do | |
read -p 'Do you want to Continue (yes/no?): ' answer | |
case "${answer}" in | |
[yY]|[yY][eE][sS]) exit 0 ;; | |
[nN]|[nN][oO]) exit 1 ;; | |
esac | |
done | |
} |
flotToint() { | |
printf "%.0f\n" "$@" | |
} |
status_msg() { | |
local status=$? | |
local failed="$(tput bold)$(tput setf 4)[failed]$(tput sgr0)" | |
local succeeded="$(tput bold)$(tput setf 2)[succeeded]$(tput sgr0)" | |
(( $status == 0 )) && | |
echo $succeeded || | |
echo $failed | |
} |
GetTopProcess() { | |
ps --no-headers -eo "%cpu,%mem,cmd,etime" | | |
sort -t. -k1 -r | | |
head -10 | |
} |
CheckLoadadv() { | |
# Set threshold value | |
local Threshold=$1 | |
# if threshold not specify then take deafault 6 | |
(( $Threshold )) || Threshold=6 | |
# get input values from /proc/loadavg file | |
local Current_loadadv="$(cut -d" " -f1 /proc/loadavg )" | |
# take first value from inputdata | |
local Cur_int_loadadv="${Current_loadadv/.*}" |