Skip to content

Instantly share code, notes, and snippets.

@mithereal
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mithereal/542e24104ebd6cb040d9 to your computer and use it in GitHub Desktop.
Save mithereal/542e24104ebd6cb040d9 to your computer and use it in GitHub Desktop.
aws ubuntu vagarant box with erlang and php5
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrant on AWS
# Jason Clark
# This sample sets up 1 VM ('delta') with erlang, and apache installed.
# Adjustable settings
CFG_TZ = "US/Pacific" # timezone, like US/Pacific, US/Eastern, UTC, Europe/Warsaw, etc.
# Provisioning script
node_script = <<SCRIPT
#!/bin/bash
echo Please Wait while Service is Provisioned
# set timezone
echo "#{CFG_TZ}" > /etc/timezone
dpkg-reconfigure -f noninteractive tzdata
# install a few base packages
apt-get update
apt-get install vim curl zip unzip git python-pip apache2 php5 libapache2-mod-php5 php5-mcrypt wget -y
wget https://github.com/mithereal/ubuntu-erlang-dependency-installer/blob/master/install-erlang-deps.sh -O install-erlang-deps.sh
chmod +x ./install-erlang-deps.sh
./install-erlang-deps.sh
git clone git://github.com/erlang/otp.git
cd otp
# Bourne Shell
export ERL_TOP=$PWD
export PATH=$ERL_TOP/bin:$PATH
# C Shell
setenv ERL_TOP $PWD
setenv PATH $ERL_TOP/bin:$PATH
./otp_build autoconf
./configure
make
echo Provisioning is complete
SCRIPT
# Configure VM server
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define :delta do |x|
x.vm.box = "hashicorp/precise64"
x.vm.hostname = "delta"
x.vm.provision :shell, :inline => node_script
x.vm.provider :virtualbox do |v|
v.name = "delta"
end
x.vm.provider :aws do |aws, override|
aws.access_key_id = ENV['AWS_KEY']
aws.secret_access_key = ENV['AWS_SECRET']
aws.keypair_name = ENV['AWS_KEYNAME']
aws.ami = "ami-a7fdfee2"
aws.region = "us-west-2"
aws.instance_type = "t2.micro"
# aws.availability_zone = ""
# aws.instance_ready_timeout = "120"
# aws.instance_package_timeout = "600"
# aws.private_ip_address = ""
# aws.elastic_ip = ""
# aws.security_groups = ""
# aws.iam_instance_profile_arn = ""
# aws.iam_instance_profile_name = ""
# aws.subnet_id = ""
# aws.user_data = "#!/bin/bash\necho 'got user data' > /tmp/user_data.log\necho"
# aws.user_data = File.read("user_data.txt")
# aws.associate_public_ip = ""
# aws.tags = ""
# aws.package_tags = {
# 'Name' => 'Some Name',
# 'Some Key' => 'Some Value'
# }
# aws.use_iam_profile = ""
# aws.block_device_mapping = [{ 'DeviceName' => '/dev/sda1', 'Ebs.VolumeSize' => 50 }]
# aws.elb = "production-web"
override.vm.box = "dummy"
override.ssh.username = "ubuntu"
override.ssh.private_key_path = ENV['AWS_KEYPATH']
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment