Host entry on Batch

0

I have a process which have to do a SOAP request to an url, but this URL doesn't exists, so I have to mock it using the /etc/hosts file. I'm using an ubuntu docker image, but it seems that AWS Batch overwrites the /etc/hosts file. I'm using the same image on AWS Lambda, and there the /etc/hosts file is preserverd and works fine. Is there a way to change that file on AWS Batch to make those requests?

Thank you!

asked 2 years ago183 views
2 Answers
0

Hello,

You can try using the Launch template support for AWS Batch for this requirement. Using launch template you can add custom userdata which will add a particular entry to /etc/hosts file on instance launch.

#!/bin/bash
echo "1.1.1.1    myexampledomain.com" >> /etc/hosts

Reference documentation: https://docs.aws.amazon.com/batch/latest/userguide/launch-templates.html

AWS
SUPPORT ENGINEER
answered 2 years ago
0

Hi!

Thank you for the response, but I forgot to mention we are using Fargate and it seems that Launch Template are not supported by Fargate.

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions