This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# ---------------------------------------------------- | |
# | |
# Automated setup for a Ubuntu server with git, ruby, rvm, nginx. | |
# (Used at Carbonmade) | |
# | |
# Usage: | |
# - SCP this file to your server: scp ubuntu_setup.sh you@server:~ | |
# - Make it executable: chmod +x ubuntu_setup.sh | |
# - Run it: bash ubuntu_setup.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'syslog' | |
require 'net/http' | |
require 'aws-sdk' | |
Syslog.open | |
AWS.config({ | |
:access_key_id => '<iam user key>', | |
:secret_access_key => '<iam user secret>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
AWSTemplateFormatVersion: 2010-09-09 | |
Description: > | |
A basic CloudFormation template for an RDS Aurora cluster. | |
Parameters: | |
DatabaseUsername: | |
AllowedPattern: "[a-zA-Z0-9]+" | |
ConstraintDescription: must be between 1 to 16 alphanumeric characters. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################ | |
# Instance info | |
############################################ | |
INSTANCE_ID=$(/usr/bin/curl -s http://169.254.169.254/latest/meta-data/instance-id) | |
EC2_AVAIL_ZONE=`/usr/bin/curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone` | |
REGION="`echo \"$EC2_AVAIL_ZONE\" | /bin/sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:'`" | |
ENI_ID="${ENI_ID}" # have terraform or whatever you're using provide this | |
ENI_IP=$(/usr/bin/aws ec2 describe-network-interfaces --region=${REGION} | \ | |
/usr/bin/jq -cr --arg i "${ENI_ID}" '.NetworkInterfaces[]|select(.NetworkInterfaceId==$i).PrivateIpAddress') | |
NETCIDR="${ENI_IP%.*}.0/24" # yeah, it's defaults for my network, put in whatever it is for you |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_iam_role_policy" "policy_allow_all_ssm" { | |
name = "IAM_POLICY_ALLOW_ALL_SSM" | |
role = "${aws_iam_role.iam_role_adwriter.id}" | |
policy = <<EOF | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "AllowAccessToSSM", | |
"Effect": "Allow", |