Giter Club home page Giter Club logo

bastions-on-demand's Introduction

Bastions on Demand

This is a fully functional example of how to create and destroy bastion instances on demand using Fargate.

For an in-depth guide to this example, check out "Bastions on Demand" on my site.

Preliminaries

Before you being, you will need to install:

Everything in this repo assumes use of the default AWS profile. You can easily override that assumption with the AWS_PROFILE environment variable.

You can configure your credentials with aws configure.

You will also need to upload your public SSH key to your IAM user using either the AWS Console or the CLI (if you haven't already).

Setup

If you haven't previously configured a CloudWatch role for API Gateway, then use the api-gateway-logger module to do so now:

cd api-gateway-logger
terraform init
terraform plan -out plan
terraform apply plan && rm plan
cd ..

This is a global account setting, so you should only have to do it once. Note that destroying the module's resources with Terraform will remove the role, but it will not reset the CloudWatch role setting for API Gateway.

Now we're ready to create the service.

terraform init
./service/bin/build.sh  # Build the Lambda functions
terraform apply plan && rm plan

Once the Terraform successfully applies, fire up Docker (if you don't already have it running). Then, build and push the bastion image with:

./bastion/bin/login.sh  # Log into ECR
./bastion/bin/build.sh  # Build & tag the Docker image
./bastion/bin/push.sh   # Push the tagged image to ECR

Finally, we need to make certain the necessary Ruby dependencies are installed:

cd service
bundle
cd ..

You should now be able to create and destroy bastions with:

./service/bin/create-bastion.sh
./service/bin/destroy-bastion.sh

Once a bastion is running, you'll find its IP address in service/.bastion-ip.

You can ssh into the bastion with:

ssh ops@$(cat service/.bastion-ip)

bastions-on-demand's People

Contributors

jdhollis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bastions-on-demand's Issues

Too expensive overengineering solution

To develop this from the scratch will take ~10 hours, if you get 100$ per hour it will cost 1000$ to your employer/customer.
For how long you can keep t3.nano running as bastion host for 1000$ and provisioning it within 1 min?

Just by reading and trying to implement this solution will take 1-2 hours, again 100$-200$ just to implement?
Spin up simple EC2 in 1 min, save money. Or write simple terraform to spin EC2 in your VPC in 30 lines of code.

This is Great example of Over-Engineering and employer/customer should be avoided to work with engineers like this.

Make great simple solutions!

Success on my local instance but failing on my work AWS account

Hello I have used your bastion on demand server and got it working on my personal AWS account and then created the same on my AWS work account. I'm unable to ssh into the bastion server. I get the following error:

bash-3.2$ ssh ops@$(cat service/.bastion-ip)
[email protected]: Permission denied (publickey,keyboard-interactive).

I have uploaded my public ssh key to us-west-2 via the AWS opsworks my settings section. You have any other ideas of what could be different between the two accounts and what I might look into on my Work account to get ssh working?

Thanks this worked really slick on my personal account and I'm hopefully its something my work setup that my account wasn't using.

Take care Tom

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.