|
| 1 | +{ |
| 2 | + "AWSTemplateFormatVersion": "2010-09-09", |
| 3 | + "Description": "IAM User account and credentials for accessing AWS Transcribe", |
| 4 | + "Outputs": { |
| 5 | + "TranscribeUserAccessKeyId": { |
| 6 | + "Description": "Access Key ID for the user", |
| 7 | + "Value": { |
| 8 | + "Ref": "TranscribeUserAccessKey" |
| 9 | + }, |
| 10 | + "Export" : { |
| 11 | + "Name" : {"Fn::Sub": "${ApplicationName}-transcribe-user-access-key-id" } |
| 12 | + } |
| 13 | + } |
| 14 | + }, |
| 15 | + "Parameters": { |
| 16 | + "ApplicationName": { |
| 17 | + "Description": "Name of the application (snake-case, will be prepended to make internal reference names)", |
| 18 | + "Type": "String", |
| 19 | + "Default": "app" |
| 20 | + }, |
| 21 | + "BucketName": { |
| 22 | + "Description": "Name of the S3 bucket where audio files and resulting transcriptions will be stored", |
| 23 | + "Type": "String" |
| 24 | + } |
| 25 | + }, |
| 26 | + "Resources": { |
| 27 | + "TranscribeUser": { |
| 28 | + "Type": "AWS::IAM::User", |
| 29 | + "Properties": { |
| 30 | + "Policies": [ |
| 31 | + { |
| 32 | + "PolicyName": { |
| 33 | + "Fn::Sub": "${ApplicationName}-transcribe-policy" |
| 34 | + }, |
| 35 | + "PolicyDocument": { |
| 36 | + "Version": "2012-10-17", |
| 37 | + "Statement": [ |
| 38 | + { |
| 39 | + "Sid": "VisualEditor0", |
| 40 | + "Effect": "Allow", |
| 41 | + "Action": ["s3:PutObject", "s3:GetObject", "s3:ListBucket", "s3:DeleteObject"], |
| 42 | + "Resource": [ |
| 43 | + { "Fn::Sub": "arn:aws:s3:::${BucketName}/*" }, |
| 44 | + { "Fn::Sub": "arn:aws:s3:::${BucketName}" } |
| 45 | + ] |
| 46 | + }, |
| 47 | + { |
| 48 | + "Sid": "VisualEditor1", |
| 49 | + "Effect": "Allow", |
| 50 | + "Action": ["transcribe:GetTranscriptionJob", "transcribe:StartTranscriptionJob"], |
| 51 | + "Resource": "*" |
| 52 | + } |
| 53 | + ] |
| 54 | + } |
| 55 | + } |
| 56 | + ], |
| 57 | + "UserName": { |
| 58 | + "Fn::Sub": "${ApplicationName}-transcribe-user" |
| 59 | + } |
| 60 | + } |
| 61 | + }, |
| 62 | + "TranscribeUserAccessKey": { |
| 63 | + "Type": "AWS::IAM::AccessKey", |
| 64 | + "Properties": { |
| 65 | + "Status": "Active", |
| 66 | + "UserName": { |
| 67 | + "Ref": "TranscribeUser" |
| 68 | + } |
| 69 | + } |
| 70 | + }, |
| 71 | + "TranscribeUserSecretAccessKeyParameter": { |
| 72 | + "Type" : "Custom::SSMSecureStringParam", |
| 73 | + "Properties" : { |
| 74 | + "Name" : { |
| 75 | + "Fn::Sub": "/iam/user/${ApplicationName}-transcribe-user/secret-access-key" |
| 76 | + }, |
| 77 | + "ServiceToken": { |
| 78 | + "Fn::ImportValue": "ssm-securestring-cfn-macro-function-arn" |
| 79 | + }, |
| 80 | + "Type": "SecureString", |
| 81 | + "Value" : { |
| 82 | + "Fn::GetAtt": ["TranscribeUserAccessKey", "SecretAccessKey"] |
| 83 | + } |
| 84 | + } |
| 85 | + } |
| 86 | + } |
| 87 | +} |
0 commit comments