Skip to main content

CLI tool to provision infrastructure and configure a simple web app in AWS.

The infrastructure components will be name elb-project_name, asg-project_name and so on. The tool will reuse any pre-existing components based on the name. However, if there are several components with the same name - one will be chosen at random

Prerequisites

  • AWS Account
  • VPC with at least one public subnet
  • At least 9 available private IP addresses in the subnet (allows for 1 EC2 instance to be provisioned)
  • AWS CLI needs to be configured for a user with necessary IAM permissions (TBD)

Limitations

To simplify the design all the infrastructure are being created in the single subnet, and this subnet is required to be a public one. Because the architecture doesn't include a NAT gateway all the provisioned instances will be assigned a public IP address, so they can download the necessary packages.

There is no input validation

Installation

pip install aws-ec2-provisioner

or

git clone git@github.com:valeramaniuk/aws-ec2-provisioner.git
cd aws-ec2-provisioner
pip install .

Usage

run aws_ec2_provisioner with the following options:

--vpc-id <VPC where you want to deploy the app>
--subnet-id <Subnet where you want to deploy the app. Should in the selected VPC>
--project-name <Name of the project. You won't be able to create 2 projects with the same name>
--aws-profile <The name of access key/secret key pair (~/.aws/credentials)>
--min-asg-size <Minimum size of the autoscaling group>
--max-asg-size <Maximum size of the autoscaling group>
--instance-type <INT. Choose from a predefined list>
--scaling-target-value <INT. Scaling policy target value % >

If you omit any of the options you will be prompted interactively. In this case, the tool will look up the configured aws profiles, the VPCs available for the chosen profile/region and the subnets available for the chosen VPC.

aws_ec2_provisioner --help for all available options

Available instace types:
1. t2.micro
2. t2.meduim

Infrastructure to be created:

  • ELB
    • Listener 80
    • Instance port 80
    • Health check HTTP:80/
  • Autoscaling group
    • Scales in/out to maintain Average CPU utilization across all instances in the Autoscaling Group.
    • Launch configuration associates public IP by default
    • User data in Launch configuration installs and starts ngnix
  • Security Groups
    • ELB security group
      • ingress tcp:80 from anywhere
    • APP security group
      • ingress only from ELB security group
      • no SSH access because the APP servers are in the public subnet (architecture limitation)

Archirecture

TODO:

  • Load based autoscaling
  • Additional region
  • Choose aws_profile interactively based on ~/.aws/credentials
  • Choose vpc-id interactively after specifying the aws-profile and region
  • Choose subnet-id interactively after specifying the subnet
  • Proper logging instead of print statements
  • Tests
  • Idempotency (with limitations)
  • Ability to rollback
  • Move instance user data to separate file, so the user data file may be specified at runtime
  • Add bumpversion
  • Support for multiple subnets. Private/public
  • Provision a NAT gateway as necessary
  • Informative UI
  • Destroy all provisioned infrastructure
  • Catch all botocore exceptions

Metadata

Release files for aws-ec2-provisioner 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aws-ec2-provisioner 0.1.1
File Size Uploaded Provenance
aws_ec2_provisioner-0.1.1.tar.gz 10.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aws-ec2-provisioner 0.1.1
File Interpreter ABI Platform
aws_ec2_provisioner-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 23.0 kB

Release files / aws_ec2_provisioner-0.1.1.tar.gz

Download URL aws_ec2_provisioner-0.1.1.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
751dcd1c7bb3a8585b4758310217edb440ca161a8954037f40db0d714fde5fc3
BLAKE2b-256 checksum
How to use checksums
81f3503b00abb717ea36e506abe9cef200e0962df2e74f890aff17e3bb528965
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

Release files / aws_ec2_provisioner-0.1.1-py3-none-any.whl

Download URL aws_ec2_provisioner-0.1.1-py3-none-any.whl
Size 13.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e1bd38bf09dd7817e4b65d7c7fb656ed6dc2abfcb2368c8926e378185fcfcf5
BLAKE2b-256 checksum
How to use checksums
184a2e625f529199eb4c8bc54b7a542357418b24b93642bf40425714de92341e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

Security for aws-ec2-provisioner 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page