Coder Social home page Coder Social logo

awesome-aws's Introduction

awesome-aws

Configure user, key, id, etc

aws configure

Ubuntu Free AMIs

Ubuntu 20.04 server: ami-0bd2099338bc55e6d Ubuntu 18.04 server: ami-05a8c865b4de3b127

Free Tier EC2 instance in eu-west-2

  • t2.micro: 1vCPU, 1GB RAM. 0.013 USD per hour

Launch an instance

With a name-id MyInstanceName to help identify in e.g., console

aws ec2 run-instances --image-id "${ami_id}" --count 1 --instance-type "${instance_type}" --key-name "${key_pair}" --security-group-ids "${security_group}" --subnet-id "${subnet_id} --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=MyInstanceName}]'"

Terminate an instance

Replace terminate-instances with stop-instances if only stopping is needed.

aws ec2 terminate-instances --instance-ids i-5203422c

Add a block device to the image

When used with run-instances, example to provision a standard Amazon EBS volume that is 20 GB in size, and maps it to your instance using the identifier /dev/sdf:

--block-device-mappings "[{\"DeviceName\":\"/dev/sdf\",\"Ebs\":{\"VolumeSize\":20,\"DeleteOnTermination\":false}}]"

Add a tag to the instance

aws ec2 create-tags --resources i-5203422c --tags Key=Name,Value=MyInstance

List instances

  • By type t2.micro, query instance id
aws ec2 describe-instances --filters "Name=instance-type,Values=t2.micro" --query "Reservations[].Instances[].InstanceId"

Returns ID: [ "i-05e998023d9c69f9a" ]

Query instance State (running, stopped, etc)

aws ec2 describe-instances --filters "Name=instance-type,Values=t2.micro" --query "Reservations[].Instances[].State[].Name"
  • By tag Name=MyInstance:
aws ec2 describe-instances --filters "Name=tag:Name,Values=MyInstance"
  • By AMI used to launch, e.g., ami-x0123456,ami-y0123456,ami-z0123456
aws ec2 describe-instances --filters "Name=image-id,Values=ami-x0123456,ami-y0123456,ami-z0123456"

List public IP of instances

E.g., to ssh into it. Can be filtered by id or state

aws ec2 describe-instances \
  --query "Reservations[*].Instances[*].PublicIpAddress" \
  --output=text

awesome-aws's People

Contributors

ed-ruiz avatar

Watchers

eduardo ruiz 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.