Giter VIP home page Giter VIP logo

awssysops's Introduction

AWS SYSOPS

Navigation

CLI
SKD

CLI

Install

pip install awscli
curl "https....

CLI Configuration

CLI Generate Skeleton

  • Run any AWS command followed by --generate-cli-skeleton
  • Modify json file as appropriate
  • Execute command to create resource

Example:

aws ec2 create-volume --generate-cli-skeleton > myspec.json

Important

This gives the opportunity to test before run.

"DryRun": true,

Skeleton Execute.

aws ec2 create-volume --cli-input-json file://volcreate.json

Chaining output as input to next command

--query

  • restrict input to the structure
  • supports path expressions

filter

--filter

  • restricts output/response to specific objects

CLI EXAMPLE

Requirements

  • provide info on ec2
  • correspond wiht security group
  • non null nametag
  • running state
aws ec2 describe-instances --output text\
  • output text is assumption

JMES query part

Filter

It has an and term so its two independent matchings groupname must have secgroup prexix and instance state must equal 16.
16 means running.

match security group prefix
match all running instnaces
match instances with name tag of non null values
return name tag value, instance id, public dns name and ..

This could be a single command run on a daily basis to get inventory information,
in different regions.
that could be stored in a database to view the changes in infrastructure over time.

SDK

Certification is more interested in the CLI than the details of the software development kits SDK.

CLI

  • Text query.

SDK

  • Works with objects
  • you always have results sets (so you don't need to do queries)
  • This means you chose what results to work with .

Comparison

Test to check EBS volumes within region,
status = available.
Then we can delete to save money.

fitler for name available query restricts output so we only return volume id

If you have multiple vols created with status = available at the same time
they will show up on the same line.
So in the query command we use tr -s '\t' '\n'. to convert tabs in carriage returns

final part is to execute script

Using Python on SDK

  • note we use the boto3 lib

  • Note no query as not needed with SDK.

  • remove dryrun=true when running for real.

As a lambda function for serverless.

  • we could paste this in as a trigger to run on a daily basis.
  • slightly different from previous example.

CLI - QUESTION

anser = c

awssysops's People

Contributors

murchie85 avatar

Watchers

 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.