forked from kubecost/cloudformation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkubecost-masterpayer-account-permissions.yaml
More file actions
80 lines (76 loc) · 2.25 KB
/
Copy pathkubecost-masterpayer-account-permissions.yaml
File metadata and controls
80 lines (76 loc) · 2.25 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
AWSTemplateFormatVersion: '2010-09-09'
Description: Kubecost Masterpayer Account Template
Parameters:
AthenaCURBucket:
Description: The bucket where the CUR is sent from the “Setting up the CUR” step.
Type: String
KubecostClusterID:
Description: Amazon account running kubecost that requires access.
Type: String
Resources:
KubecostRole:
Type: 'AWS::IAM::Role'
Properties:
RoleName: !Sub 'KubecostRole-${KubecostClusterID}'
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
AWS: !Sub 'arn:aws:iam::${KubecostClusterID}:root'
Action:
- 'sts:AssumeRole'
AthenaPolicy:
Type: 'AWS::IAM::Policy'
Properties:
Roles:
- !Ref KubecostRole
PolicyName: !Sub 'kubecost-athena-access-${KubecostClusterID}'
PolicyDocument:
Version: '2012-10-17'
Statement:
- Sid: AthenaAccess
Effect: Allow
Action:
- athena:*
Resource:
- "*"
- Sid: ReadAccessToAthenaCurDataViaGlue
Effect: Allow
Action:
- glue:GetDatabase*
- glue:GetTable*
- glue:GetPartition*
- glue:GetUserDefinedFunction
- glue:BatchGetPartition
Resource:
- arn:aws:glue:*:*:catalog
- arn:aws:glue:*:*:database/athenacurcfn*
- arn:aws:glue:*:*:table/athenacurcfn*/*
- Sid: AthenaQueryResultsOutput
Effect: Allow
Action:
- s3:GetBucketLocation
- s3:GetObject
- s3:ListBucket
- s3:ListBucketMultipartUploads
- s3:ListMultipartUploadParts
- s3:AbortMultipartUpload
- s3:CreateBucket
- s3:PutObject
Resource:
- arn:aws:s3:::aws-athena-query-results-*
- Sid: S3ReadAccessToAwsBillingData
Effect: Allow
Action:
- s3:Get*
- s3:List*
Resource:
- !Sub 'arn:aws:s3:::${AthenaCURBucket}*'
- Sid: ReadAccessToAccountTags
Effect: Allow
Action:
- organizations:ListAccounts
- organizations:ListTagsForResource
Resource:
- "*"