Skip to content

Commit

Permalink
create region map
Browse files Browse the repository at this point in the history
  • Loading branch information
iakov-aws committed Sep 25, 2024
1 parent 499bb38 commit 7ab19dc
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion cfn-templates/cid-cfn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,31 @@ Conditions:
- !Condition NeedQuickSightDataSourceRole
- !Condition NeedDataBucketsKms
NeedPermissionsBoundary: !Not [!Equals [ !Ref PermissionsBoundary, "" ]]
LambdaLayerBucketPrefixIsManaged: !Equals [!Ref LambdaLayerBucketPrefix, 'aws-managed-cost-intelligence-dashboards']

Mappings:
RegionMap: # CID has AWS managed buckets for deploy. Region must support QuickSight ( curl https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonQuickSight/current/region_index.json -s | jq '.regions | keys' )
ap-northeast-1: {BucketName: aws-managed-cost-intelligence-dashboards-ap-northeast-1}
ap-northeast-2: {BucketName: aws-managed-cost-intelligence-dashboards-ap-northeast-2}
ap-south-1: {BucketName: aws-managed-cost-intelligence-dashboards-ap-south-1}
ap-southeast-1: {BucketName: aws-managed-cost-intelligence-dashboards-ap-southeast-1}
ap-southeast-2: {BucketName: aws-managed-cost-intelligence-dashboards-ap-southeast-2}
ca-central-1: {BucketName: aws-managed-cost-intelligence-dashboards-ca-central-1}
eu-central-1: {BucketName: aws-managed-cost-intelligence-dashboards-eu-central-1}
eu-north-1: {BucketName: aws-managed-cost-intelligence-dashboards-eu-north-1}
eu-west-1: {BucketName: aws-managed-cost-intelligence-dashboards-eu-west-1}
eu-west-2: {BucketName: aws-managed-cost-intelligence-dashboards-eu-west-2}
eu-west-3: {BucketName: aws-managed-cost-intelligence-dashboards-eu-west-3}
sa-east-1: {BucketName: aws-managed-cost-intelligence-dashboards-sa-east-1}
us-east-1: {BucketName: aws-managed-cost-intelligence-dashboards-us-east-1}
us-east-2: {BucketName: aws-managed-cost-intelligence-dashboards-us-east-2}
us-west-1: {BucketName: aws-managed-cost-intelligence-dashboards-us-west-1}
us-west-2: {BucketName: aws-managed-cost-intelligence-dashboards-us-west-2}
#todo: add af-south-1
#todo: add ap-southeast-3
#todo: add eu-south-1
#todo: add eu-central-2


Resources:
SpiceRefreshExecutionRole: #Role needed to schedule spice ingestion for the datasets not used by default
Expand Down Expand Up @@ -1697,7 +1722,10 @@ Resources:
LayerName: !Sub 'CidLambdaLayer${Suffix}'
Description: An AWS managed layer with a cid-cmd package installed
Content:
S3Bucket: !Sub '${LambdaLayerBucketPrefix}-${AWS::Region}'
S3Bucket: !If
- LambdaLayerBucketPrefixIsManaged
- !FindInMap [RegionMap, !Ref 'AWS::Region', BucketName]
- !Sub '${LambdaLayerBucketPrefix}-${AWS::Region}' # Region added for backward compatibility
S3Key: 'cid-resource-lambda-layer/cid-4.0.0.zip' #replace version here if needed
CompatibleRuntimes:
- python3.10
Expand Down

0 comments on commit 7ab19dc

Please sign in to comment.