AWS Lambda Function Update Security Group Rules

0

I need AWS Lambda Function which triggers on AWS ECS Event ECS Task Rolling Update, takes the public IP's from the task and update the associated security group on the ALB with the newly created Ips. I have 2 services with 1 task definition inside. Is there any Lambda which i can use in Python or any language?

  • You're looking for code reference on how to do that with AWS Lambda?

  • Yeah, exactly

2개 답변
0

You can detect an ECS Task State (New or existing) using the "aws.ecs@ECSTaskStateChange" event on Amazon EventBridge when creating a Rule: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-lifecycle.html https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_cwe_events.html

Then you can configure the EventBridge Rule to invoke the Lambda to get the IP from the Event data and Implement the desired changes in your ALB Security Groups.

AWS
vtjean
답변함 7달 전
  • I'm doing that, but i'm struggiling with the Lambda function. Would you like to provide me with an example of the Lambda function?

0

Quick question, Why do you need to do this? Perhaps look at fixing the reason that you do this?

Initially I’m thinking you may want to setup and internal ALB with split horizon DNS which may solve the issue your facing and I’ve fixed several times.

profile picture
전문가
답변함 7달 전

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

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

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

관련 콘텐츠