bunker is a command line program for creating a dev/backup ec2 in AWS. It will install software, and clone your git repos, then it will transfer ignored files from your machine to the ec2.
Project description
bunker
Bunker is a command line program for creating a dev/backup ec2 in AWS. It will install software, and clone your git repos, then it will transfer ignored files from your machine to the ec2.
requirements
- python
- aws cli
- boto3
Also, you will need an EC2 instance on AWS, preferably running ubuntu>=18.04. This EC2 will need ssh (port 22) open and an attached SSM role (AmazonEC2RoleforSSM).
installation
$ pip intall aws-bunker
NOTE: see shell scripts, and terraform sections below:
PROJECT HOME PAGE: https://gitlab.com/shindagger/bunker
shell scripts
the install
, extra
, and prompt
subcommands assume there will be shell scripts on the EC2 called install-essentials.sh
, install-extras.sh
, and .prompt.sh
respectively.
the first two shell scripts install essential software (like python, pip, node, and npm) and extra software (like vncserver and gnome). prompt
defines a PS1. install-essentials.sh
and install-extras.sh
should be executable (chmod a+x
).
See example scripts here (https://gitlab.com/shindagger/bunker) as well as the terraform section below:
terraform
We have also included terraform files (https://gitlab.com/shindagger/bunker) which, when configured will spin up an EC2 instance you can use for bunker. terraform will output an instance ID you can use to init bunker with.
To configure and use these terraform files:
-
Clone this repo (https://gitlab.com/shindagger/bunker.git)
-
cd into the repo dir and
ls *.default
. These are the files you will need to edit before you init terraform. Each one of these files will need the extention.tf.default
changed to.tf
. -
Edit
alfa.tf
and ensure that the region is correct. -
Edit
beta.tf
and change the s3 bucket to a bucket you own. Also ensure the region is correct. -
Edit
terraform.tfvars
with your AWS SDK access id and key. Also make sure you are configured to this account withaws config
-
Edit
variables.tf
and change the default values to reflect your wishes. NOTE: if you don't have them already, you will need to create your own ssm role, and ssh key file manually.ec2_key_name
is just the name of the keypair in AWS, whilessh_private_key
is the full (absolute) path to your .pem file on your local machine. -
terraform init
-
terraform plan && terraform apply
before you init bunker
-
You have an EC2 instance ID. (see "terraform" above)
-
You have a directory (prefix) in which you will keep
repositories.txt
andignoredfiles.txt
. You can copy sample files from this repo, and edit them to reflect your repos and ignored files. -
You have a .pem file and you know the path to its location.
-
You know the username for the EC2 (should be "ubuntu" by default)
bunker usage
$ bunker -h
Show main bunker help page and exit
$ bunker build -h
Show help page for the subcommand build
and exit. This will work with any available subcommand
$ bunker init
Write the bunker config file ~/.config-bunker.ini
. If the file exists already, answers will be populated with existing values (underlined), and only overwritten if you offer a replacement value.
$ bunker install
Install essential software on your EC2 instance. Installed essentials include:
- python
- pip
- node
- npm
- yarn
- aws cli
- terraform
- docker
$ bunker build
Clone list of git repos (repositories.txt) on your EC2 and then rsync list of ignored files (ignoredfiles.txt) from your local repos to the EC2 repos.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for aws_bunker-0.2.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2957533756e23a483ee4a2354d2609680780b745b4f03892751815768b7f797a |
|
MD5 | b2d1638c0a14195d478b9c0e4394a96e |
|
BLAKE2b-256 | 46f1853f7d9c8da388639fef163840c9be7b132f3809c48723bae8f6611ac179 |