Last active
December 13, 2015 16:59
-
-
Save steveodom/4944432 to your computer and use it in GitHub Desktop.
CloudFormation template to bootstrap Neo4j and redis. Based on neo4j-puppet template. (https://github.com/neo4j-contrib/neo4j-puppet/blob/master/cf_template.json).
This file contains hidden or 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
{ | |
"Description": "Neo4j on AWS - creates a stack and deploys Neo4j on it", | |
"Parameters": { | |
"AcceptOracleLicense" : { | |
"Description" : "This parameter indicates that you accept the terms of Oracle's License Agreement for Java (see README)", | |
"Type" : "String", | |
"AllowedValues": ["true", "false"], | |
"Default": "true" | |
}, | |
"Neo4jUserName": { | |
"Description" : "Username for the Neo4j REST API", | |
"Type" : "String" | |
}, | |
"Neo4jPassword": { | |
"Description" : "Password for the Neo4j REST API", | |
"Type" : "String", | |
"NoEcho": "True" | |
}, | |
"SSHKeyName": { | |
"Description" : "Name of the SSH key that you will use to access the server (must be on AWS US-EAST already)", | |
"Type" : "String", | |
"Default": "neo4j" | |
}, | |
"RedisPassword": { | |
"Description" : "Password to connect with Redis. Should be really long", | |
"Type" : "String", | |
"NoEcho" : "True" | |
}, | |
"AwsAvailabilityZone": { | |
"Description": "Name of the AWS availability zone that you will deploy into", | |
"Type": "String", | |
"AllowedValues": ["us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d"], | |
"Default": "us-east-1d" | |
} | |
}, | |
"Resources": { | |
"ElasticIP": { | |
"Type": "AWS::EC2::EIP", | |
"Properties": { | |
"InstanceId": { | |
"Ref": "Server" | |
} | |
} | |
}, | |
"Server": { | |
"Type": "AWS::EC2::Instance", | |
"Properties": { | |
"AvailabilityZone": {"Ref": "AwsAvailabilityZone"}, | |
"DisableApiTermination": "FALSE", | |
"ImageId": "ami-d726abbe", | |
"InstanceType": "m1.small", | |
"KeyName": {"Ref": "SSHKeyName"}, | |
"Monitoring": "false", | |
"SecurityGroups": [ | |
{ | |
"Ref": "sgNeo4jServer" | |
} | |
], | |
"Tags": [ | |
{ | |
"Key": "Name", | |
"Value": "Neo4j on AWS" | |
} | |
], | |
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [ | |
"#!/bin/bash -v\n", | |
"wget -O /var/tmp/go https://raw.github.com/neo4j-contrib/neo4j-puppet/master/go\n", | |
"chmod +x /var/tmp/go\n", | |
"sudo /var/tmp/go ", { "Ref" : "AcceptOracleLicense" } , " ", {"Ref": "Neo4jUserName"}, " ", {"Ref": "Neo4jPassword"}, "\n", | |
"sudo echo 'deb http://packages.dotdeb.org squeeze all' >> /etc/apt/sources.list.d/dotdeb.org.list\n", | |
"sudo echo 'deb-src http://packages.dotdeb.org squeeze all' >> /etc/apt/sources.list.d/dotdeb.org.list\n", | |
"wget -q -O - http://www.dotdeb.org/dotdeb.gpg | sudo apt-key add -\n", | |
"sudo apt-get update\n", | |
"sudo apt-get install redis-server\n", | |
"sudo sed -i 's/# requirepass foobared/", "requirepass ", { "Ref" : "RedisPassword" } , "/g' /etc/redis/redis.conf \n", | |
"sudo sed -i 's/127.0.0.1/0.0.0.0/g' /etc/redis/redis.conf\n", | |
"sudo /etc/init.d/redis-server restart" | |
]]}}, | |
"Volumes" : [ | |
{ "VolumeId" : { "Ref" : "EBSVolume" }, | |
"Device" : "/dev/sdj" | |
}] | |
} | |
}, | |
"EBSVolume": { | |
"Type": "AWS::EC2::Volume", | |
"Properties": { | |
"AvailabilityZone": {"Ref": "AwsAvailabilityZone"}, | |
"Size": "20" | |
} | |
}, | |
"sgNeo4jServer": { | |
"Type": "AWS::EC2::SecurityGroup", | |
"Properties": { | |
"GroupDescription": "Neo4j Ports", | |
"SecurityGroupIngress": [ | |
{ | |
"IpProtocol": "tcp", | |
"FromPort": "22", | |
"ToPort": "22", | |
"CidrIp": "0.0.0.0/0" | |
}, | |
{ | |
"IpProtocol": "tcp", | |
"FromPort": "7474", | |
"ToPort": "7474", | |
"CidrIp": "0.0.0.0/0" | |
}, | |
{ | |
"IpProtocol": "tcp", | |
"FromPort": "6379", | |
"ToPort": "6379", | |
"CidrIp": "0.0.0.0/0" | |
} | |
] | |
} | |
} | |
}, | |
"Outputs": { | |
"Neo4jEndPoint" : { | |
"Value" : { "Fn::Join" : ["", ["http://", { "Fn::GetAtt" : [ "Server", "PublicIp" ]}, ":7474/db/data"]] }, | |
"Description" : "This is the address of your Neo4j server, that your application will use." | |
}, | |
"SshAccess": { | |
"Value" : {"Fn::Join" : ["", ["ssh -i ", {"Ref": "SSHKeyName"}, ".pem -l ubuntu ", { "Fn::GetAtt" : [ "Server", "PublicIp" ]}]]}, | |
"Description" : "This is how you gain remote access to the machine." | |
} | |
}, | |
"AWSTemplateFormatVersion": "2010-09-09" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment