When writing the AWS CloudFormation template to create a Lambda function, 'Code' field is required. I found the documentation here: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html
The document says you can specify the source of your Lambda function as a zip file in a S3 bucket. And in the S3Bucket
field, it says "You can specify a bucket from another AWS account as long as the Lambda function and the bucket are in the same region."
If you put a bucket name in the S3Bucket
field, it will try to find the bucket in the same AWS account. So my question is how can I specify a bucket from another AWS account?
A code snippet in yaml I created for the CFT:
MyLambdaFunction:
Type: AWS::Lambda::Function
Properties:
Handler: index.handler
Runtime: nodejs6.10
Role: !GetAtt LambdaRole.Arn
FunctionName: 'MyLambda'
MemorySize: 1024
Timeout: 30
Code:
S3Bucket: 'my-bucket'
S3Key: 'my-key'