跳至内容

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!

已提问 4 年前389 查看次数

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
支持工程师

已回答 4 年前

专家

已审核 2 年前

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.

已回答 4 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。