Reputation: 198
I have a batch job which is trigged with boto3, I run about 10 workers on an ec2 compute enviroment and they used to inherit the jobname from batch but now all my instances have no name tag so it's difficult to figure out which is which.
How can I pass on a name tag to the ec2 instances for my batch job via boto3?
batch = boto3.client('batch', my_arguments)
batch_detils = batch.submit_job(
jobName = 'worker_{}'.format(i),
jobQueue = 'my_queue',
jobDefinition = 'my_job_definition',
containerOverrides = {'command': ['sleep 100']},
)
I should specify the ultimate goal is to get each worker with a unique name, not to get the all the same name as the compute environment.
Upvotes: 3
Views: 1274
Reputation: 269236
The Compute Environment Parameters - AWS Batch documentation page talks of a tags
parameter:
Key-value pair tags to be applied to instances that are launched in the compute environment. For example, you can specify
"Name": "AWS Batch Instance - C4OnDemand"
as a tag so that each instance in your compute environment has that name. This is helpful for recognizing your AWS Batch instances in the Amazon EC2 console.
Upvotes: 1