AWSTemplateFormatVersion: 2010-09-09 Transform: AWS::Serverless-2016-10-31 Description: UploadFiletoS3 Lambda function template for Application Load Balancer Lambda as target Outputs: UploadFiletoS3FunctionARN: Description: "ARN of the UploadFiletoS3 Lambda function" Value: !GetAtt UploadFiletoS3Function.Arn Resources: UploadFiletoS3Function: Type: AWS::Serverless::Function Properties: Description: An Application Load Balancer Lambda Target that upload files to S3 Handler: uploadfile.lambda_handler Runtime: python3.8 CodeUri: ./ Timeout: 300 Role: !GetAtt UploadFiletoS3FunctionRole.Arn DependsOn: - UploadFiletoS3FunctionRole UploadFiletoS3FunctionRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Principal: Service: - lambda.amazonaws.com Action: - sts:AssumeRole ManagedPolicyArns: - arn:aws:iam::aws:policy/AmazonS3FullAccess