LoginSignup
0
0

More than 3 years have passed since last update.

AWS CLI で ECS コンテナを単発起動する

Last updated at Posted at 2020-05-13

前提条件

  • ECS Cluster
  • Task Definition
  • VPC
  • Subnet
  • Security Group

上記のリソースが作成済みであること。

実行するコマンド

以下の箇所は適宜代入したり書き換えたり。

  • subnet-000000000000
  • sg-000000000000
  • CLUSTER_NAME
  • TASK_DEFINITION_NAME
aws ecs run-task \
    --launch-type FARGATE \
    --network-configuration "awsvpcConfiguration={subnets=['subnet-000000000000','subnet-000000000000'],securityGroups=['sg-000000000000'],assignPublicIp='DISABLED'}" \
    --cluster ${CLUSTER_NAME} \
    --task-definition ${TASK_DEFINITION_NAME}

使いどころ

private な RDS のマイグレーションを単発でささっと呼び出すのに使ったりする用。

気になるところ

CFn では、 !Sub, !ImportValue を使って変数部分を書くことができるが、 cli では使えなさそう(?)
CFn を書くことになっても良いので、何か方法をご存知の方がいらっしゃれば教えていただきたいですm(_ _)m

0
0
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
0
0