-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
62f1746
commit 1674364
Showing
1 changed file
with
49 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 GitHub Actions / ubuntu-20.04
Check failure on line 50 in examples/template.yml GitHub Actions / ubuntu-22.04
Check failure on line 50 in examples/template.yml GitHub Actions / windows-2019
Check failure on line 50 in examples/template.yml GitHub Actions / windows-2022
Check failure on line 50 in examples/template.yml GitHub Actions / macos-13
Check failure on line 50 in examples/template.yml GitHub Actions / macos-14
|
||
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} |