跳至內容

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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。