GithubHelp home page GithubHelp logo

keegoid-nr / cloudscript Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 2.0 206 KB

A script for managing states of AWS EC2 instances, EKS nodes, and getting details of New Relic Lambda layers.

License: MIT License

Shell 100.00%
aws ec2 eks eksctl

cloudscript's Introduction

CloudScript

pre-commit: enabled

Table of Contents generated with DocToc

A script for managing states of EC2 instances and EKS clusters on AWS and getting info about published New Relic Lambda layers.

Requirements

AWS CLI v2 must be installed and configured, like by running aws configure.
https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html

jq must be installed.
https://stedolan.github.io/jq/

eksctl must be installed for use with EKS.
https://eksctl.io/

unzip, xargs, and curl must also be available.

Usage

Usage: cs COMPONENT <REQUIRED ARGS> [OPTIONAL ARGS]

About:
  cs -v, --version  Show version
  cs --help         Show this message

Components:
  ec2     Manage EC2 instance states
  eks     Manage EKS node states
  lambda  List and download New Relic Lambda layers

Components and Args:
  ec2 status
  ec2 start|stop|restart|ssh <instanceId>
  eks status
  eks start <cluster> <number of nodes>
  eks stop <cluster>
  lambda list-layers [runtime]|[all] [region]
  lambda download-layers [layer]|[all] [region] [build]|[latest] [extension]|[agent]

Examples:
  cs ec2 status
  cs eks start my-cluster 2
  cs lambda list-layers                                     List layer names
  cs lambda list-layers all                                 Details for all layers
  cs lambda list-layers nodejs18.x us-west-2                Details for a specific layer
  cs lambda download-layers NewRelicNodeJS18X us-west-2 24  Download build #24 for a layer
  cs lambda download-layers all us-west-2 latest extension  Download all latest layers & show extension details
  1. Copy cs to your PATH.

  2. Verify it is in your path.

    which cs
    cs --version
  3. Run a command (see below examples).

EC2

get a list of instances and their IDs

cs ec2 start

start an instance

cs ec2 start <your-instance-id>

stop an instance

cs ec2 stop <your-instance-id>

EKS

get a list of cluster names

cs eks start

scale up an EKS node group to 2 nodes

cs eks start <your-cluster-name> 2

stop an eks node group (scale down to 0 nodes)

cs eks stop <your-cluster-name>
  • If leaving off the optional instanceId a list of instanceIds will be shown, but only those with a Name tag.

              "Tags": [
                {
                  "Key": "Name",
                  "Value": "your-ec2-instance-name"
                }
              ],

Lambda

get a list of compatible runtimes

cs lambda list-layers

get a list of layer names

cs lambda download-layers

download all layers and stat extension release dates

cs lambda download-layers all us-west-2 latest extension

download all layers and stat agent release dates

cs lambda download-layers all us-west-2 latest agent

download a specific layer build

cs lambda download-layers NewRelicPython39 us-west-2 36
  • If leaving off the optional compatibleRuntime, a list of compatible runtimes is obtained.
  • If leaving off the optional region, the default region defined in your aws-cli is used.
  • If leaving off the optional build, the latest build is downloaded.
  • If leaving off the optional extension or agent, details for both will be displayed.

Tested on Ubuntu 22.04 with Bash version 5.1.16

Verify SHA Sums

You can download the latest releases here. The cs file and its checksum are signed and can be verified against the developer's public PGP key.

Import the signing key:

gpg --import kmullaney.asc

Verify that the fingerprint for the downloaded key matches the following:

gpg --fingerprint [email protected]
E67B C11C D9B3 EC3B 81B7  0C35 68BF EBFB 3C1B 8D5A

When verifying the checksum, use the long format (the short format is not secure). For example:

gpg --keyid-format long --verify SHA512SUMS.asc SHA512SUMS

Special thanks to NVM for inspiration.

Contributing

See CONTRIBUTING.md

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.