-
Notifications
You must be signed in to change notification settings - Fork 10
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
Showing
5 changed files
with
406 additions
and
0 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
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
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 |
---|---|---|
@@ -0,0 +1,195 @@ | ||
AWSTemplateFormatVersion: '2010-09-09' | ||
Description: Budgets example | ||
Resources: | ||
|
||
AWSConfig: | ||
Type: AWS::Budgets::Budget | ||
DeletionPolicy: Retain | ||
UpdateReplacePolicy: Retain | ||
Properties: | ||
Budget: | ||
BudgetLimit: | ||
Amount: '10000.0' | ||
Unit: USD | ||
BudgetName: AWS-Config | ||
BudgetType: COST | ||
CostFilters: | ||
Service: | ||
- AWS Config | ||
CostTypes: | ||
IncludeCredit: false | ||
IncludeDiscount: false | ||
IncludeOtherSubscription: true | ||
IncludeRecurring: true | ||
IncludeRefund: false | ||
IncludeSubscription: true | ||
IncludeSupport: false | ||
IncludeTax: false | ||
IncludeUpfront: true | ||
UseAmortized: true | ||
UseBlended: false | ||
TimePeriod: | ||
End: '2087-06-15T10:00:00+10:00' | ||
Start: '2023-05-01T10:00:00+10:00' | ||
TimeUnit: MONTHLY | ||
|
||
AWSCloudwatch: | ||
Type: AWS::Budgets::Budget | ||
DeletionPolicy: Retain | ||
UpdateReplacePolicy: Retain | ||
Properties: | ||
Budget: | ||
BudgetLimit: | ||
Amount: '10000.0' | ||
Unit: USD | ||
BudgetName: AWS-Cloudwatch | ||
BudgetType: COST | ||
CostFilters: | ||
LinkedAccount: | ||
- '111111111111' | ||
- '222222222222' | ||
Service: | ||
- AmazonCloudWatch | ||
- CloudWatch Events | ||
CostTypes: | ||
IncludeCredit: false | ||
IncludeDiscount: false | ||
IncludeOtherSubscription: true | ||
IncludeRecurring: true | ||
IncludeRefund: false | ||
IncludeSubscription: true | ||
IncludeSupport: true | ||
IncludeTax: false | ||
IncludeUpfront: true | ||
UseAmortized: true | ||
UseBlended: false | ||
TimePeriod: | ||
End: '2087-06-15T10:00:00+10:00' | ||
Start: '2022-02-01T11:00:00+10:00' | ||
TimeUnit: MONTHLY | ||
|
||
AWSGuardDuty: | ||
Type: AWS::Budgets::Budget | ||
DeletionPolicy: Retain | ||
UpdateReplacePolicy: Retain | ||
Properties: | ||
Budget: | ||
BudgetLimit: | ||
Amount: '1000.0' | ||
Unit: USD | ||
BudgetName: AWS-GuardDuty | ||
BudgetType: COST | ||
CostFilters: | ||
Service: | ||
- Amazon GuardDuty | ||
CostTypes: | ||
IncludeCredit: false | ||
IncludeDiscount: false | ||
IncludeOtherSubscription: true | ||
IncludeRecurring: true | ||
IncludeRefund: false | ||
IncludeSubscription: true | ||
IncludeSupport: true | ||
IncludeTax: false | ||
IncludeUpfront: true | ||
UseAmortized: false | ||
UseBlended: false | ||
TimePeriod: | ||
End: '2087-06-15T10:00:00+10:00' | ||
Start: '2023-01-01T11:00:00+10:00' | ||
TimeUnit: MONTHLY | ||
|
||
AWSInspector: | ||
Type: AWS::Budgets::Budget | ||
DeletionPolicy: Retain | ||
UpdateReplacePolicy: Retain | ||
Properties: | ||
Budget: | ||
BudgetLimit: | ||
Amount: '1000.0' | ||
Unit: USD | ||
BudgetName: AWS-Inspector | ||
BudgetType: COST | ||
CostFilters: | ||
Service: | ||
- Amazon Inspector | ||
CostTypes: | ||
IncludeCredit: false | ||
IncludeDiscount: false | ||
IncludeOtherSubscription: true | ||
IncludeRecurring: true | ||
IncludeRefund: false | ||
IncludeSubscription: true | ||
IncludeSupport: true | ||
IncludeTax: false | ||
IncludeUpfront: true | ||
UseAmortized: false | ||
UseBlended: false | ||
TimePeriod: | ||
End: '2087-06-15T10:00:00+10:00' | ||
Start: '2022-08-01T10:00:00+10:00' | ||
TimeUnit: MONTHLY | ||
|
||
AWSSecurityHub: | ||
Type: AWS::Budgets::Budget | ||
DeletionPolicy: Retain | ||
UpdateReplacePolicy: Retain | ||
Properties: | ||
Budget: | ||
BudgetLimit: | ||
Amount: '1000.0' | ||
Unit: USD | ||
BudgetName: AWS-SecurityHub | ||
BudgetType: COST | ||
CostFilters: | ||
Service: | ||
- AWS Security Hub | ||
CostTypes: | ||
IncludeCredit: false | ||
IncludeDiscount: false | ||
IncludeOtherSubscription: true | ||
IncludeRecurring: true | ||
IncludeRefund: false | ||
IncludeSubscription: true | ||
IncludeSupport: true | ||
IncludeTax: false | ||
IncludeUpfront: true | ||
UseAmortized: false | ||
UseBlended: false | ||
TimePeriod: | ||
End: '2087-06-15T10:00:00+10:00' | ||
Start: '2022-08-01T10:00:00+10:00' | ||
TimeUnit: MONTHLY | ||
|
||
AWSSecurityLogs: | ||
Type: AWS::Budgets::Budget | ||
DeletionPolicy: Retain | ||
UpdateReplacePolicy: Retain | ||
Properties: | ||
Budget: | ||
BudgetLimit: | ||
Amount: '1000.0' | ||
Unit: USD | ||
BudgetName: AWS-SecurityLogs | ||
BudgetType: COST | ||
CostFilters: | ||
LinkedAccount: | ||
- '111111111111' | ||
Service: | ||
- Amazon Simple Storage Service | ||
CostTypes: | ||
IncludeCredit: false | ||
IncludeDiscount: false | ||
IncludeOtherSubscription: true | ||
IncludeRecurring: true | ||
IncludeRefund: false | ||
IncludeSubscription: true | ||
IncludeSupport: true | ||
IncludeTax: false | ||
IncludeUpfront: true | ||
UseAmortized: false | ||
UseBlended: false | ||
TimePeriod: | ||
End: '2087-06-15T10:00:00+10:00' | ||
Start: '2022-08-01T10:00:00+10:00' | ||
TimeUnit: MONTHLY |
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 |
---|---|---|
@@ -0,0 +1,109 @@ | ||
AWSTemplateFormatVersion: '2010-09-09' | ||
Description: AWS Chatbots and SNS topics for Cost alerts | ||
|
||
Parameters: | ||
SlackChannelName: | ||
Description: Slack Channel Name | ||
Type: String | ||
SlackChannelId: | ||
Description: The ID of the Slack channel to send alerts to | ||
Type: String | ||
SlackWorkspaceId: | ||
Description: The ID of the Slack workspace authorized with AWS Chatbot | ||
Type: String | ||
|
||
Resources: | ||
############################################################ | ||
# SNS Topics and Policies | ||
|
||
SNSTopic: | ||
Type: AWS::SNS::Topic | ||
Properties: | ||
DisplayName: !Sub Cost Alerts ${SlackChannelName} | ||
TopicName: !Sub CostAlerts-${SlackChannelName} | ||
|
||
SNSTopicPolicy: | ||
Type: AWS::SNS::TopicPolicy | ||
Properties: | ||
PolicyDocument: | ||
Version: 2012-10-17 | ||
Statement: | ||
- Sid: !Sub Budgets-${SlackChannelName} | ||
Effect: Allow | ||
Action: | ||
- SNS:Publish | ||
Principal: | ||
Service: | ||
budgets.amazonaws.com | ||
Resource: | ||
- !Ref SNSTopic | ||
- Sid: !Sub CostAnomalyDetection-${SlackChannelName} | ||
Effect: Allow | ||
Action: | ||
- SNS:Publish | ||
Principal: | ||
Service: | ||
costalerts.amazonaws.com | ||
Resource: | ||
- !Ref SNSTopic | ||
Topics: | ||
- !Ref SNSTopic | ||
|
||
############################################################ | ||
# Chatbot | ||
|
||
ChatbotRole: | ||
Type: AWS::IAM::Role | ||
Properties: | ||
AssumeRolePolicyDocument: | ||
Version: 2012-10-17 | ||
Statement: | ||
- Effect: Allow | ||
Principal: | ||
Service: | ||
- chatbot.amazonaws.com | ||
Action: | ||
- sts:AssumeRole | ||
Policies: | ||
- PolicyName: ChatbotRolePolicy | ||
PolicyDocument: | ||
Version: 2012-10-17 | ||
Statement: | ||
- Effect: Allow | ||
Action: | ||
- cloudwatch:Describe* | ||
- cloudwatch:Get* | ||
- cloudwatch:List* | ||
Resource: '*' | ||
|
||
GuardrailPolicy: | ||
Type: AWS::IAM::ManagedPolicy | ||
Properties: | ||
Description: Chatbot Guardrail Policies | ||
PolicyDocument: | ||
Version: 2012-10-17 | ||
Statement: | ||
- Effect: Allow | ||
Action: | ||
- cloudwatch:Describe* | ||
- cloudwatch:Get* | ||
- cloudwatch:List* | ||
Resource: '*' | ||
|
||
SlackChatbot: | ||
Type: AWS::Chatbot::SlackChannelConfiguration | ||
Properties: | ||
ConfigurationName: !Sub ${SlackChannelName}-Alerts | ||
GuardrailPolicies: | ||
- !Ref GuardrailPolicy | ||
IamRoleArn: !GetAtt ChatbotRole.Arn | ||
LoggingLevel: INFO | ||
SlackChannelId: !Ref SlackChannelId | ||
SlackWorkspaceId: !Ref SlackWorkspaceId | ||
SnsTopicArns: | ||
- !Ref SNSTopic | ||
|
||
Outputs: | ||
SlackSNSTopicARN: | ||
Description: Slack SNS Topic ARN | ||
Value: !Ref SNSTopic |
Oops, something went wrong.