Skip to content

Instantly share code, notes, and snippets.

View eugenestarchenko's full-sized avatar
🇺🇦
#StandWithUkraine

Eugene Starchenko eugenestarchenko

🇺🇦
#StandWithUkraine
View GitHub Profile
@eugenestarchenko
eugenestarchenko / Vagrantfile
Created March 22, 2016 20:59 — forked from tvjames/Vagrantfile
Prepare a Windows Server 2008 R2 instance for use with vagrant-windows.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@eugenestarchenko
eugenestarchenko / Vagrantfile
Created March 23, 2016 01:06 — forked from roblayton/Vagrantfile
A Vagrant multi-machine cluster using a loop
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
cluster = {
"master" => { :ip => "192.168.33.10", :cpus => 1, :mem => 1024 },
"slave" => { :ip => "192.168.33.11", :cpus => 1, :mem => 1024 }
}
@eugenestarchenko
eugenestarchenko / ansible-aws.md
Created June 15, 2016 15:07 — forked from diegopacheco/ansible-aws.md
How to Install Ansible on Amazon Linux / CentOS?
sudo su
yum update
yum install -y git
cd /usr/local/src
yum -y install git python-jinja2 python-paramiko PyYAML make MySQL-python
git clone git://github.com/ansible/ansible.git
cd ansible
git submodule update --init --recursive
make install
@eugenestarchenko
eugenestarchenko / IAM
Created June 30, 2016 12:45 — forked from kellyselden/IAM
Only run EC2 instances during work hours
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt123456789",
"Effect": "Allow",
"Action": [
"ec2:StartInstances",
"ec2:StopInstances",
"ec2:DescribeInstances"
@eugenestarchenko
eugenestarchenko / s3.sh
Created July 14, 2016 22:21 — forked from chrismdp/s3.sh
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@eugenestarchenko
eugenestarchenko / install-nodejs-amazon-ec2-centos
Created July 28, 2016 11:18 — forked from douglascorrea/install-nodejs-amazon-ec2-centos
Install NodeJS on Amazon Linux EC2 (CentOS)
sudo yum install openssl openssl-devel
sudo yum groupinstall "Development Tools"
sudo yum install git-core
git clone git@github.com:nodejs/node.git
cd node
./configure
make
@eugenestarchenko
eugenestarchenko / update_elb_ssl_neg_policies.sh
Created September 26, 2016 13:03 — forked from richadams/update_elb_ssl_neg_policies.sh
A quick and dirty script to update every ELB in an AWS account to the latest ELBSecurityPolicy-2014-10 to mitigate CVE-2014-3566. Barely tested, use at own risk, etc. Requires awscli to be installed.
#!/bin/bash
# Requires: awscli (http://aws.amazon.com/cli/)
# Your AWS credentials
export AWS_ACCESS_KEY_ID='***'
export AWS_SECRET_ACCESS_KEY='***'
# This is the base policy that will be used.
POLICY="ELBSecurityPolicy-2014-10"
@eugenestarchenko
eugenestarchenko / verify_elb_https.py
Created September 27, 2016 14:03 — forked from lqez/verify_elb_https.py
Verify ELB's https connection
import boto.route53
import boto.ec2.elb
import requests
region = 'ap-northeast-1'
# Get all records from Route53
r53_conn = boto.route53.connect_to_region(region)
zones = r53_conn.get_zones()
+resource "null_resource" "user_management_credstash" {
+ count = "${var.enabled * var.enable_user_management * length(split(",", var.environments))}"
+
+ lifecycle {
+ create_before_destroy = true
+ }
+
+ triggers {
+ region = "${var.aws_region}"
+ environment = "${element(split(",", var.environments))}"
@eugenestarchenko
eugenestarchenko / template.json
Created December 1, 2016 14:50 — forked from sebdah/template.json
EC2 Windows - Joining a domain via cfn-init
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [
"<powershell>\n",
"pip install -U cumulus-bundle-handler\n",
"# Join the AD domain\n",
"$password = \"MyPassW0rd\" | ConvertTo-SecureString -asPlainText -Force\n",
"$username = \"example.com\\username\"\n",
"$credential = New-Object System.Management.Automation.PSCredential($username,$password)\n",
"Add-Computer -domainname example.com -OUPath \"OU=Servers,OU=Resources,OU=ORGANIZATION,DC=example,DC=com\" -Credential $credential -passthru \n",