Skip to content

Instantly share code, notes, and snippets.

Avatar
🗽
/dev/urandom

Libert Schmidt libert-xyz

🗽
/dev/urandom
View GitHub Profile
@libert-xyz
libert-xyz / launch_ec2.py
Created Mar 15, 2021
Workflow to test custom roles in different AWS amis
View launch_ec2.py
import boto3
import time
##AWS
REGION="us-east-1"
PROFILE="default"
##AMI
AMIS=[
{"os": "centos7", "ami": "ami-0affd4508a5d2481b", "distro":"centos"},
@libert-xyz
libert-xyz / ipinfo.sh
Created Jan 21, 2021
bash script to get ip info using ipinfo.io API
View ipinfo.sh
#!/bin/bash
curl https://ipinfo.io/$1
@libert-xyz
libert-xyz / get_lastest-amazonLinux2-from-ssm.sh
Created Jul 1, 2020
Get the lastest Amazon Linux 2 AMI from SSM Parameter Store using AWS CLI
View get_lastest-amazonLinux2-from-ssm.sh
#!/bin/bash
aws ssm get-parameters --names /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2 --region us-east-1
@libert-xyz
libert-xyz / url_checker.sh
Created Jun 29, 2020
Check URL every second
View url_checker.sh
while true; do sleep 1; curl http://www.google.com; echo -e '\n\n\n'$(date);done
@libert-xyz
libert-xyz / cloudwatch-unified-linux-http.json
Created Jun 15, 2020
CloudWatch Unified Agent to collect httpd logs and metrics
View cloudwatch-unified-linux-http.json
{
"agent": {
"metrics_collection_interval": 60,
"run_as_user": "root"
},
"logs": {
"logs_collected": {
"files": {
"collect_list": [
{
View cfn-hup.yaml
AWSTemplateFormatVersion: '2010-09-09'
Description: AWS CloudFormation Sample Template for CFN Init
Parameters:
KeyName:
Description: Name of an existing EC2 KeyPair to enable SSH access to the instances
Type: AWS::EC2::KeyPair::KeyName
ConstraintDescription: must be the name of an existing EC2 KeyPair.
LatestLinuxAmiId:
Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
View cf-ssm-parameters-ami.yml
# read more at: https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-public-parameters.html
# this will pickup the latest value of the parameter every time the template is run
# the parameter value must be the Key for that Parameter. Then CFN will retrieve the value
# this does not support SecureString SSM Parameter types
Parameters:
LatestLinuxAmiId:
Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
# obtain list with
@libert-xyz
libert-xyz / ebs_resize.sh
Last active Jun 26, 2020
Resize EBS storage from the EC2 itself (Amazon Linux AMI release 2018.03)
View ebs_resize.sh
#!/bin/bash
# Specify the desired volume size in GiB as a command-line argument. If not specified, default to 20 GiB.
SIZE=${1:-20}
# Install the jq command-line JSON processor.
sudo yum -y install jq
# Get the ID of the envrionment host Amazon EC2 instance.
INSTANCEID=$(curl http://169.254.169.254/latest/meta-data//instance-id)
@libert-xyz
libert-xyz / vyprvpn_ec2.py
Created Nov 23, 2019
Launch 100 EC2 + EIP and install vyprVPN
View vyprvpn_ec2.py
import logging
import boto3
from botocore.exceptions import ClientError
import time
AMI='ami-0f93b5fd8f220e428'
SUBNET='subnet-8f5e56e7'
SG=['sg-0d5d78dc3b411252b']
REGION='us-east-2'
KEY='VyprVPN-us-east-2'
@libert-xyz
libert-xyz / eips-centos7
Created Sep 19, 2019
Multiple EIP in the same subnet (RHEL / Centos7)
View eips-centos7
https://www.internetstaff.com/multiple-ec2-network-interfaces-on-red-hat-centos-7/