Created
May 5, 2023 18:02
-
-
Save Artureio/d8d1e8af529dc68e4a0afbe2843a5b02 to your computer and use it in GitHub Desktop.
Bluearch.io Costing Report Engine (Child Account).
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 | |
Description: Sets up the necessary resources to run the Costing Report Engine in the child account. | |
Parameters: | |
StartDate: | |
Type: String | |
Description: The start date for the report in the format YYYY-MM-DD. | |
Default: 2019-01-01 | |
EndDate: | |
Type: String | |
Description: The end date for the report in the format YYYY-MM-DD. | |
Default: 2023-01-01 | |
Resources: | |
CSVBucket: | |
Type: AWS::S3::Bucket | |
Properties: | |
BucketName: !Join ["-", ["bluearchio-costing-report", !Select [0, !Split ["-", !Select [2, !Split ["/", !Ref 'AWS::StackId']]]]]] | |
AccessControl: Private | |
VersioningConfiguration: | |
Status: Enabled | |
Tags: | |
- Key: Name | |
Value: !Sub ${AWS::StackName}-csv-bucket | |
EC2Role: | |
Type: AWS::IAM::Role | |
Properties: | |
RoleName: bluearchio-costing-report-EC2Role | |
AssumeRolePolicyDocument: | |
Version: 2012-10-17 | |
Statement: | |
- Effect: Allow | |
Principal: | |
Service: | |
- ec2.amazonaws.com | |
Action: | |
- sts:AssumeRole | |
Policies: | |
- PolicyName: !Sub ${AWS::StackName}-EC2Policy | |
PolicyDocument: | |
Version: 2012-10-17 | |
Statement: | |
- Resource: "*" | |
Effect: Allow | |
Action: | |
- logs:CreateLogGroup | |
- logs:CreateLogStream | |
- logs:PutLogEvents | |
- organizations:DescribeOrganization | |
- ssm:GetParameter | |
- ssm:GetParameters | |
- sts:AssumeRole | |
- Resource: !GetAtt CSVBucket.Arn | |
Effect: Allow | |
Action: | |
- s3:PutObject | |
- s3:ListBucket | |
EC2InstanceProfile: | |
Type: AWS::IAM::InstanceProfile | |
Properties: | |
Path: / | |
Roles: | |
- !Ref EC2Role | |
BucketNameSSMParameter: | |
Type: AWS::SSM::Parameter | |
Properties: | |
Name: /bluearchio/costing-report-engine/bucket-name | |
Type: String | |
Value: !Ref CSVBucket | |
StartDateSSMParameter: | |
Type: AWS::SSM::Parameter | |
Properties: | |
Name: /bluearchio/costing-report-engine/start-date | |
Type: String | |
Value: !Ref StartDate | |
EndDateSSMParameter: | |
Type: AWS::SSM::Parameter | |
Properties: | |
Name: /bluearchio/costing-report-engine/end-date | |
Type: String | |
Value: !Ref EndDate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment