Last active
September 7, 2020 12:41
-
-
Save subzero112233/073baf063b8d03317c245283bc070301 to your computer and use it in GitHub Desktop.
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
AWSTemplateFormatVersion: '2010-09-09' | |
Transform: AWS::Serverless-2016-10-31 | |
Description: A lambda to upload to S3 | |
Parameters: | |
Environment: | |
Type: String | |
AllowedValues: | |
- dev | |
- staging | |
- prod | |
LambdaName: | |
Type: String | |
Default: medium-example | |
Resources: | |
LambdaFunction: | |
Type: AWS::Serverless::Function | |
Properties: | |
FunctionName: | |
Fn::Join: | |
- '-' | |
- - Ref: LambdaName | |
- Ref: Environment | |
Handler: main.lambda_handler | |
Runtime: python3.7 | |
Environment: | |
Variables: | |
EXAMPLE_S3_BUCKET: | |
Ref: ExampleS3Bucket | |
EXAMPLE_DYNAMODB_TABLE: | |
Ref: ExampleDynamoDBTable | |
MemorySize: 256 | |
Timeout: 600 | |
Events: | |
Timer: | |
Type: Schedule | |
Properties: | |
Schedule: rate(3 hours) | |
Tracing: Active | |
Policies: | |
- Statement: | |
- Action: | |
- s3:PutObject | |
Effect: Allow | |
Resource: | |
Fn::Join: | |
- / | |
- - Fn::GetAtt: | |
- ExampleS3Bucket | |
- Arn | |
- '*' | |
- Statement: | |
- Action: | |
- dynamodb:PutItem | |
Effect: Allow | |
Resource: | |
- !GetAtt ExampleDynamoDBTable.Arn | |
LambdaFunctionLogGroup: | |
Type: AWS::Logs::LogGroup | |
DependsOn: LambdaFunction | |
Properties: | |
LogGroupName: | |
Fn::Join: | |
- '' | |
- - /aws/lambda/ | |
- Ref: LambdaName | |
- '-' | |
- Ref: Environment | |
RetentionInDays: 14 | |
ExampleS3Bucket: | |
Type: AWS::S3::Bucket | |
Properties: | |
BucketName: | |
Fn::Join: | |
- '-' | |
- - san-antonio-spurs-medium-example | |
- Ref: Environment | |
ExampleDynamoDBTable: | |
Type: 'AWS::DynamoDB::Table' | |
Properties: | |
AttributeDefinitions: | |
- AttributeName: PlayerName | |
AttributeType: S | |
- AttributeName: JerseyNumber | |
AttributeType: N | |
KeySchema: | |
- AttributeName: PlayerName | |
KeyType: HASH | |
- AttributeName: JerseyNumber | |
KeyType: RANGE | |
TableName: | |
Fn::Join: | |
- '-' | |
- - san-antonio-spurs-medium-example | |
- Ref: Environment | |
BillingMode: PAY_PER_REQUEST | |
Outputs: | |
LambdaArn: | |
Value: | |
Fn::GetAtt: | |
- LambdaFunction | |
- Arn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment