Coder Social home page Coder Social logo

ramstorage / aws-spot-one Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dwchiang/aws-spot-one

0.0 0.0 0.0 970 KB

A daily developer tool (based on CDK) to create an Amazon EC2 Spot Instance and connect to the instance.

License: Apache License 2.0

Shell 37.55% JavaScript 10.90% TypeScript 24.12% Makefile 27.43%

aws-spot-one's Introduction

aws-spot-one

Follow Pahud's Youtube video: EP22 - Building Highly Durable Spot Blocks with no Interruption with AWS CDK(4K 2160P)

Requirements

  • Installed AWS CLI v2.
  • Installed AWS CDK.
  • export AWS_DEFAULT_PROFILE=your-profile-name-here
  • Use default VPC.

Preparations

File: ec2-init-connect.sh and ec2-connect.sh:

  • Update your private key file path in prikey.
  • If you don't have a key pair, generate one: ssh-keygen -t rsa -b 4096 -C "[email protected]".

File: lib\aws-spot-one-stack.ts

  • Update blockDuration to your desired duration.
    • Also update fleet.expireAfter to your desired duration.
  • Update defaultInstanceType to your assigned instance type.

Executions

Get required packages and compile typescript to js.

npm install
npm run build

Bootstrap once per AWS account per region.

make bootstrap

Synth:

make synth

Diff:

make diff

Deploy:

make deploy

# You may need to press 'Y' if cdk involves creating IAM resources.

You will see the spot instance id after couple minutes. Then you can have an ssh connect to the new created spot instance:

./ec2-connect.sh {your_instance_id}

Destroy:

Normally you don't need to destory it, but it's an option.

make destroy

Clean:

If you are using multiple AWS/IAM accounts, you may need to clean up the cdk context (which is generated by cdk synth).

make clean

aws-spot-one's People

Contributors

dwchiang avatar

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.