Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Enhanced SSM Parameter Resolution and Resource Naming
  • Loading branch information
Ola Ola committed Feb 17, 2025
commit a840c4c5701c23db018fe3ba521cdb2a2e511178
Binary file added .DS_Store
Binary file not shown.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/amazon-transcribe-post-call-analytics.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/aws.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/cfnlintPlugin.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions pca-main-nokendra.template
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ Parameters:

DatabaseName:
Type: String
Default: 'pca'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than force user to enter a unique database name, can we instead allow an empty default and use a condition in the template to replace an empty DatabaseName with a unique name constructed from the StackName?

Description: Glue catalog database name used to contain tables/views for SQL integration.
AllowedPattern: "[a-zA-Z0-9_-]+"
Description: (Required) Glue catalog database name used to contain tables/views for SQL integration.

EnablePcaDashboards:
Type: String
Expand Down Expand Up @@ -848,6 +848,7 @@ Resources:
Properties:
TemplateURL: pca-ssm/cfn/ssm.template
Parameters:
StackName: !Ref 'AWS::StackName'
BulkUploadBucketName:
!If
- ShouldCreateBulkUploadBucket
Expand Down Expand Up @@ -918,6 +919,8 @@ Resources:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: pca-server/cfn/lib/python-utilities.template
Parameters:
ParentStackName: !Ref 'AWS::StackName'

BedrockBoto3Layer:
Type: AWS::CloudFormation::Stack
Expand All @@ -944,6 +947,8 @@ Resources:
Properties:
TemplateURL: pca-server/cfn/pca-server.template
Parameters:
DatabaseName: !Ref DatabaseName
ParentStackName: !Ref 'AWS::StackName'
ffmpegDownloadUrl: !Ref ffmpegDownloadUrl
CallSummarization: !Ref CallSummarization
SummarizationBedrockModelId: !Ref SummarizationBedrockModelId
Expand All @@ -966,6 +971,7 @@ Resources:
Properties:
TemplateURL: pca-ui/cfn/pca-ui.template
Parameters:
ParentStackName: !Ref 'AWS::StackName'
AdminUsername: !Ref AdminUsername
AdminEmail: !Ref AdminEmail
AllowedSignUpEmailDomain: !Ref AllowedSignUpEmailDomain
Expand Down
10 changes: 8 additions & 2 deletions pca-main.template
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,8 @@ Parameters:

DatabaseName:
Type: String
Default: 'pca'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than force user to enter a unique database name, can we instead allow an empty default and use a condition in the template to replace an empty DatabaseName with a unique name constructed from the StackName?

Description: Glue catalog database name used to contain tables/views for SQL integration.
AllowedPattern: "[a-zA-Z0-9_-]+"
Description: (Required) Glue catalog database name used to contain tables/views for SQL integration.

EnablePcaDashboards:
Type: String
Expand Down Expand Up @@ -1031,6 +1031,7 @@ Resources:
Properties:
TemplateURL: pca-ssm/cfn/ssm.template
Parameters:
StackName: !Ref 'AWS::StackName'
BulkUploadBucketName:
!If
- ShouldCreateBulkUploadBucket
Expand Down Expand Up @@ -1102,6 +1103,8 @@ Resources:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: pca-server/cfn/lib/python-utilities.template
Parameters:
ParentStackName: !Ref 'AWS::StackName'

BedrockBoto3Layer:
Type: AWS::CloudFormation::Stack
Expand All @@ -1128,6 +1131,8 @@ Resources:
Properties:
TemplateURL: pca-server/cfn/pca-server.template
Parameters:
DatabaseName: !Ref DatabaseName
ParentStackName: !Ref 'AWS::StackName'
ffmpegDownloadUrl: !Ref ffmpegDownloadUrl
CallSummarization: !Ref CallSummarization
SummarizationBedrockModelId: !Ref SummarizationBedrockModelId
Expand All @@ -1150,6 +1155,7 @@ Resources:
Properties:
TemplateURL: pca-ui/cfn/pca-ui.template
Parameters:
ParentStackName: !Ref 'AWS::StackName'
AdminUsername: !Ref AdminUsername
AdminEmail: !Ref AdminEmail
AllowedSignUpEmailDomain: !Ref AllowedSignUpEmailDomain
Expand Down
15 changes: 9 additions & 6 deletions pca-server/cfn/lib/boto3.template
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ Description: Amazon Transcribe Post Call Analytics - PCA Server - Boto3 Layer Zi
Transform: AWS::Serverless-2016-10-31

Parameters:
ParentStackName:
Type: String
Description: Name of the parent stack

SupportFilesBucketName:
Type: AWS::SSM::Parameter::Value<String>
Default: SupportFilesBucketName
# SupportFilesBucketName:
# Type: AWS::SSM::Parameter::Value<String>
# Default: SupportFilesBucketName

Boto3ZipName:
Type: String
Expand Down Expand Up @@ -36,7 +39,7 @@ Resources:
Resource:
!Sub
- 'arn:aws:s3:::${bucket}*'
- bucket: !Ref SupportFilesBucketName
- bucket: !Sub '{{resolve:ssm:${ParentStackName}-SupportFilesBucketName}}'
Action:
- 's3:PutObject'
PolicyName: boto3ZipFunctionS3Policy
Expand All @@ -51,7 +54,7 @@ Resources:
MemorySize: 512
Environment:
Variables:
SUPPORT_FILES_BUCKET: !Ref SupportFilesBucketName
SUPPORT_FILES_BUCKET: !Sub '{{resolve:ssm:${ParentStackName}-SupportFilesBucketName}}'
BOTO3_ZIP_NAME: !Ref Boto3ZipName
Code:
ZipFile: |
Expand Down Expand Up @@ -124,7 +127,7 @@ Resources:
DependsOn: boto3Zip
Properties:
Content:
S3Bucket: !Ref SupportFilesBucketName
S3Bucket: !Sub '{{resolve:ssm:${ParentStackName}-SupportFilesBucketName}}'
S3Key: !Ref Boto3ZipName

Outputs:
Expand Down
68 changes: 49 additions & 19 deletions pca-server/cfn/lib/bulk.template
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,21 @@ Description: Amazon Transcribe Post Call Analytics - PCA Server - BulkImport Sta
Transform: AWS::Serverless-2016-10-31

Parameters:
BulkUploadStepFunctionName:
Type: AWS::SSM::Parameter::Value<String>
Default: BulkUploadStepFunctionName
ParentStackName:
Type: String
Description: Name of the parent stack

BulkUploadBucketName:
Type: AWS::SSM::Parameter::Value<String>
Default: BulkUploadBucket

InputBucketName:
Type: AWS::SSM::Parameter::Value<String>
Default: InputBucketName
# BulkUploadStepFunctionName:
# Type: AWS::SSM::Parameter::Value<String>
# Default: BulkUploadStepFunctionName

# BulkUploadBucketName:
# Type: AWS::SSM::Parameter::Value<String>
# Default: BulkUploadBucket

# InputBucketName:
# Type: AWS::SSM::Parameter::Value<String>
# Default: InputBucketName

Globals:
Function:
Expand All @@ -37,8 +41,17 @@ Resources:
- s3:ListBucket
- s3:GetObject
Resource:
- !Sub arn:aws:s3:::${BulkUploadBucketName}
- !Sub arn:aws:s3:::${BulkUploadBucketName}/*
- !Join
- ''
- - 'arn:aws:s3:::'
- !Sub '{{resolve:ssm:${ParentStackName}-BulkUploadBucket}}'
- !Join
- ''
- - 'arn:aws:s3:::'
- !Sub '{{resolve:ssm:${ParentStackName}-BulkUploadBucket}}'
- '/*'
#- !Sub arn:aws:s3:::${BulkUploadBucketName}
#- !Sub arn:aws:s3:::${BulkUploadBucketName}/*
- Statement:
- Sid: SSMGetParameterPolicy
Effect: Allow
Expand All @@ -62,10 +75,24 @@ Resources:
- s3:PutObject
- s3:DeleteObject
Resource:
- !Sub arn:aws:s3:::${BulkUploadBucketName}
- !Sub arn:aws:s3:::${BulkUploadBucketName}/*
- !Sub arn:aws:s3:::${InputBucketName}
- !Sub arn:aws:s3:::${InputBucketName}/*
- !Join
- ''
- - 'arn:aws:s3:::'
- !Sub '{{resolve:ssm:${ParentStackName}-BulkUploadBucket}}'
- !Join
- ''
- - 'arn:aws:s3:::'
- !Sub '{{resolve:ssm:${ParentStackName}-BulkUploadBucket}}'
- '/*'
- !Join
- ''
- - 'arn:aws:s3:::'
- !Sub '{{resolve:ssm:${ParentStackName}-InputBucketName}}'
- !Join
- ''
- - 'arn:aws:s3:::'
- !Sub '{{resolve:ssm:${ParentStackName}-InputBucketName}}'
- '/*'

BulkQueueSpace:
Type: "AWS::Serverless::Function"
Expand All @@ -78,8 +105,11 @@ Resources:

LogGroup:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName: !Sub '/aws/vendedlogs/${BulkUploadStepFunctionName}'
Properties:
LogGroupName: !Join
- ''
- - '/aws/vendedlogs/'
- !Sub "{{resolve:ssm:${ParentStackName}-BulkUploadStepFunctionName}}"
RetentionInDays: 90

Role:
Expand Down Expand Up @@ -119,7 +149,7 @@ Resources:
StateMachine:
Type: "AWS::StepFunctions::StateMachine"
Properties:
StateMachineName: !Ref BulkUploadStepFunctionName
StateMachineName: !Sub "{{resolve:ssm:${ParentStackName}-BulkUploadStepFunctionName}}"
DefinitionS3Location: ./bulk-definition.json
DefinitionSubstitutions:
BulkFilesCountArn: !GetAtt BulkFilesCount.Arn
Expand Down
13 changes: 8 additions & 5 deletions pca-server/cfn/lib/ffmpeg.template
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ Description: Amazon Transcribe Post Call Analytics - PCA Server - FFMPEG Downloa
Transform: AWS::Serverless-2016-10-31

Parameters:
ParentStackName:
Type: String
Description: Name of the parent stack

SupportFilesBucketName:
Type: AWS::SSM::Parameter::Value<String>
Default: SupportFilesBucketName
# SupportFilesBucketName:
# Type: AWS::SSM::Parameter::Value<String>
# Default: SupportFilesBucketName

FFMPEGZipName:
Type: String
Expand Down Expand Up @@ -42,7 +45,7 @@ Resources:
Resource:
!Sub
- 'arn:aws:s3:::${bucket}*'
- bucket: !Ref SupportFilesBucketName
- bucket: !Sub '{{resolve:ssm:${ParentStackName}-SupportFilesBucketName}}'
Action:
- 's3:PutObject'
PolicyName: ffmpegZipFunctionS3Policy
Expand All @@ -58,7 +61,7 @@ Resources:
Environment:
Variables:
FFMPEG_DOWNLOAD_URL: !Ref ffmpegDownloadUrl
SUPPORT_FILES_BUCKET: !Ref SupportFilesBucketName
SUPPORT_FILES_BUCKET: !Sub '{{resolve:ssm:${ParentStackName}-SupportFilesBucketName}}'
FFMPEG_ZIP_NAME: !Ref FFMPEGZipName
Code:
ZipFile: |
Expand Down
Loading