I have created a CloudFormation template where I am deploying a Lambda function which will take code from S3 bucket from a zipped file. The bucket is in us-west-2 region.
My issue here is that the template deployment is failing to create Lambda function if the user deploys it in another region apart from us-west-2 in another account since it's not able to find the bucket in the above mentioned region.
Also, i cannot directly add the code in the template since the code has some dependency files.
Sharing the snippet of the code. Any suggestion is highly appreciated. Thanks
Resources:
DMARCFunction:
Type: AWS::Lambda::Function
Properties:
Code:
S3Bucket: lambda-code-bucket
S3Key: Lambda.zip
Runtime: python3.8
Role: !GetAtt LambdaRole.Arn
Handler: lambda_function.lambda_handler
Timeout: 15
TracingConfig:
Mode: Active
CodePudding user response:
Its not CloudFormation issue. That's how lambda works. the ZIP and the function must be in same region. You have to replicate your ZIP to all regions and accounts were you want to create your function.