Permalink
Browse files

Initial open source release.

  • Loading branch information...
jjpersch committed Jan 11, 2016
0 parents commit 0a3159b59ab7877844d9010dc5e7b066f4486f22
Showing with 687 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +22 −0 LICENSE
  3. +125 −0 README.rst
  4. +12 −0 examples/yum-proxy/yum-proxy-user-data.sh
  5. +326 −0 export.py
  6. +3 −0 requirements.txt
  7. +108 −0 scripts/export-vmdk.sh
  8. +52 −0 scripts/install-guest-additions.sh
  9. +36 −0 scripts/package-vagrant-box.sh
@@ -0,0 +1,3 @@
*.box
*.pem
*.vmdk
22 LICENSE
@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2014 Monetate Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,125 @@
ectou-export
============
This project enables running an `Amazon Linux AMI`_ on a local `VirtualBox`_ virtual machine via `Vagrant`_.
Goal
----
Preserve all the benefits of using the `Amazon Linux AMI`_ in production
while minimizing differences between `EC2`_ and local development environments.
Usage
-----
Examples:
.. code-block:: sh
./export.py --ami-name amzn-ami-hvm-2014.09.2.x86_64-gp2 [--vpc-name name] [--yum-proxy url]
./export.py --ami-name amzn-ami-hvm-2015.03.1.x86_64-gp2 [--vpc-name name] [--yum-proxy url]
./export.py --ami-name amzn-ami-hvm-2015.09.1.x86_64-gp2 [--vpc-name name] [--yum-proxy url]
These examples export vagrant box files named ``AMI_NAME-DATETIME.box`` and ``AMI_NAME-DATETIME-guest.box``.
Overview
--------
The ``export.py`` script will::
launch builder instance
attach source image volume
export-vmdk.sh (device -> vmdk)
chroot - remove aws dependencies
chroot - add vagrant user
create vmdk
download vmdk
package-vagrant-box.sh (vmdk -> box)
create virtualbox vm
package vagrant box
install-guest-additions.sh (box -> guest box)
install guest additions
apply security updates
package vagrant box
Dependencies
------------
Host software
~~~~~~~~~~~~~
The software has been tested using:
- VirtualBox 5.0.12
- Vagrant 1.8.1
- Python 2.7
- boto3 1.2.3
- paramiko 1.16.0
- scp 0.10.2
Example on MacOS X host using brew:
.. code-block:: sh
brew tap caskroom/cask
brew install brew-cask
brew cask install virtualbox
brew cask install vagrant
pip install -r requirements.txt
AWS account and credentials
~~~~~~~~~~~~~~~~~~~~~~~~~~~
AWS account should have default VPC or explicit VPC. Requires AWS credentials with permissions to:
.. code-block:: javascript
{
"Statement": [{
"Effect": "Allow",
"Action" : [
"ec2:DescribeImages",
"ec2:CreateKeypair",
"ec2:DeleteKeypair",
"ec2:CreateSecurityGroup",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:DeleteSecurityGroup",
"ec2:CreateVolume",
"ec2:AttachVolume",
"ec2:DetachVolume",
"ec2:DeleteVolume",
"ec2:RunInstances",
"ec2:DescribeInstances",
"ec2:ModifyInstanceAttribute"
"ec2:TerminateInstances",
"ec2:CreateTags",
],
"Resource" : "*"
}]
}
Access to Amazon repositories
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The repository urls are only accessible from within the AWS environment. To access these repositories locally there
are several options:
#. Use VPN connection to EC2, such as `OpenVPN Access Server`_ with `Tunnelblick`_ client.
#. Launch HTTP proxy in EC2 with security group restricted to your IP addresses, and configure image ``--yum-proxy``.
.. _Amazon Linux AMI: https://aws.amazon.com/amazon-linux-ami/
.. _EC2: https://aws.amazon.com/ec2/
.. _VirtualBox: https://www.virtualbox.org/wiki/Downloads
.. _Vagrant: https://www.vagrantup.com/
.. _OpenVPN Access Server: https://openvpn.net/
.. _Tunnelblick: https://tunnelblick.net/
@@ -0,0 +1,12 @@
#!/bin/bash -ex
#
# Example user data script template for a trivial yum proxy.
#
# Launch instance with security group that only allows ingress from your network to port 8888.
# Do NOT launch instances with security groups that are open HTTP relays.
#
yum -y update
yum -y install tinyproxy --enablerepo=epel
sed -i.bak -e 's/^Allow 127.0.0.1/#Allow 127.0.0.1/g' /etc/tinyproxy/tinyproxy.conf
chkconfig tinyproxy on
service tinyproxy start
Oops, something went wrong.

0 comments on commit 0a3159b

Please sign in to comment.