2
1

More than 1 year has passed since last update.

[ECS] ecs-cli基本

Posted at

インストール

sudo curl -Lo /usr/local/bin/ecs-cli https://amazon-ecs-cli.s3.amazonaws.com/ecs-cli-darwin-amd64-latest
sudo chmod +x /usr/local/bin/ecs-cli
ecs-cli --version
ecs-cli version 1.21.0 (bb0b8f0)

基礎

cluster-config設定

ecs-cli configure --cluster ec2-tutorial --default-launch-type EC2 --config-name ec2-tutorial --region ap-northeast-1

~/.ecs/configに保存される

ecs profileの設定

ecs-cli configure profile --access-key xxxx --secret-key xxxxx --profile-name <ecs_profile名>

~/.ecs/credentialsに保存される

Up

クラスタ作成

ecs-cli up --keypair id_rsa --capability-iam --size 1 --instance-type t2.medium --cluster-config ec2-tutorial --ecs-profile <ecs_profile>

Down

クラスタ削除

ecs-cli down --force --cluster-config ec2-tutorial --ecs-profile <aws_profile>
INFO[0000] Waiting for your cluster resources to be deleted... 
INFO[0000] Cloudformation stack status                   stackStatus=DELETE_IN_PROGRESS
INFO[0031] Deleted cluster                               cluster=ec2-tutorial

Up コマンド詳細

ecs-cli up [--capability-iam | --instance-role instance-profile-name] [--keypair keypair_name] [--size n] [--azs availability_zone_1,availability_zone_2] [--security-group security_group_id[,security_group_id[,...]]] [--cidr ip_range] [--port port_number] [--subnets subnet_1,subnet_2] [--vpc vpc_id] [--extra-user-data string] [--instance-type instance_type] [--image-id ami_id] [--launch-type launch_type] [--no-associate-public-ip-address] [--force] [--tags key1=value1,key2=value2] [--cluster cluster_name] [--region region] [--empty] [--verbose] [--help]

  • vpc指定
  • 3つaz指定
  • 3つのsubnet指定
ecs-cli up \
  --capability-iam \
  --size 1 \
  --tags Environment=dev,Name=dev-ecs
  --instance-type t2.medium \
  --cluster-config ec2-tutorial \
  --vpc vpc-xxx \
  --subnets subnet-xxxx,subnet-xxx,subnet-xxx \
  --ecs-profile <profile>
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1