skip to Main Content

I have a command that I am currently running from my OS to run a docker container that takes in a file as an argument and returns some output.

docker run --rm -v ${pwd}:/dir IMAGE [COMMAND] [ARGS]

This allows me to run this container each time i get a new file, obtain output, and spin down the container. I would like to move this to AWS but I’m a bit unsure of how I’d be able to replicate the ad-hoc nature of this command? Does AWS Support docker run?

2

Answers


  1. So, the short answer is no, you do not have the ability to do this on ECS like how you do normally. However, you can build it so you spin up tasks dynamically when a file is uploaded in say S3.

    What you want to do is:

    S3 Event Notification => EventBridge => StepFunction => ECS RunTask API

    With a setup like this, you will be able to run a task to process a file each time it’s uploaded
    useful links:
    https://aws.amazon.com/blogs/aws/new-use-amazon-s3-event-notifications-with-amazon-eventbridge/

    https://aws.amazon.com/blogs/compute/introducing-the-amazon-eventbridge-service-integration-for-aws-step-functions/

    https://docs.aws.amazon.com/step-functions/latest/dg/connect-ecs.html

    Login or Signup to reply.
  2. There is a gazillion ways you can refactor your application to run on AWS as others have described. If you do not want to go down that path perhaps the closest architecture to what you are already doing on your laptop would be to use AWS ECS + the EFS integration (as described in this blog). You can define a task (with a container) that mounts an EFS share. By populating that EFS share with the file you need will have the container access that file and work on it just like it does locally on your laptop.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search