Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (7k points)
edited by

I have three lambda functions as Master, worker1, worker2. I am able to call worker1 from Master. The functions master and worker1 are in the same region whereas the worker2 is in a separate region. When calling worker2 from master the following error returns:

"An error occurred (ResourceNotFoundException) when calling the Invoke operation: Functions from 'us-east-1' are not reachable in this region ('us-west-2')".

Master has an execution role with the below permission:

The code used to invoke worker from master:

def lambda_handler(event, context):

function_name = "arn:aws:lambda:us-east-1-...:function:worker_2"

lambda_client = boto3.client('lambda')

payload = json.dumps({"body-json": "payload string")

response = lambda_client.invoke(

    FunctionName = function_name,

    Payload = payload

)

response_payload = response['Payload'].read()

response_arr = json.loads(response_payload)

return response_arr['answer']

1 Answer

0 votes
by (31.9k points)
edited by

You need to change region of worker-2 lambda function accordingly.

For Python, the library is boto3.

client = boto3.client('lambda', region_name='us-west-2')

Want to learn more, check out our AWS training and AWS lambda tutorial.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer

Browse Categories

...