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!

질문됨 2년 전195회 조회
2개 답변
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
지원 엔지니어
답변함 2년 전
profile picture
전문가
검토됨 한 달 전
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.

답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠