How to deploy a Docker image to AWS with the smallest number of CLI commands?

0

What is the smallest possible number of commands necessary to deploy (and run) a Docker image to AWS using only the CLI?

Assumptions:

  • Assume I have a Docker Image already built and tested on my local machine using docker build and docker run
  • Assume I have an AWS account and already configured credentials with lab-grade permissions (*:*) for CLI use
  • I'm agnostic to the service to be used - ECS, EKS, Beanstalk, Fargate, even unmanaged EC2 - doesn't matter as long as it leads to the shortest possible command line.
  • If the CLI refers to some Cloud Formation templates - that's fine

Research so far (UPDATED):

UPDATE2

I understand the concept of a container registry and I tried to register my image using the instructions here: https://docs.aws.amazon.com/AmazonECR/latest/userguide/docker-push-ecr-image.html - but the docker login command gives me this error:

Error response from daemon: Get "https://XXXXXXXXXXXXX.dkr.ecr.region.amazonaws.com/v2/": Service Unavailable

  • All the text in red in the documentation needs to be replaced with actual values. eg. region needs to be replaced with actual region name. same for repo name, account id etc

1回答
0

You can achieve this with a single command cdk deploy for ECS/EKS with EC2/Fargate as hosting model. See examples here related ECS/EKS/Fargate. The examples are in typescript but there are many examples in other languages as well such as python. AWS CDK enables you to generate a Cloudformation template as well in case you prefer that using cdk synth

There is direct support, for referencing an image in ECR and providing that to ECS/EKS

Hope this helps.

AWS
回答済み 2年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ