Created
May 10, 2019 21:28
-
-
Save deeheber/ed43509aa8f566b0c4f7239858659dc0 to your computer and use it in GitHub Desktop.
Text to speech final template.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: 2010-09-09 | |
Transform: AWS::Serverless-2016-10-31 | |
Resources: | |
Api: | |
Type: AWS::Serverless::Api | |
Properties: | |
Name: !Sub | |
- ${ResourceName} From Stack ${StackTagName} Environment ${EnvironmentTagName} | |
- ResourceName: Api | |
StageName: !Ref EnvironmentAPIGatewayStageName | |
DefinitionBody: | |
swagger: '2.0' | |
info: {} | |
paths: | |
/file: | |
get: | |
x-amazon-apigateway-integration: | |
httpMethod: POST | |
type: aws_proxy | |
uri: !Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetFile.Arn}/invocations | |
responses: {} | |
post: | |
x-amazon-apigateway-integration: | |
httpMethod: POST | |
type: aws_proxy | |
uri: !Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${CreateNewFile.Arn}/invocations | |
responses: {} | |
EndpointConfiguration: REGIONAL | |
TracingEnabled: true | |
Table: | |
Type: AWS::DynamoDB::Table | |
Properties: | |
AttributeDefinitions: | |
- AttributeName: id | |
AttributeType: S | |
BillingMode: PAY_PER_REQUEST | |
KeySchema: | |
- AttributeName: id | |
KeyType: HASH | |
StreamSpecification: | |
StreamViewType: NEW_AND_OLD_IMAGES | |
TableName: !Sub ${AWS::StackName}-Table | |
GetFile: | |
Type: AWS::Serverless::Function | |
Properties: | |
FunctionName: !Sub ${AWS::StackName}-GetFile | |
Description: !Sub | |
- Stack ${StackTagName} Environment ${EnvironmentTagName} Function ${ResourceName} | |
- ResourceName: GetFile | |
CodeUri: src/GetFile | |
Handler: index.handler | |
Runtime: nodejs8.10 | |
MemorySize: 3008 | |
Timeout: 30 | |
Tracing: Active | |
Policies: | |
- AWSXrayWriteOnlyAccess | |
- Version: 2012-10-17 | |
Statement: | |
- Effect: Allow | |
Resource: !GetAtt Table.Arn | |
Action: | |
- dynamodb:GetItem | |
- dynamodb:Scan | |
Events: | |
ApiGETfile: | |
Type: Api | |
Properties: | |
Path: /file | |
Method: GET | |
RestApiId: !Ref Api | |
Environment: | |
Variables: | |
TABLE_NAME: !Ref Table | |
TABLE_ARN: !GetAtt Table.Arn | |
FrontEnd: | |
Type: AWS::S3::Bucket | |
Properties: | |
BucketName: !Sub ${AWS::StackName}-frontend | |
WebsiteConfiguration: | |
IndexDocument: index.html | |
FileStore: | |
Type: AWS::S3::Bucket | |
Properties: | |
BucketName: !Sub ${AWS::StackName}-filestore | |
ConvertToAudio: | |
Type: AWS::Serverless::Function | |
Properties: | |
FunctionName: !Sub ${AWS::StackName}-ConvertToAudio | |
Description: !Sub | |
- Stack ${StackTagName} Environment ${EnvironmentTagName} Function ${ResourceName} | |
- ResourceName: ConvertToAudio | |
CodeUri: src/ConvertToAudio | |
Handler: index.handler | |
Runtime: nodejs8.10 | |
MemorySize: 3008 | |
Timeout: 300 | |
Tracing: Active | |
Policies: | |
- AWSXrayWriteOnlyAccess | |
- Version: 2012-10-17 | |
Statement: | |
- Effect: Allow | |
Resource: !Join [ '', [ !GetAtt FileStore.Arn, /* ] ] | |
Action: | |
- s3:PutObject | |
- s3:PutObjectAcl | |
- Version: 2012-10-17 | |
Statement: | |
- Effect: Allow | |
Resource: !GetAtt Table.Arn | |
Action: | |
- dynamodb:UpdateItem | |
- Version: 2012-10-17 | |
Statement: | |
- Effect: Allow | |
Resource: '*' | |
Action: | |
- polly:SynthesizeSpeech | |
Environment: | |
Variables: | |
BUCKET_NAME: !Ref FileStore | |
BUCKET_ARN: !GetAtt FileStore.Arn | |
TABLE_NAME: !Ref Table | |
TABLE_ARN: !GetAtt Table.Arn | |
CreateNewFile: | |
Type: AWS::Serverless::Function | |
Properties: | |
FunctionName: !Sub ${AWS::StackName}-CreateNewFile | |
Description: !Sub | |
- Stack ${StackTagName} Environment ${EnvironmentTagName} Function ${ResourceName} | |
- ResourceName: CreateNewFile | |
CodeUri: src/CreateNewFile | |
Handler: index.handler | |
Runtime: nodejs8.10 | |
MemorySize: 3008 | |
Timeout: 300 | |
Tracing: Active | |
Policies: | |
- AWSXrayWriteOnlyAccess | |
- Version: 2012-10-17 | |
Statement: | |
- Effect: Allow | |
Resource: !GetAtt Table.Arn | |
Action: | |
- dynamodb:PutItem | |
- LambdaInvokePolicy: | |
FunctionName: !Ref ConvertToAudio | |
Events: | |
ApiPOSTfile: | |
Type: Api | |
Properties: | |
Path: /file | |
Method: POST | |
RestApiId: !Ref Api | |
Environment: | |
Variables: | |
TABLE_NAME: !Ref Table | |
TABLE_ARN: !GetAtt Table.Arn | |
FUNCTION_NAME: !Ref ConvertToAudio | |
FUNCTION_ARN: !GetAtt ConvertToAudio.Arn | |
Parameters: | |
StackTagName: | |
Type: String | |
Description: Stack Name (injected by Stackery at deployment time) | |
EnvironmentTagName: | |
Type: String | |
Description: Environment Name (injected by Stackery at deployment time) | |
EnvironmentAPIGatewayStageName: | |
Type: String | |
Description: Environment name used for API Gateway Stage names (injected by Stackery at deployment time) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment