For the examples below
ecs is the
[options] argument after the
aws command. It instructs
aws to run the command for
Elastic Container Services. Any commands that point to a
.json configuration file are available on github.
Detailed help for both EC2 (Elastic Compute Cloud) and ECS (Elastic Container Service) can be found at the links below:
You can dump the result if any command to a text file which is useful with the
describe commands. Single
> will overwrite the file and
>> will append. Example:
C:\> aws ecr list-images --repository-name lexicon-webmvc > output.txt
aws ecr list-images --repository-name lexicon-webmvc
- ECR CLI commands are listed here in context of the lexicon project.
Example task definition ARN :
aws ecs list-task-definitions --region ap-southeast-2 --status INACTIVE
You CANNOT DELETE task definitions they have to be only deregistered if you no longer want them.
aws ecs deregister-task-definition --task-definition TASK-NAME
Register new from local
.json file. If you use an existing name it will create a new revision of the task definition. The name is defined in the
.json in the
aws ecs register-task-definition --cli-input-json file://lexicon-task-definition.json --region ap-southeast-2
aws ec2 describe-vpcs
The above will create your VPC along with a
DHCP options set,
Network ACLs and
EC2 (Amazon Elastic Compute Cloud) is the virtual machine running in the cloud, this is a Linux variant running the
Amazon Linux AMI 2.0.20190913 x86_64 ECS HVM - where AMI stands for
Amazon Machine Images
Terminated instances remain visible after termination (for approximately one hour).
~ Descibes the virtual machine instance
To create a launch template
~ display existing launch templates
To run instances
aws ec2 run-instances --launch-template LaunchTemplateId=lt-0daef39547692deac
This is used to open up ports, example allowing you to connect to SQL from SQL Server Management Studio on port 1433. The example below opens port 80.
aws ec2 describe-security-groups --filters Name=vpc-id,Values=VPC_ID --region ap-southeast-2
aws ec2 create-subnet --generate-cli-skeleton
Example cluster ARN:
aws ecs list-clusters
Start from task definition and keep it running.
aws ecs list-services --cluster lexicon-cluster
aws ecs run-task --task-definition lexicon-task-definition:6 --cluster lexicon-cluster
Assign metadata to AWS resources, this is a array of
key|value so you can allocate infrastructure resources.
aws ecs list-tags-for-resource --resource-arn