bunker is a command line program for setting up an ec2 in AWS for remote development or as a backup. It can clone your git repos, and transfer ignored files from your machine to the ec2.
Project description
bunker
Bunker is a command line program for setting up an ec2 in AWS for remote development or as a backup. Among other things, it can clone your git repos and transfer ignored files from your machine to the ec2.
requirements
- python
- aws cli
- boto3
- (terraform)
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 and prompt subcommands assume there will be shell scripts on the EC2. The default names (without positional arguments) are: install-essentials.sh, and .prompt.sh respectively.
the first shell script is intended for essential software (like python, pip, node, and npm). If the script is not already executable, use the [-e] flag. prompt simply sources a file in ~/.profile on the EC2.
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, with all the example shell scripts and your .vimrc provisioned. Of course you're encouraged to change these files according to preference. 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 extension.tf.defaultchanged to.tf. -
Edit
alfa.tfand ensure that the region is correct. -
Edit
beta.tfand change the s3 bucket to a bucket you own. Also ensure the region is correct. -
Edit
terraform.tfvarswith your AWS SDK access id and key. Also make sure you are configured to this account withaws configure -
Edit
variables.tfand 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_nameis just the name of the keypair in AWS, whilessh_private_keyis 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.txtandignoredfiles.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 have a keypair name set for your EC2, which uses this .pem file.
-
You know the username for the EC2 (should be "ubuntu"). We may choose to support other OSs in future versions.
-
You have created a private key for your git provider, and you added the public key in your git provider settings. Also, you have configured your local ssh to use this key and tested or used it at least once.
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.
example ~/.config-bunker.ini:
[default]
prefix = /Users/username/bunker-config
repos = repositories.txt
ignored = ignoredfiles.txt
pem = /Users/username/somename.pem
instance_id = i-04xxxxxxxxxxxx148
username = ubuntu
gitkeys = /Users/username/.ssh/git_rsa
$ bunker repo path/to/repo /absolute/path/to/another-repo ../somerepo
Add or remove repo directories to/from repo file. Use relative or absolute paths.
$ bunker ignore .env.local config.ini terraform.tfvars
Add or remove filenames to/from ignore file.
$ bunker install
$ bunker install /home/ubuntu/script.sh
Install essential software on your EC2 instance. This command will run an executable shell script on your EC2. The default script (without defining the positional argument) is named /home/ubuntu/install-essentials.sh. This is intended to install any software essential to using your EC2. In an effort to stay agnostic about what software users want on their EC2, bunker does not install with included shell scripts. We do however provide example shell scripts (as well as terraform for the EC2) at the project homepage:
https://gitlab.com/shindagger/bunker
$ bunker prompt
$ bunker prompt /home/ubuntu/another-prompt.sh
Source a custom prompt file in /home/ubuntu/.profile. This command will source a file in /home/ubuntu/.profile. The default name is: /home/ubuntu/.prompt.sh.
$ 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. git clone will use ssh, assuming you have a public key setup at your git provider, a working ~/.ssh/config tested at least once with ssh -T git@PROVIDERURL, and the associated private key set using bunker init.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aws-bunker-0.3.8.tar.gz.
File metadata
- Download URL: aws-bunker-0.3.8.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e359fa68229d3bb16400b2efb86aaf81a50e9b028533f0220a6d183a0923240
|
|
| MD5 |
9d7454c9f385e789666135535bf8dbb3
|
|
| BLAKE2b-256 |
c2514d6ce1cc9753a7c35c48fe676fa25576e5c33ff5a2d5287488cdfd8abef0
|
File details
Details for the file aws_bunker-0.3.8-py3-none-any.whl.
File metadata
- Download URL: aws_bunker-0.3.8-py3-none-any.whl
- Upload date:
- Size: 25.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
adf1e15e6368412ace3c426ec44bbb81098b45439833123bd69192bce25d89a7
|
|
| MD5 |
013b8dc685cad49b005db8398e8f76ec
|
|
| BLAKE2b-256 |
da97761a75ede43cccfab3fbec30f2ba1bf0afa35fd0e710232cd8a3a4592e69
|