Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create AWS Batch Managed Compute Environment passing UserData to Container Instances

I would like to create a Managed Compute Environment for AWS Batch, but use EC2 User Data to configure the instances as they are brought into the ECS fleet that Batch is scheduling jobs onto.

It shouldn't matter, but the purpose of the User Data script is to pull down large data files onto an InstanceStore that the Docker containers will reference.

This is possible in ECS, but I have found no way to pass User Data to a Managed Batch Compute Environment.

At most, I can specify the AMI. But since we're going with Managed, we must use the Amazon ECS-optimized AMI.

I'd prefer to use EC2 User Data as the solution, as it gives a entry-point for any other bootstrapping we wish to perform. But I'm open to other hacks or solutions, so long as they are applicable to a Managed Compute Environment.

like image 306
mcg256 Avatar asked Oct 30 '22 02:10

mcg256


1 Answers

You can create an AMI based on the AWS provided AMI, and customize it. It will still be managed since the Batch and/or ECS daemon is running on it.

As a side note I’m trying to do the same thing but no luck so far. I may end up creating a custom AMI and include the configure script in the AMI itself in /etc/rc.local. Not ideal but I don’t think Batch can pass a user data script other than what it needs. I am still looking into this.

like image 182
Ryan Avatar answered Nov 13 '22 14:11

Ryan