Skip to content

Commit 0e1b331

Browse files
authored
Fix lambda data (#168)
* fix lambda inventory as Environment breaks crawler * rename lambda to lambda_functions * rename lambda to lambda_functions * lint and refactor * refactor output
1 parent 432de10 commit 0e1b331

File tree

1 file changed

+50
-16
lines changed

1 file changed

+50
-16
lines changed

data-collection/deploy/deploy-data-collection.yaml

Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Metadata:
3636
- IncludeLicenseManagerModule
3737
ParameterLabels:
3838
DestinationBucket:
39-
default: 'Destination S3 bucket'
39+
default: 'Destination S3 bucket prefix'
4040
ManagementAccountRole:
4141
default: 'Management account role'
4242
ManagementAccountID:
@@ -113,7 +113,7 @@ Mappings:
113113
Parameters:
114114
DestinationBucket:
115115
Type: String
116-
Description: A Prefix of S3 Bucket name that will hold information. A Bucket name will be concatenated with account_id automatically (cid-data-123456123456). You can keep this parameter as is.
116+
Description: "A Prefix of S3 Bucket name that will hold information. A Bucket name will be concatenated with account_id automatically (ex: cid-data-123456123456). You can keep this parameter as is."
117117
AllowedPattern: (?=^.{3,36}$)(?!^(\d+\.)+\d+$)(^(([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)*([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9\-])$)
118118
Default: cid-data-
119119
ManagementAccountRole:
@@ -230,20 +230,6 @@ Parameters:
230230
AllowedValues: ['yes', 'no']
231231
Default: 'no'
232232

233-
Outputs:
234-
S3Bucket:
235-
Description: Name of S3 Bucket which will store the AWS Cost Explorer Rightsizing recommendations
236-
Value: !Ref S3Bucket
237-
S3BucketARN:
238-
Description: ARN of S3 Bucket which will store the AWS Cost Explorer Rightsizing recommendations
239-
Value: !GetAtt S3Bucket.Arn
240-
RoleARN:
241-
Description: "The arn of the IAM role that deployed in the management account which can retrieve AWS Organization data"
242-
Value: !Sub "arn:aws:iam::${ManagementAccountID}:role/${ManagementAccountRole}"
243-
DataCollectionDatabase:
244-
Description: "Techical Value - DataCollectionDatabase"
245-
Value: !Ref DatabaseName
246-
Export: { Name: "cid-DataCollection-Database" }
247233

248234
Conditions:
249235
DeployTAModule: !Equals [ !Ref IncludeTAModule, "yes"]
@@ -1223,3 +1209,51 @@ Resources:
12231209
ResourcePrefix: !Ref ResourcePrefix
12241210
DestinationBucket: !Ref S3Bucket
12251211
DestinationBucketARN: !GetAtt S3Bucket.Arn
1212+
1213+
DataCollectionReadAccess:
1214+
Type: AWS::IAM::ManagedPolicy
1215+
Properties:
1216+
ManagedPolicyName: !Sub ${ResourcePrefix}DataCollectionReadAccess
1217+
Description: 'Policy for QuickSight to allow DataCollection access'
1218+
PolicyDocument:
1219+
Version: '2012-10-17'
1220+
Statement:
1221+
- Sid: AllowGlue
1222+
Effect: Allow
1223+
Action:
1224+
- glue:GetPartition
1225+
- glue:GetPartitions
1226+
- glue:GetDatabase
1227+
- glue:GetDatabases
1228+
- glue:GetTable
1229+
- glue:GetTables
1230+
Resource:
1231+
- !Sub arn:${AWS::Partition}:glue:${AWS::Region}:${AWS::AccountId}:catalog
1232+
- !Sub arn:${AWS::Partition}:glue:${AWS::Region}:${AWS::AccountId}:database/${DatabaseName}
1233+
- !Sub arn:${AWS::Partition}:glue:${AWS::Region}:${AWS::AccountId}:table/${DatabaseName}/*
1234+
- Sid: AllowListBucket
1235+
Effect: Allow
1236+
Action: s3:ListBucket
1237+
Resource:
1238+
- !Sub ${S3Bucket.Arn}
1239+
- Sid: AllowReadBucket
1240+
Effect: Allow
1241+
Action:
1242+
- s3:GetObject
1243+
- s3:GetObjectVersion
1244+
Resource:
1245+
- !Sub ${S3Bucket.Arn}/*
1246+
1247+
Outputs:
1248+
Bucket:
1249+
Description: CID Data Collection - Name of S3 Bucket which will store collected data
1250+
Value: !Ref S3Bucket
1251+
Export: { Name: "cid-DataCollection-Bucket" }
1252+
Database:
1253+
Description: "Glue Database for CID Data Collection"
1254+
Value: !Ref DatabaseName
1255+
Export: { Name: "cid-DataCollection-Database" }
1256+
ReadAccessPolicyARN:
1257+
Description: "Access Policy for CID Data Collection"
1258+
Value: !Ref DataCollectionReadAccess
1259+
Export: { Name: "cid-DataCollection-ReadAccessPolicyARN" }

0 commit comments

Comments
 (0)