Skip to content

Instantly share code, notes, and snippets.

@em-shea
Last active May 3, 2023 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save em-shea/5dcda9622a676e01e5aecfda3087a954 to your computer and use it in GitHub Desktop.
Save em-shea/5dcda9622a676e01e5aecfda3087a954 to your computer and use it in GitHub Desktop.
SAM definition for audio generation workflow
GenerateAudioStateMachine:
Type: AWS::Serverless::StateMachine
Properties:
Name: !Sub GenerateAudioStateMachine-${Stage}
DefinitionUri: src/generate_audio_state_machine.asl.json
DefinitionSubstitutions:
TableName: !Ref DynamoDBTable
GetWordsForListIdFunction: !Ref GetWordsForListId
PronunciationAudioBucket: !Ref PronunciationAudioBucket
Policies:
# SAM policy templates to simplify common IAM permissions
- S3WritePolicy:
BucketName: !Ref PronunciationAudioBucket
- DynamoDBCrudPolicy:
TableName: !Ref DynamoDBTable
- LambdaInvokePolicy:
FunctionName: !Ref GetWordsForListId
# Custom policy for Polly
- Statement:
- Sid: PollySynthesizeText
Effect: Allow
Action:
- polly:StartSpeechSynthesisTask
Resource: '*'
# SAM definitions for Lambda function, DynamoDB table, and S3 bucket not included
# See full template at: https://github.com/em-shea/vocab/blob/master/template.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment