Giter Club home page Giter Club logo

ecs-101's Introduction

ECS 101

CREATE CLUSTER

aws ecs create-cluster --cluster-name markgECS --region ap-southeast-1

GET SECURITY GROUP WITH TAG GROUP=ECS

SG_ID=$(aws ec2 describe-security-groups --region ap-southeast-1 --filters "Name=tag:group,Values=ecs" --query "SecurityGroups[*].GroupId" --output text)

GET AMAZON AMI ID FOR ECS

IMAGE_ID=$(aws ec2 describe-images --owners amazon --region ap-southeast-1 --filter 'Name=name,Values=amzn2-ami-ecs-hvm-2.0.20190815-x86_64-ebs' --query "Images[0].ImageId" --output text)

LAUNCH INSTANCE

aws ec2 run-instances --image-id $IMAGE_ID --count 1 --instance-type t2.micro --iam-instance-profile Name=ec2ECSrole --key-name markdxc --security-group-ids $SG_ID --user-data file://setup-ecs-config.txt --region ap-southeast-1 --tag-specifications 'ResourceType=instance,Tags=[{Key=group,Value=ecs}]' 'ResourceType=volume,Tags=[{Key=group,Value=ecs}]'

GET INSTANCE ID

INSTANCE_1=$(aws ec2 describe-instances --region ap-southeast-1 --filter "Name=tag:group,Values=ecs" --query "Reservations[*].Instances[0].InstanceId" --output text)

GET CONTAINER INSTANCE ARN

INSTANCE_ARN_1=$(aws ecs list-container-instances --cluster markgECS --region ap-southeast-1 --query "containerInstanceArns[0]" --output text)

DESCRIBE CONTAINER INSTANCES

aws ecs describe-container-instances --cluster markgECS --container-instances $INSTANCE_ARN_1 --region ap-southeast-1

REGISTER TASK DEFINITION

aws ecs register-task-definition --cli-input-json file://web-task-definition.json --region ap-southeast-1

CREATE SERVICE

aws ecs create-service --cluster markgECS --service-name web --task-definition web --desired-count 1 --region ap-southeast-1

CHECK YOUR SITE IF ITS WORKING

DNS=$(aws ec2 describe-instances --region ap-southeast-1 --filter "Name=tag:group,Values=ecs" --query "Reservations[*].Instances[0].PublicDnsName" --output text)
curl $DNS

CLEANING UP

aws ecs update-service --cluster markgECS --service web --task-definition web --desired-count 0 --region ap-southeast-1
aws ecs deregister-task-definition --task-definition web:1 --region ap-southeast-1
aws ecs delete-cluster --cluster markgECS --region ap-southeast-1
aws ec2 terminate-instances --instance-ids $INSTANCE_1 --region ap-southeast-1

ecs-101's People

Watchers

James Cloos avatar Mark Anthony Geronimo 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.