Skip to content

Instantly share code, notes, and snippets.

View luis02lopez's full-sized avatar
😎

Luis López luis02lopez

😎
View GitHub Profile
@luis02lopez
luis02lopez / cw-agent-install.sh
Created July 6, 2020 15:51
Automated install of Cloudwatch agent in Amazon Linux
yum install -y wget
wget https://s3.amazonaws.com/amazoncloudwatch-agent/assets/amazon-cloudwatch-agent.gpg -qP /tmp/cwagent
# Key value check
key_value=$(gpg --import /tmp/cwagent/amazon-cloudwatch-agent.gpg |& grep -Po '(3B789C72)')
if [ "$key_value" = "3B789C72" ]; then
echo "Good key value, proceeding."
# Public key fingerprint check
key_fingerprint=$(gpg --fingerprint $key_value |& grep -Po '(9376 16F3 450B 7D80 6CBD 9725 D581 6730 3B78 9C72)')
@luis02lopez
luis02lopez / AWS CLI List running EC2
Created June 2, 2020 19:52
List EC2 running instances and only displaying ID, Name and Status.
aws ec2 describe-instances --filters "Name=instance-state-name, Values=running" --query 'Reservations[*].Instances[*].{ID:InstanceId,Name:Tags[?Key==`Name`]|[*].Value,Type:InstanceType,Status:State.Name}' --output json