Git Product home page Git Product logo

awsudo's Introduction

awsudo

Build Status

A simple utility for easily executing AWS cli commands with an assumed role.

For more information about the motiviation behind developing this utility, please read our blog post Assuming roles in AWS with sudo-like agility.

Usage

awsudo [-h|--help] [-v|--verbose] arn:aws:iam::[AWS_ACCOUNT_ID]:role/[role name] [aws command]

Install

awsudo can be installed as a global utility to use alongside the AWS cli for day-to-day operations, local troubleshooting, etc:

npm install -g awsudo

Node

awsudo can also be installed for use by specific Node.js projects (i.e. as part of a CI/CD build process) by adding it as a dependency like any other:

npm install --save-dev awsudo

npm will place it in the execution PATH for any scripts defined in it package.json that it runs (e.g. start, test).

Docker

awsudo can also be used from its official Docker image, which packages it along with its dependencies and the AWS cli.

docker pull awsudo/awsudo

The Docker image can be used as a direct command (remember to mount your AWS configuration as a volume in the container):

docker run -v ~/.aws:/root/.aws awsudo/awsudo awsudo arn:aws:iam::[AWS_ACCOUNT_ID]:role/[role name] [aws command]

or it can be launched as an environment for running multiple commands interactively:

docker run -it -v ~/.aws:/root/.aws awsudo/awsudo awsudo /bin/bash

Example usages

Command

Basic usage when awsudo is on the PATH:

awsudo arn:aws:iam::123456789012:role/S3Access aws s3 cp ./some/directory s3://some-bucket

when using with Docker as a command (i.e. not within the container):

docker run -v ~/.aws:/root/.aws awsudo/awsudo awsudo arn:aws:iam::123456789012:role/S3Access aws s3 cp ./some/directory s3://some-bucket

Docker-based CI/CD

The Docker image can also be used with CI/CD tools like Drone or CircleCI.

Here is an example Drone pipeline step which uses the awsudo Docker image to deploy into AWS:

  deploy:
    image: awsudo/awsudo:latest
    commands:
      # Copy build artifacts to publicly-readable S3 bucket
      - awsudo arn:aws:iam::${AWS_ACCOUNT_ID}:role/S3Access aws s3 cp ./build s3://some-bucket --acl public-read --recursive
    environment:
      - AWS_DEFAULT_REGION=us-east-1
    secrets:
      - aws_access_key_id
      - aws_account_id
      - aws_secret_access_key

Prerequisites

For npm-based installations:

  • This is a bash based package and must therefore be run in a bash environment
  • The awscli must be available on the system.

Questions/Contact?

The maintainer of this repository is the AWS sudo open source maintainers at Meltwater, please send us any questions.

awsudo's People

Contributors

terodox avatar jtheriault avatar spier avatar

Watchers

Diego avatar James Cloos 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.