Set up a cross-account IAM role in the destination account
- Add a new IAM role
- For type of trusted entity select "another AWS account"
- Specify the accountId of the account that will be using the resource in the destination account. You can find your AWS Account ID, which is available on the support homepage when you are logged in.
- Create a policy that allows lambda:InvokeFunction for your function and attach it to this new role.
Create a lambda in the calling account.
- Set up a role for your lambda that is allowed to assumeRole
- Use the AWS SDK to assume the new role in the destination account.
- Pass the credentials to the lambda object when you create it