go-lambda-cleanup

command module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2021 License: MIT Imports: 1 Imported by: 0

README

go-lambda-cleanup

Actions Status Go version semantic-release

drawing

A Golang based CLI for removing unused versions of AWS Lambdas.

drawing

Installation

go-lambda-cleanup is distributed as a single binary. Download the binary and install go-lambda-cleanup by unzipping the zip file and and moving the included binary to a directory in your system's PATH. /usr/local/bin is the recommended path for UNIX/LINUX environments.

wget https://github.com/karl-cardenas-coding/go-lambda-cleanup/releases/download/v1.0.0/go-lambda-cleanup_linux_amd64.zip
unzip go-lambda-cleanup_linux_amd64.zip 
sudo mv go-clean-lambda /usr/local/bin/

Usage

Usage:
  glc clean [flags]

Flags:
  -c, --count int8   The number of versions to retain from $LATEST-(n) (default 1)
  -h, --help         help for clean

Global Flags:
  -s, --enableSharedCredentials   Leverages the default ~/.aws/credentials file (bool)
  -p, --profile string            Specify the AWS profile to leverage for authentication.
  -r, --region string             Specify the desired AWS region to target.
  -v, --verbose                   Set to true to enable debugging (bool)

Use "gcl [command] --help" for more information about a command.

To retain 2 version excluding $LATEST

glc clean -r us-east-2 -c 2 -s true -p myProfile
Authentication

go-lambda-clean utilizes the default AWS Go SDK credentials provider to find AWS credentials. The default provider chain looks for credentials in the following order:

  1. Environment variables.

  2. Shared credentials file.

  3. If your application uses an ECS task definition or RunTask API operation, IAM role for tasks.

  4. If your application is running on an Amazon EC2 instance, IAM role for Amazon EC2.

Shared File Example

If ~/.aws/config and ~/.aws/config is setup for the AWS CLI then you may leverage the existing profile confugrations for authentication.

$ export AWS_PROFILE=sb-test
$ glc clean -r us-west-2 -s true
INFO[03/05/21] Scanning AWS environment in us-west-2
INFO[03/05/21] ............

Alternatively, the --profile flag may be used.

$ glc clean -r us-west-2 -s true -p myProfile
INFO[03/05/21] Scanning AWS environment in us-west-2
INFO[03/05/21] ............
Environment Variables

Static credentials may be utlized to authenticate into AWS.

  • AWS_ACCESS_KEY_ID

  • AWS_SECRET_ACCESS_KEY

  • AWS_SESSION_TOKEN (optional)

$ export AWS_ACCESS_KEY_ID=YOUR_AKID
$ export AWS_SECRET_ACCESS_KEY=YOUR_SECRET_KEY
$ export AWS_SESSION_TOKEN=TOKEN
$ gcl clean -r us-west-2
2021/03/04 20:42:46 Scanning AWS environment in us-west-2.....
2021/03/04 20:42:46 ............

Contributing to go-lambda-cleanup

For a complete guide to contributing to go-lambda-clean, see the Contribution Guide.

Contributions to go-lambda-cleanup of any kind including documentation, organization, tutorials, blog posts, bug reports, issues, feature requests, feature implementations, pull requests, answering questions on the forum, helping to manage issues, etc.

AWS Credentials Configuration Golang Cobra CLI Framework AWS Go SDK Credentials

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL