Metricsbird
Search…
CloudFormation
This is the CloudFormation template we install in your AWS account.
AWSTemplateFormatVersion: 2010-09-09
Description: Metricsbird master CFN template to create firehose, destination S3 bucket, subscribe Cloudwatch Logs to firehose and set retention period, user to access s3
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
-
Label:
default: "Parameters to Update/review"
Parameters:
- ExternalId
- Retention
- BucketName
Parameters:
ExternalId:
Type: String
Description: Organization/Client ID obtained from meticsbird dashboard
Default: "76543"
BucketName:
Type: String
Description: Enter cloudwatch logs destination bucket name for firehose (Make sure it to be unique)
Default: "mb-firehose-s3"
DeliveryStreamName:
Description: Firehose Name
Type: String
Default: "mb-Firehose2s3"
FirehoseBufferSize:
Type: String
Description: Enter Firehose buffer size
Default: 1
FirehoseBufferInterval:
Type: String
Description: Enter Firehose buffer interval (in secords)
Default: 60
FilterName:
Description: Add cloudwatch log group Subscription Filter Name
Type: String
Default: "Dummy_Filter"
FilterPattern:
Description: Add Subscription Filter Pattern
Type: String
Default: ""
Retention:
Description: Cloudwatch Log group Retention time(in days)
Type: Number
Default: "7"
StreamProcessFunctionName:
Description: Firehose Transform Lambda Function Name
Type: String
Default: "mb-Firehose2s3-logs-Function"
FirehoseLogsTemplate:
Description: URL for Cloudformation template to create Kinesis Firehose to S3 for Cloudwatch Logs
Type: String
Default: "https://metricsbird-onboarding-client-bucket.s3.us-east-2.amazonaws.com/metricsbird-onboarding-Firehose2s3-v1.yml"
S3AccessTemplate:
Description: Firehose to S3 Template Url
Type: String
Default: "https://metricsbird-onboarding-client-bucket.s3.us-east-2.amazonaws.com/metricsbird-onboarding-s3access-v1.yml"
SubscriptionRetentionTemplate:
Description: URL for Cloudformation template to create Cloudwatch event for new log group creation
Type: String
Default: "https://metricsbird-onboarding-client-bucket.s3.us-east-2.amazonaws.com/metricsbird-onboarding-CloudEvent-v1.yml"
RoleTemplate:
Description: URL for Cloudformation template to create READONLY Thirdparty/cross-account access role
Type: String
Default: "https://metricsbird-onboarding-client-bucket.s3.us-east-2.amazonaws.com/metricsbird-onboarding-ThirdPartyRole-v1.yml"
Datacenter:
Description: Metricsbird AWS account ID to create Thirdparty/cross-account access role
Type: String
Default: "918096307271"
ExternalApiUrl:
Type: String
Description: Metricsbird onboarding API URL
Default: "https://gbvk1btk0k.execute-api.us-east-2.amazonaws.com/Development/"
Resources:
FirstStack:
Type: 'AWS::CloudFormation::Stack'
Properties:
TemplateURL: !Ref FirehoseLogsTemplate
Parameters:
BucketName: !Sub '${BucketName}-logs'
FirehoseBufferSize: !Ref FirehoseBufferSize
FirehoseBufferSize: !Ref FirehoseBufferSize
FirehoseBufferInterval: !Ref FirehoseBufferInterval
FourthStack:
Type: 'AWS::CloudFormation::Stack'
DependsOn:
- FirstStack
Properties:
TemplateURL: !Ref S3AccessTemplate
Parameters:
BucketName: !Ref BucketName
SecondStack:
Type: 'AWS::CloudFormation::Stack'
DependsOn:
- FourthStack
Properties:
TemplateURL: !Ref SubscriptionRetentionTemplate
Parameters:
FilterName: !Ref FilterName
FilterPattern: !Ref FilterPattern
Retention: !Ref Retention
StreamProcessFunctionArnParam:
!GetAtt
- FirstStack
- Outputs.StreamProcessFunctionArnOutput
DeliveryStreamArnParam:
!GetAtt
- FirstStack
- Outputs.DeliveryStreamArnOutput
StreamProcessFunctionName: !Ref StreamProcessFunctionName
DeliveryStreamName: !Sub '${DeliveryStreamName}-logs'
ExternalId: !Ref ExternalId
ThirdPartyRoleARN:
!GetAtt
- RoleStack
- Outputs.ThirdPartyRoleARN
BucketArn:
!GetAtt
- FirstStack
- Outputs.BucketArn
ExternalApiUrl: !Ref ExternalApiUrl
AccessKeyID:
!GetAtt
- FourthStack
- Outputs.AccessKeyID
SecretAccessKey:
!GetAtt
- FourthStack
- Outputs.SecretAccessKey
RoleStack:
Type: 'AWS::CloudFormation::Stack'
Properties:
TemplateURL: !Ref RoleTemplate
Parameters:
Datacenter: !Ref Datacenter
ExternalId: !Ref ExternalId
Outputs:
BucketArn:
Value: !GetAtt
- FirstStack
- Outputs.BucketArn
Export:
Name: LogsBucketArn
DeliveryStreamArnOutput:
Value: !GetAtt
- FirstStack
- Outputs.DeliveryStreamArnOutput
StreamProcessFunctionArnOutput:
Value: !GetAtt
- FirstStack
- Outputs.StreamProcessFunctionArnOutput
RoleARN:
Description: Amazon Resource Name of your new Cross-Account IAM Role.
Value: !GetAtt
- RoleStack
- Outputs.ThirdPartyRoleARN
Copy link