https://github.com/davydany/pycloud
A simple python provisioner for ec2 instances.
https://github.com/davydany/pycloud
Last synced: over 1 year ago
JSON representation
A simple python provisioner for ec2 instances.
- Host: GitHub
- URL: https://github.com/davydany/pycloud
- Owner: davydany
- Created: 2018-08-03T01:43:51.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-06T04:19:20.000Z (almost 8 years ago)
- Last Synced: 2025-02-16T13:31:48.839Z (over 1 year ago)
- Language: Python
- Size: 51.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- Contributing: docs/contributing.rst
Awesome Lists containing this project
README
=========
PyCloud
=========
.. image:: https://travis-ci.org/davydany/pycloud.svg?branch=master
:target: https://travis-ci.org/davydany/pycloud
What it Does
------------
A simple cloud provisioner for provisioning VMs on EC2 and configuring them
based on a simple plan.
Getting Started
---------------
.. code:: bash
pip install --upgrade git+https://github.com/davydany/pycloud
Usage
-----
To see all the options available for you, run:
.. code:: bash
pycloud --help
PyCloud uses a plan file to setup your infrastructure, similar to how
Ansible works. There are a few sample files in **example_plans** directory.
Here is how to execute a plan:
.. code:: bash
export AWS_ACCESS_KEY=""
export AWS_SECRET_KEY=""
pycloud setup ./example_plans/test_plan.yml
If you'd like to run the process in reverse, and teardown the setup plan, run:
.. code:: bash
pycloud teardown ./example_plans/test_plan.yml
If you'd like to see all the available provisioners, along with their required
and optional arguments, run:
.. code:: bash
pycloud docs
Using the docs in **pycloud docs**, you can create your own plan, like the one
below:
**WARNING:** Setting **max_count** under **ec2_instance** to a value larger than
1 will make that many instances on EC2, and Amazon will charge you for those
instances.
.. code:: yaml
---
tasks:
- ec2_security_group:
name: Create Security Groups for our Ubuntu Instance
region: us-east-1a
group_name: 'ubuntu_sg'
group_description: 'The Ubuntu Security Group'
rules:
- tcp:
start: 22
end: 22
cidr_ip: '0.0.0.0/0'
- ec2_key_pair:
name: Create the Key Pair we need to access the Ubuntu Instance
region: us-east-1a
key_name: admin_kp
- ec2_instance:
name: Setup Simple Ubuntu Instance on AWS
region: us-east-1a
ami_id: ami-456b493a
instance_type: t2.micro
security_group: ubuntu_sg
key_name: admin_kp
min_count: 1
max_count: 1
instance_id_ref: $ubuntu_vms
- ssh_keygen:
name: Generate a RSA Key for our user, Rick Sanchez!
key_type: 'rsa'
file: id_rsa
passphrase: ''
out_dir: '/tmp/keys/'
- user_add:
name: Creates the Rick Sanchez user on the referenced Instances
region: us-east-1a
key_name: admin_kp
user_name: rsanchez
instance_id_ref: $ubuntu_vms
default_shell: /bin/bash
public_key: /tmp/keys/id_rsa.pub