Skip to content

Instantly share code, notes, and snippets.

View slashr's full-sized avatar

Akash Nair slashr

View GitHub Profile
import boto3
import logging
#Simple logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
#Create EC2 connection object
ec2 = boto3.resource('ec2')
import boto3
import logging
#Simple logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
#Create EC2 connection object
ec2 = boto3.resource('ec2')
@slashr
slashr / restrict-ec2-access-to-region.json
Created July 6, 2016 11:51
Restrict User's EC2 access to a specific region
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:*"
],
"Condition": {
"StringEqualsIgnoreCase": {
@slashr
slashr / logstash.conf
Created June 16, 2016 06:47
Logstash Configuration File to Analyze ELB Logs
input {
s3 {
bucket => "elb-logs-bucket-name"
region => "us-east-1"
codec => "line"
interval => 30
}
}
filter {
mutate { replace => { "type" => "elb" } }
---
- hosts: test
remote_user: ubuntu
become: yes
tasks:
- apt: name=apache2 state=present
become: yes
become_method: sudo
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Parameters" : {
"KeyName": {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance",
"Type": "AWS::EC2::KeyPair::KeyName",
"ConstraintDescription" : "Can contain only ASCII characters."
},
"InstanceType" : {
"Description" : "WebServer EC2 instance type",
~/skywide/
|-- .ebextensions
| `-- django.config
|-- skywide
| |-- __init__.py
| |-- settings.py
| |-- urls.py
| `-- wsgi.py
|-- db.sqlite3
|-- manage.py
@slashr
slashr / django.config
Created April 20, 2016 06:45
~/skywide/.ebextensions/django.config
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: skywide/wsgi.py
Host git-codecommit.*.amazonaws.com
User <SSH Key ID>
IdentityFile ~/.ssh/code_commit
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "ec2:DescribeInstances",
"Resource": "*"
},
{
"Effect": "Allow",