Skip to content

Instantly share code, notes, and snippets.

@rashidcmb
rashidcmb / tag-ebs-with-ec2-tagName.py
Last active October 25, 2018 15:12
This simple python script will update the Name tags of EBS volume with attached EC2 instance Name tag.
import boto3
ec2 = boto3.resource('ec2',region_name='us-east-1')
for volume in ec2.volumes.all():
vol = ec2.Volume(volume.id)
ebsId = volume.id
for v in vol.attachments:
ec2Id = v["InstanceId"]
ec2instance = ec2.Instance(ec2Id)
if ec2Id is not None:
for tags in ec2instance.tags:
@rashidcmb
rashidcmb / monitoring.sh
Last active September 24, 2019 13:53
Shell Script to Install Grafana, Prometheus and Alertmanager
#!/bin/bash
## Get Host IP to be used in alertmanager and prometheus
ip=$(ifconfig | grep "inet " | grep 10 | awk '{print $2}')
## Create Folder for prometheus database
mkdir /prom-data
chmod 777 /prom-data/
## install grafana
yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.6.3-1.x86_64.rpm
systemctl enable grafana-server