I'm pretty sure I know the answer, but I thought I'd ask anyways. Is there a way to invoke a Lambda function in another region but utilize data in the invoked region. I am able to invoke a Lambda function from one region in another, but the invoked function runs against the region that it's in. What I'm attempting to do is have the invoked function make the changes in the region it was invoke from.
For example, the lambda function, which checks for certain ec2 configurations and makes changes if necessary, is in region 1, and I want to invoke the lambda function in region 2. But when I invoke the function in region 2, it runs against ec2s in region 1 and not the ec2 instances in region 2. Is there a way I can get the lambda function in region 1 to run against the ec2 instances in region 2 or do I just have to deploy the lambda function in each region.
What I'm trying to avoid is making changes to a lambda function and have to deploy it in all regions; instead of just deploying it to a single region and have all regions invoke that updated function.
Currently, my invoked lambda looks like this,
client = boto3.client('lambda', region_name='region 1')
def lambda_handler(event,context):
response = client.invoke(
FunctionName = 'Lambda_function_name',
InvocationType = 'RequestResponse',
Payload = json.dumps(event)
)