Skip to content

Instantly share code, notes, and snippets.

Sébastien Stormacq sebsto

Block or report user

Report or block sebsto

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sebsto
sebsto / gist:2b7516a61db432ebe77c
Last active Aug 29, 2015
Install Python 2.7 on Amazon Linux 2014.03
View gist:2b7516a61db432ebe77c
#credits to: http://www.lecloud.net/post/61401763496/install-update-to-python-2-7-and-latest-pip-on-ec2
# install build tools (stick to a specific version to avoid environment drift)
# yum install -y make automake gcc gcc-c++ kernel-devel git
yum install -y make-1:3.81-20.7.amzn1.x86_64 \
automake-1.13.4-2.14.amzn1.noarch \
gcc48-4.8.2-7.87.amzn1.x86_64 \
gcc48-c++-4.8.2-7.87.amzn1.x86_64 \
kernel-devel-3.10.48-55.140.amzn1.x86_64 \
git-1.8.3.1-2.37.amzn1.x86_64
@sebsto
sebsto / gist:19b99f1fa1f32cae5d00
Created Aug 8, 2014
Install Maven with Yum on Amazon Linux
View gist:19b99f1fa1f32cae5d00
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
sudo yum install -y apache-maven
mvn --version
@sebsto
sebsto / gist:c41461767273451cbdad
Last active Nov 2, 2016
EB Command Line Tool Installation
View gist:c41461767273451cbdad
# Set working directory
cd /home/ec2-user
# Install EB Command line tool
wget https://s3.amazonaws.com/elasticbeanstalk/cli/AWS-ElasticBeanstalk-CLI-2.6.3.zip
unzip AWS-ElasticBeanstalk-CLI-2.6.3.zip
sed -i -e "/PATH=/ aPATH=\$PATH:/home/ec2-user/AWS-ElasticBeanstalk-CLI-2.6.3/eb/linux/python2.7" /home/ec2-user/.bash_profile
chown -R ec2-user:ec2-user /home/ec2-user/.elasticbeanstalk && chown -R ec2-user:ec2-user /home/ec2-user/AWS-ElasticBeanstalk-CLI-2.6.3 && chmod 744 /home/ec2-user/AWS-ElasticBeanstalk-CLI-2.6.3/eb/linux/python2.7/eb
# Install Python 2.7
@sebsto
sebsto / gist:9a958ff1c761b8c7c90d
Last active Jan 21, 2019
Create IAM User and Attach a Policy using Boto and JSON
View gist:9a958ff1c761b8c7c90d
import json, boto
# Connect to IAM with boto
iam = boto.connect_iam(ACCESS_KEY, SECRET_KEY)
# Create user
user_response = iam.create_user('aws-user')
# Create Policy
policy = { 'Version' : '2012-10-17'}
@sebsto
sebsto / gist:947f8cf66b4b4d4e82bc
Last active Aug 29, 2015 — forked from anamorph/gist:699dbae01ff0f4942acc
Human Readable S3 Bucket Size (don't do that on very large buckets ! :-) )
View gist:947f8cf66b4b4d4e82bc
aws s3api list-objects --bucket $BUCKETNAME --query 'sum(Contents[].Size)' | awk '{print $0/1024/1024/1024" GB"}'
@sebsto
sebsto / gist:20e550876db521710186
Created Feb 12, 2015
Block users access to AWS EC2 meta data
View gist:20e550876db521710186
sudo iptables -A OUTPUT -m owner ! --uid-owner root -d 169.254.169.254 -j DROP
@sebsto
sebsto / gist:505c91bf53bc77c4b921
Created Feb 12, 2015
Select two AZ with a default subnet in (comma separated)
View gist:505c91bf53bc77c4b921
aws ec2 describe-subnets --query 'Subnets[?DefaultForAz == `true`] | @[0:2][].AvailabilityZone' --output text | sed -e 's/\t/,/g’
@sebsto
sebsto / gist:468670c7c0d5feeade69
Created Mar 20, 2015
AWS CLI : discover your service limits from the command line
View gist:468670c7c0d5feeade69
aws support describe-trusted-advisor-check-result --check-id eW7HH0l7J9 --query 'result.sort_by(flaggedResources[?status!="ok"],&metadata[2])[].metadata' --output table --region us-east-1
@sebsto
sebsto / gist:eb48357f0bb24db8b2bf
Created Apr 28, 2015
Find all instances without a specific tag / with a specific tag
View gist:eb48357f0bb24db8b2bf
aws ec2 describe-instances --query 'Reservations[?Instances[?length(Tags[?Key==`Environment`]) == `0`]].Instances[].InstanceId'
aws ec2 describe-instances --query 'Reservations[?Instances[?Tags[?Key==`Environment`]]].Instances[].InstanceId'
@sebsto
sebsto / gist:67a43fc7fba1ff258560
Created Mar 5, 2016
Is your account using long EC2 IDs ?
View gist:67a43fc7fba1ff258560
# $ aws --version
# aws-cli/1.10.8 Python/2.7.11 Darwin/15.3.0 botocore/1.3.30
REGIONS=$(aws ec2 describe-regions --query 'Regions[].RegionName' --output text)
for R in $REGIONS ; do echo $R; aws ec2 describe-id-format --region $R --output text; done
You can’t perform that action at this time.