translation/v1/template.yaml [19:93]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Globals:
  Function:
    Timeout: 15

Resources:
  ## S3 buckets
  BatchingBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: !Ref BatchingBucketName
  TranslationBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: !Ref TranslationBucketName

  ## Lambda functions
  TranslatorFunction:
    Type: AWS::Serverless::Function 
    Properties:
      CodeUri: translatorFunction/
      Handler: app.handler
      Runtime: nodejs12.x
      MemorySize: 128
      Environment:
        Variables:
          targetLanguage: !Ref TargetLanguage
      Policies:
        - S3CrudPolicy:
            BucketName: !Ref TranslationBucketName
        - Statement:
          - Effect: Allow
            Resource: '*'
            Action:
              - translate:*
              - comprehend:DetectDominantLanguage
              - cloudwatch:GetMetricStatistics
              - cloudwatch:ListMetrics
      Events:
        FileUpload:
          Type: S3
          Properties:
            Bucket: !Ref TranslationBucket
            Events: s3:ObjectCreated:*
            Filter: 
              S3Key:
                Rules:
                  - Name: suffix
                    Value: '.txt'            

  BatchingFunction:
    Type: AWS::Serverless::Function 
    Properties:
      CodeUri: batchingFunction/
      Handler: app.handler
      Runtime: nodejs12.x
      MemorySize: 512
      Environment:
        Variables:
          OutputBucket: !Ref TranslationBucketName
      Policies:
        - S3CrudPolicy:
            BucketName: !Ref TranslationBucketName
        - S3ReadPolicy:
            BucketName: !Ref BatchingBucketName
      Events:
        OriginalTextUpload:
          Type: S3
          Properties:
            Bucket: !Ref BatchingBucket
            Events: s3:ObjectCreated:*
            Filter: 
              S3Key:
                Rules:
                  - Name: suffix
                    Value: '.txt'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



videos-samples/1-translation/template-v2.yaml [17:91]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Globals:
  Function:
    Timeout: 15

Resources:
  ## S3 buckets
  BatchingBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: !Ref BatchingBucketName
  TranslationBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: !Ref TranslationBucketName

  ## Lambda functions
  TranslatorFunction:
    Type: AWS::Serverless::Function 
    Properties:
      CodeUri: translatorFunction/
      Handler: app.handler
      Runtime: nodejs12.x
      MemorySize: 128
      Environment:
        Variables:
          targetLanguage: !Ref TargetLanguage
      Policies:
        - S3CrudPolicy:
            BucketName: !Ref TranslationBucketName
        - Statement:
          - Effect: Allow
            Resource: '*'
            Action:
              - translate:*
              - comprehend:DetectDominantLanguage
              - cloudwatch:GetMetricStatistics
              - cloudwatch:ListMetrics
      Events:
        FileUpload:
          Type: S3
          Properties:
            Bucket: !Ref TranslationBucket
            Events: s3:ObjectCreated:*
            Filter: 
              S3Key:
                Rules:
                  - Name: suffix
                    Value: '.txt'            

  BatchingFunction:
    Type: AWS::Serverless::Function 
    Properties:
      CodeUri: batchingFunction/
      Handler: app.handler
      Runtime: nodejs12.x
      MemorySize: 512
      Environment:
        Variables:
          OutputBucket: !Ref TranslationBucketName
      Policies:
        - S3CrudPolicy:
            BucketName: !Ref TranslationBucketName
        - S3ReadPolicy:
            BucketName: !Ref BatchingBucketName
      Events:
        OriginalTextUpload:
          Type: S3
          Properties:
            Bucket: !Ref BatchingBucket
            Events: s3:ObjectCreated:*
            Filter: 
              S3Key:
                Rules:
                  - Name: suffix
                    Value: '.txt'     
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



