Skip to content

Commit

Permalink
Update template.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottBrenner authored Jun 29, 2024
1 parent 62f1746 commit 1674364
Showing 1 changed file with 49 additions and 45 deletions.
94 changes: 49 additions & 45 deletions examples/template.yml
Original file line number Diff line number Diff line change
@@ -1,80 +1,84 @@
# https://github.com/awslabs/aws-cloudformation-templates/blob/master/community/services/Lambda/LambdaSample.yaml
AWSTemplateFormatVersion: '2010-09-09'
# https://github.com/aws-cloudformation/aws-cloudformation-templates/blob/main/Lambda/LambdaSample.yaml
AWSTemplateFormatVersion: "2010-09-09"

Description: Template for Lambda Sample.

Parameters:
EnvName:
Type: String
Description: Name of an environment. 'dev', 'staging', 'prod' and any name.
Type: String
AllowedPattern: ^.*[^0-9]$
ConstraintDescription: Must end with non-numeric character.

LambdaHandlerPath:
Type: String
Description: Path of a Lambda Handler.
Type: String
AllowedPattern: ^.*[^0-9]$
ConstraintDescription: Must end with non-numeric character.
Outputs:
LambdaRoleARN:
Description: Role for Lambda execution.
Value:
Fn::GetAtt:
- LambdaRole
- Arn
Export:
Name:
Fn::Sub: LambdaRole-${EnvName}
LambdaFunctionName:
Value:
Ref: LambdaFunction
LambdaFunctionARN:
Description: Lambda function ARN.
Value:
Fn::GetAtt:
- LambdaFunction
- Arn
Export:
Name:
Fn::Sub: LambdaARN-${EnvName}

Resources:
LambdaRole:
Type: AWS::IAM::Role
Properties:
RoleName:
Fn::Sub: lambda-role-${EnvName}
RoleName: lambda-role
AssumeRolePolicyDocument:
Statement:
- Action:
- sts:AssumeRole
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Version: 2012-10-17
- lambda.amazonaws.com
Version: "2012-10-17"
ManagedPolicyArns:
- arn:aws:iam::aws:policy/AWSLambdaExecute
- arn:aws:iam::aws:policy/AmazonS3FullAccess
- arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess
- arn:aws:iam::aws:policy/AmazonKinesisFullAccess
Path: /

LambdaFunction:
Type: AWS::Lambda::Function
Metadata:
guard:
SuppressedRules:
- LAMBDA_INSIDE_VPC
- LAMBDA_FUNCTION_PUBLIC_ACCESS_PROHIBITED
Properties:
FunctionName:
Fn::Sub: lambda-function-${EnvName}
Description: LambdaFunctioni of nodejs18.x.
Runtime: nodejs18.x
FunctionName: !Sub lambda-function-${EnvName}
Description: LambdaFunction using python3.12.
Runtime: python3.12

Check failure on line 50 in examples/template.yml

View workflow job for this annotation

GitHub Actions / ubuntu-20.04

E3030 You must specify a valid value for Runtime (python3.12). Valid values are ["dotnet6", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "go1.x", "java11", "java8", "java8.al2", "nodejs", "nodejs10.x", "nodejs12.x", "nodejs14.x", "nodejs16.x", "nodejs18.x", "nodejs4.3", "nodejs4.3-edge", "nodejs6.10", "nodejs8.10", "provided", "provided.al2", "python2.7", "python3.6", "python3.7", "python3.8", "python3.9", "ruby2.5", "ruby2.7"]

Check failure on line 50 in examples/template.yml

View workflow job for this annotation

GitHub Actions / ubuntu-22.04

E3030 You must specify a valid value for Runtime (python3.12). Valid values are ["dotnet6", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "go1.x", "java11", "java8", "java8.al2", "nodejs", "nodejs10.x", "nodejs12.x", "nodejs14.x", "nodejs16.x", "nodejs18.x", "nodejs4.3", "nodejs4.3-edge", "nodejs6.10", "nodejs8.10", "provided", "provided.al2", "python2.7", "python3.6", "python3.7", "python3.8", "python3.9", "ruby2.5", "ruby2.7"]

Check failure on line 50 in examples/template.yml

View workflow job for this annotation

GitHub Actions / windows-2019

E3030 You must specify a valid value for Runtime (python3.12). Valid values are ["dotnet6", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "go1.x", "java11", "java8", "java8.al2", "nodejs", "nodejs10.x", "nodejs12.x", "nodejs14.x", "nodejs16.x", "nodejs18.x", "nodejs4.3", "nodejs4.3-edge", "nodejs6.10", "nodejs8.10", "provided", "provided.al2", "python2.7", "python3.6", "python3.7", "python3.8", "python3.9", "ruby2.5", "ruby2.7"]

Check failure on line 50 in examples/template.yml

View workflow job for this annotation

GitHub Actions / windows-2022

E3030 You must specify a valid value for Runtime (python3.12). Valid values are ["dotnet6", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "go1.x", "java11", "java8", "java8.al2", "nodejs", "nodejs10.x", "nodejs12.x", "nodejs14.x", "nodejs16.x", "nodejs18.x", "nodejs4.3", "nodejs4.3-edge", "nodejs6.10", "nodejs8.10", "provided", "provided.al2", "python2.7", "python3.6", "python3.7", "python3.8", "python3.9", "ruby2.5", "ruby2.7"]

Check failure on line 50 in examples/template.yml

View workflow job for this annotation

GitHub Actions / macos-13

E3030 You must specify a valid value for Runtime (python3.12). Valid values are ["dotnet6", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "go1.x", "java11", "java8", "java8.al2", "nodejs", "nodejs10.x", "nodejs12.x", "nodejs14.x", "nodejs16.x", "nodejs18.x", "nodejs4.3", "nodejs4.3-edge", "nodejs6.10", "nodejs8.10", "provided", "provided.al2", "python2.7", "python3.6", "python3.7", "python3.8", "python3.9", "ruby2.5", "ruby2.7"]

Check failure on line 50 in examples/template.yml

View workflow job for this annotation

GitHub Actions / macos-14

E3030 You must specify a valid value for Runtime (python3.12). Valid values are ["dotnet6", "dotnetcore1.0", "dotnetcore2.0", "dotnetcore2.1", "dotnetcore3.1", "go1.x", "java11", "java8", "java8.al2", "nodejs", "nodejs10.x", "nodejs12.x", "nodejs14.x", "nodejs16.x", "nodejs18.x", "nodejs4.3", "nodejs4.3-edge", "nodejs6.10", "nodejs8.10", "provided", "provided.al2", "python2.7", "python3.6", "python3.7", "python3.8", "python3.9", "ruby2.5", "ruby2.7"]
Code:
ZipFile:
"exports.handler = function(event, context){\n
var sample = sample;"
Handler: !Ref LambdaHandlerPath
ZipFile: |
import json
def lambda_handler(event, context):
print(json.dumps(event))
return {
'statusCode': 200,
'body': json.dumps('Hello from Lambda!')
}
Handler: !Sub ${LambdaHandlerPath}
MemorySize: 128
Timeout: 10
Role:
Fn::GetAtt:
- LambdaRole
- Arn
Role: !GetAtt LambdaRole.Arn
Environment:
Variables:
ENV:
Fn::Sub: ${EnvName}
ENV: !Ref EnvName
TZ: UTC

Outputs:
LambdaRoleARN:
Description: Role for Lambda execution.
Value: !GetAtt LambdaRole.Arn
Export:
Name: LambdaRole

LambdaFunctionName:
Value: !Ref LambdaFunction

LambdaFunctionARN:
Description: Lambda function ARN.
Value: !GetAtt LambdaFunction.Arn
Export:
Name: !Sub LambdaARN-${EnvName}

0 comments on commit 1674364

Please sign in to comment.