Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lambda function unable to update the target group with the new IP #1

Open
speedmsg opened this issue Oct 8, 2022 · 1 comment
Open

Comments

@speedmsg
Copy link

speedmsg commented Oct 8, 2022

Lambda function is triggered when there is an IP address change. However, it is unable to update the target group IP. There is not much in the lambda logs. Doesn't look like the function is attempting to update the target group as there is no such event in the cloud trail. It was able to create the cloudwatch log group though.

2022-10-08T18:17:26.269Z
e3f5e74a-1250-4a5a-81c0-93cd9cea7040
2022/10/08/[$LATEST]5da1d8ac075e45cdb2c4b4e6c4753921
3005.74
3000.0
128
26
@billedDuration
3000.0
@duration
3005.74
@ingestionTime
1665253046300
@log
accountnumbermasked:/aws/lambda/NLBAutoUpdate-nlbstack
@logstream
2022/10/08/[$LATEST]5da1d8ac075e45cdb2c4b4e6c4753921
@maxMemoryUsed
2.6E7
@memorySize
1.28E8
@message
REPORT RequestId: e3f5e74a-1250-4a5a-81c0-93cd9cea7040 Duration: 3005.74 ms Billed Duration: 3000 ms Memory Size: 128 MB Max Memory Used: 26 MB
XRAY TraceId: 1-6341beb3-0a90f9187ddad6591d5bcefb SegmentId: 405f40203b8095cc Sampled: true
@requestid
e3f5e74a-1250-4a5a-81c0-93cd9cea7040
@timestamp
1665253046269
@type
REPORT
@xraySegmentId
405f40203b8095cc
@xrayTraceId
1-6341beb3-0a90f9187ddad6591d5bcefb

@speedmsg
Copy link
Author

speedmsg commented Oct 9, 2022

Debug was helpful as it indicated that there wasn't any response for the API call. Issue was actually with the API endpoint reachability.

2022-10-09 19:00:11,394 urllib3.connectionpool [DEBUG] Starting new HTTPS connection (1): ec2.us-east-1.amazonaws.com:443

But there is one issue I wanted to point out. If the registered target is from a different VPC then the client.register_targets() is not working as it is expecting Availability zone information.

[ERROR] ClientError: An error occurred (ValidationError) when calling the RegisterTargets operation: The Availability Zone is required for IP address '10.10.2.19' because it is not in the VPC

As per the SDK documentation, this is a required parameter and I had to pass the value 'all' to the function to get around it.

response = client.register_targets(
TargetGroupArn='string',
Targets=[
{
'Id': 'string',
'Port': 123,
'AvailabilityZone': 'string'
},
]
)

_AvailabilityZone (string) --
An Availability Zone or all . This determines whether the target receives traffic from the load balancer nodes in the specified Availability Zone or from all enabled Availability Zones for the load balancer.

This parameter is not supported if the target type of the target group is instance or alb .

If the target type is ip and the IP address is in a subnet of the VPC for the target group, the Availability Zone is automatically detected and this parameter is optional. If the IP address is outside the VPC, this parameter is required.

With an Application Load Balancer, if the target type is ip and the IP address is outside the VPC for the target group, the only supported value is all .

If the target type is lambda , this parameter is optional and the only supported value is all ._

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant