Michael Barton
Michael Barton

Reputation: 9546

How can I run a single one-off docker image command on EC2?

I would like to trigger a one-off docker image execution on EC2 at the end of my continuous integration pipeline. Specifically, start an EC2 instance, pull an image stored in Amazon EC2 Container Registry, run it, then shut down the EC2 instance.

I've look at ECR tasks, and Amazon Batch but creating job queues or clusters seems a lot of moving parts to run a single task on a single instance, and then shut down afterwards.

Can anyone offer a simpler solution to this, for example an existing tool?

Upvotes: 1

Views: 305

Answers (1)

Samuel Karp
Samuel Karp

Reputation: 4682

If you're not specifically tied to an EC2 instance, you might look at leveraging AWS Fargate for this. Fargate allows you to run containers without provisioning or managing the underlying infrastructure; once your container ends, the Fargate task goes away and you do not need to clean it up.

Upvotes: 1

Related Questions