-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
67 lines (67 loc) · 2.13 KB
/
template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Lambda function for creating ABC custom line items to distribute SP/RI benefits
Parameters:
pLambdaScheduleExpression:
Type: String
Description: Schedule expression for the Lambda function
# fifth day of every month
Default: cron(0 0 5 * ? *)
Globals:
Function:
Timeout: 900
MemorySize: 128
LoggingConfig:
LogFormat: JSON
Resources:
rLambdaFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: sam_sp_ri_utility/
Handler: app.lambda_handler
Runtime: python3.12
Architectures:
- arm64
Events:
ScheduledEvent:
Type: ScheduleV2
Properties:
ScheduleExpression: !Ref pLambdaScheduleExpression
ScheduleExpressionTimezone: UTC
Environment:
Variables:
# change this value to something else to write the custom line items to Billing Conductor
DRY_RUN: Enabled
# Savings Plans benefits are only distributed to EC2 by default
INCLUDE_FARGATE_FOR_SAVINGS_PLANS: Disabled
INCLUDE_LAMBDA_FOR_SAVINGS_PLANS: Disabled
Policies:
- Statement:
- Sid: BillingConductorAndCostExplorer
Effect: Allow
Action:
- billingconductor:ListAccountAssociations
- billingconductor:CreateCustomLineItem
- ce:GetCostAndUsage
- ce:GetReservationUtilization
- ce:GetSavingsPlansUtilizationDetails
- organizations:ListAccounts
Resource:
- '*'
- Statement:
- Sid: SNSPublishToFailureTopic
Effect: Allow
Action:
- sns:Publish
Resource:
- !Ref rLambdaFailureTopic
rLambdaFailureTopic:
Type: AWS::SNS::Topic
rEventInvokeConfig:
Type: AWS::Lambda::EventInvokeConfig
Properties:
DestinationConfig:
OnFailure:
Destination: !Ref rLambdaFailureTopic
FunctionName: !Ref rLambdaFunction
Qualifier: $LATEST