72 lines
2.3 KiB
YAML
72 lines
2.3 KiB
YAML
AWSTemplateFormatVersion: '2010-09-09'
|
|
Transform: AWS::Serverless-2016-10-31
|
|
Description: |
|
|
RRig Monthly Totals Report
|
|
|
|
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
|
|
Globals:
|
|
Function:
|
|
Timeout: 3
|
|
|
|
Resources:
|
|
RRigReport:
|
|
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
|
|
Properties:
|
|
MemorySize: 128
|
|
Timeout: 300
|
|
Environment:
|
|
Variables:
|
|
username: henry.pump.automation@gmail.com
|
|
password: Henry Pump @ 2022
|
|
RRIGREPORTBUCKET_BUCKET_NAME: !ImportValue TBReportBucket
|
|
Architectures:
|
|
- arm64
|
|
CodeUri: rrigreport
|
|
Runtime: python3.12
|
|
Handler: rrigreport.lambda_handler
|
|
Policies:
|
|
- AmazonSESFullAccess
|
|
- Statement:
|
|
- Effect: Allow
|
|
Action:
|
|
- s3:PutObject
|
|
Resource:
|
|
- !Sub arn:${AWS::Partition}:s3:::!ImportValue TBReportBucket
|
|
- !Sub arn:${AWS::Partition}:s3:::!ImportValue TBReportBucket/*
|
|
Layers:
|
|
- !ImportValue TBReportLayer
|
|
|
|
RRigSchedule:
|
|
Type: AWS::Scheduler::Schedule
|
|
Properties:
|
|
ScheduleExpression: cron(5 7 1 * ? *)
|
|
FlexibleTimeWindow:
|
|
Mode: 'OFF'
|
|
ScheduleExpressionTimezone: America/Chicago
|
|
Target:
|
|
Arn: !GetAtt RRigReport.Arn
|
|
RoleArn: !GetAtt RRigScheduleToRRigReportRole.Arn
|
|
RRigScheduleToRRigReportRole:
|
|
Type: AWS::IAM::Role
|
|
Properties:
|
|
AssumeRolePolicyDocument:
|
|
Version: '2012-10-17'
|
|
Statement:
|
|
Effect: Allow
|
|
Principal:
|
|
Service: !Sub scheduler.${AWS::URLSuffix}
|
|
Action: sts:AssumeRole
|
|
Policies:
|
|
- PolicyName: StartExecutionPolicy
|
|
PolicyDocument:
|
|
Version: '2012-10-17'
|
|
Statement:
|
|
- Effect: Allow
|
|
Action:
|
|
- lambda:InvokeFunction
|
|
- s3:GetObject
|
|
- s3:PutObject
|
|
Resource:
|
|
- !GetAtt RRigReport.Arn
|
|
- !Sub arn:${AWS::Partition}:s3:::!ImportValue TBReportBucket
|
|
- !Sub arn:${AWS::Partition}:s3:::!ImportValue TBReportBucket/* |