Coder Social home page Coder Social logo

docker-awscli's Introduction

Docker awscli

An AWS CLI toolbox in container. See Dockerfile. This repo triggers auto-build and push images to dockerhub.com/u/xueshanf/awscli.

To check AWS cli version

docker run --rm  xueshanf/awscli aws --version
docker run --rm  xueshanf/awscli s3cmd --version 

Examples

Rebuild image. This will upgrade the package too:

core@n1 git clone https://github.com/xueshanf/docker-awscli.git
core@n1 docker build -t xueshanf/awscli:latest .

Ready-made tools:

core@n1 docker run --rm  xueshanf/awscli get-metadata help
Usage: get-metadata <argument>
ACCOUNT
HOSTNAME
INSTANCEID
PRIVATEIP
PUBLICIP
ROLE
STSCRED
STSTOKEN
STSKEY
SECRET
ZONE

core@n1 docker run --rm  xueshanf/awscli get-metadata instanceid
i-453266b2

Command line argument is not case sensitve.

Copy data from s3 bucket to local file system:

core@n1 /usr/bin/docker run --rm -v /var/apps:/apps xueshanf/awscli:latest aws s3 cp s3://<bucket>/apps/nginx/ /apps/nginx

Register an AWS instance with a load balancer. Pass in AWS credential (not needed if the instances has IAM role based permission):

sudo more /root/.aws/envvars
AWS_ACCESS_KEY_ID=<key id>
AWS_SECRET_ACCESS_KEY=<access key>
AWS_DEFAULT_REGION=us-west-2
#!/bin/bash
AWS_CONFIG_ENV=/root/.aws/envvars
INSTANCE=$(/usr/bin/curl -s http://169.254.169.254/latest/meta-data/instance-id)
IMAGE=xueshanf/awscli:latest

CMD="aws elb register-instances-with-load-balancer \
    --load-balancer-name <elb name> --instances $INSTANCE "

docker pull $IMAGE
docker run --rm --env-file=$AWS_CONFIG_ENV $IMAGE /bin/bash -c "$CMD"

docker-awscli's People

Contributors

s0enke avatar su-sfeng avatar xueshanf avatar xuwang avatar

Watchers

 avatar  avatar  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.