sdlf-stageA/template.yaml [102:441]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Globals:
  Function:
    Runtime: python3.7
    Handler: lambda_function.lambda_handler
    Layers:
      - !Ref pDatalakeLibLayer
    KmsKeyArn: !Ref pKMSInfraKeyId

Resources:
  ######## SQS #########
  rQueueRoutingStep:
    Type: AWS::SQS::Queue
    Properties:
      QueueName: !Sub sdlf-${pTeamName}-${pPipeline}-queue-a.fifo
      FifoQueue: True
      RedrivePolicy:
        deadLetterTargetArn: !GetAtt rDeadLetterQueueRoutingStep.Arn
        maxReceiveCount: 1
      VisibilityTimeout: 60
      KmsMasterKeyId: !Ref pKMSInfraKeyId

  rDeadLetterQueueRoutingStep:
    Type: AWS::SQS::Queue
    Properties:
      QueueName: !Sub sdlf-${pTeamName}-${pPipeline}-dlq-a.fifo
      FifoQueue: True
      MessageRetentionPeriod: 1209600
      VisibilityTimeout: 60
      KmsMasterKeyId: !Ref pKMSInfraKeyId

  rQueueLambdaEventSourceMapping:
    Type: AWS::Lambda::EventSourceMapping
    Properties:
      BatchSize: 10
      Enabled: True
      EventSourceArn: !GetAtt rQueueRoutingStep.Arn
      FunctionName: !GetAtt rLambdaRoutingStep.Arn

  ######## IAM #########
  rLambdaCommonPolicy:
    Type: AWS::IAM::ManagedPolicy
    Properties:
      ManagedPolicyName: !Sub sdlf-${pTeamName}-${pPipeline}-common-a
      PolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Action:
              - logs:CreateLogGroup
            Resource: !Sub arn:aws:logs:${AWS::Region}:${AWS::AccountId}:*
          - Effect: Allow
            Action:
              - logs:CreateLogStream
              - logs:PutLogEvents
            Resource: !Sub arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/sdlf-${pTeamName}-*
          - Effect: Allow
            Action:
              - ssm:GetParameter
              - ssm:GetParameters
            Resource: !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/SDLF/*
          - Effect: Allow
            Action:
              - dynamodb:BatchGetItem
              - dynamodb:BatchWriteItem
              - dynamodb:DeleteItem
              - dynamodb:DescribeTable
              - dynamodb:GetItem
              - dynamodb:GetRecords
              - dynamodb:PutItem
              - dynamodb:Query
              - dynamodb:Scan
              - dynamodb:UpdateItem
            Resource:
              - !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/octagon-*
          - Effect: Allow
            Action:
              - kms:CreateGrant
              - kms:Decrypt
              - kms:DescribeKey
              - kms:Encrypt
              - kms:GenerateDataKey*
              - kms:ReEncrypt*
            Resource:
              - !Ref pKMSInfraKeyId

  # Routing Role
  rRoleLambdaExecutionRoutingStep:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !Sub sdlf-${pTeamName}-${pPipeline}-routing-a
      PermissionsBoundary: !Ref pPermissionsBoundaryManagedPolicy
      ManagedPolicyArns:
        - !Ref rLambdaCommonPolicy
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service: lambda.amazonaws.com
            Action: sts:AssumeRole
      Path: /state-machine/
      Policies:
        - PolicyName: !Sub sdlf-${pTeamName}-${pPipeline}-routing-a
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Effect: Allow
                Action:
                  - states:StartExecution
                Resource:
                  - !Ref rStateMachine
              - Effect: Allow
                Action:
                  - sqs:DeleteMessage
                  - sqs:DeleteMessageBatch
                  - sqs:GetQueueAttributes
                  - sqs:GetQueueUrl
                  - sqs:ListQueues
                  - sqs:ListDeadLetterSourceQueues
                  - sqs:ListQueueTags
                  - sqs:ReceiveMessage
                  - sqs:SendMessage
                  - sqs:SendMessageBatch
                Resource:
                  - !GetAtt rQueueRoutingStep.Arn
                  - !GetAtt rDeadLetterQueueRoutingStep.Arn

  # Step1 Role
  rRoleLambdaExecutionStep1:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !Sub sdlf-${pTeamName}-${pPipeline}-preupdate-a
      PermissionsBoundary: !Ref pPermissionsBoundaryManagedPolicy
      ManagedPolicyArns:
        - !Ref rLambdaCommonPolicy
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service: lambda.amazonaws.com
            Action: sts:AssumeRole
      Path: /state-machine/
      Policies:
        - PolicyName: !Sub sdlf-${pTeamName}-${pPipeline}-preupdate-a
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Effect: Allow
                Action:
                  - s3:ListBucket
                Resource:
                  - !Sub arn:aws:s3:::${pStageBucket}
              - Effect: Allow
                Action:
                  - s3:GetObject
                Resource:
                  - !Sub arn:aws:s3:::${pStageBucket}/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/stage/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/pre-stage/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/post-stage/${pTeamName}/*

  # Step2 Role
  rRoleLambdaExecutionStep2:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !Sub sdlf-${pTeamName}-${pPipeline}-process-a
      PermissionsBoundary: !Ref pPermissionsBoundaryManagedPolicy
      ManagedPolicyArns:
        - !Ref rLambdaCommonPolicy
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service: lambda.amazonaws.com
            Action: sts:AssumeRole
      Path: /state-machine/
      Policies:
        - PolicyName: !Sub sdlf-${pTeamName}-${pPipeline}-process-a
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Effect: Allow
                Action:
                  - s3:GetBucketVersioning
                  - s3:ListBucket
                Resource:
                  - !Sub arn:aws:s3:::${pDatasetBucket}
                  - !Sub arn:aws:s3:::${pStageBucket}
                  - !Sub arn:aws:s3:::${pArtifactsBucket}
              - Effect: Allow
                Action:
                  - s3:GetObject
                  - s3:PutObject
                Resource:
                  - !Sub arn:aws:s3:::${pDatasetBucket}/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pDatasetBucket}/raw/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/stage/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/pre-stage/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/post-stage/${pTeamName}/*
              - Effect: Allow
                Action:
                  - kms:DescribeKey
                  - kms:Encrypt
                  - kms:Decrypt
                  - kms:ReEncrypt*
                  - kms:GenerateDataKey*
                  - kms:CreateGrant
                Resource:
                  - !Ref pKMSDataKeyId

  # Step3 Role
  rRoleLambdaExecutionStep3:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !Sub sdlf-${pTeamName}-${pPipeline}-postupdate-a
      PermissionsBoundary: !Ref pPermissionsBoundaryManagedPolicy
      ManagedPolicyArns:
        - !Ref rLambdaCommonPolicy
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service: lambda.amazonaws.com
            Action: sts:AssumeRole
      Path: /state-machine/
      Policies:
        - PolicyName: !Sub sdlf-${pTeamName}-${pPipeline}-postupdate-a
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Effect: Allow
                Action:
                  - sqs:GetQueueAttributes
                  - sqs:GetQueueUrl
                  - sqs:ListQueues
                  - sqs:ListDeadLetterSourceQueues
                  - sqs:ListQueueTags
                  - sqs:SendMessage
                  - sqs:SendMessageBatch
                Resource:
                  - !Sub arn:aws:sqs:${AWS::Region}:${AWS::AccountId}:sdlf-${pTeamName}-*
              - Effect: Allow
                Action:
                  - s3:ListBucket
                Resource:
                  - !Sub arn:aws:s3:::${pStageBucket}
              - Effect: Allow
                Action:
                  - s3:GetObject
                Resource:
                  - !Sub arn:aws:s3:::${pStageBucket}/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/stage/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/pre-stage/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/post-stage/${pTeamName}/*

  # Error Handling Lambda Role
  rRoleLambdaExecutionErrorStep:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !Sub sdlf-${pTeamName}-${pPipeline}-error-a
      PermissionsBoundary: !Ref pPermissionsBoundaryManagedPolicy
      ManagedPolicyArns:
        - !Ref rLambdaCommonPolicy
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service: lambda.amazonaws.com
            Action: sts:AssumeRole
      Path: /state-machine/
      Policies:
        - PolicyName: !Sub sdlf-${pTeamName}-${pPipeline}-error-a
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Effect: Allow
                Action:
                  - sqs:DeleteMessage
                  - sqs:DeleteMessageBatch
                  - sqs:GetQueueAttributes
                  - sqs:GetQueueUrl
                  - sqs:ListQueues
                  - sqs:ListDeadLetterSourceQueues
                  - sqs:ListQueueTags
                  - sqs:ReceiveMessage
                  - sqs:SendMessage
                  - sqs:SendMessageBatch
                Resource:
                  - !GetAtt rDeadLetterQueueRoutingStep.Arn

  ######## LAMBDA FUNCTIONS #########
  rLambdaRoutingStep:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: ./lambda/stage-a-routing/src
      FunctionName: !Sub sdlf-${pTeamName}-${pPipeline}-routing-a
      Description: Routes S3 PutObject Logs to the relevant StageA State Machine
      MemorySize: 256
      Timeout: 60
      Role: !GetAtt rRoleLambdaExecutionRoutingStep.Arn

  rLambdaRedriveStep:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: ./lambda/stage-a-redrive/src
      FunctionName: !Sub sdlf-${pTeamName}-${pPipeline}-redrive-a
      Environment:
        Variables:
          TEAM: !Ref pTeamName
          PIPELINE: !Ref pPipeline
          STAGE: StageA
      Description: Redrives Failed S3 PutObject Logs to the routing queue
      MemorySize: 256
      Timeout: 300
      Role: !GetAtt rRoleLambdaExecutionRoutingStep.Arn

  rLambdaStep1:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: ./lambda/stage-a-preupdate-metadata/src
      FunctionName: !Sub sdlf-${pTeamName}-${pPipeline}-preupdate-a
      Description: Pre-Update the metadata in the DynamoDB Catalog table
      MemorySize: 128
      Timeout: 300
      Role: !GetAtt rRoleLambdaExecutionStep1.Arn

  rLambdaStep2:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: ./lambda/stage-a-process-object/src
      FunctionName: !Sub sdlf-${pTeamName}-${pPipeline}-process-a
      Description: Processing pipeline
      MemorySize: 1536
      Timeout: 600
      Role: !GetAtt rRoleLambdaExecutionStep2.Arn
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



sdlf-utils/pipeline-examples/topic-modelling/stageA/template.yaml [101:440]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Globals:
  Function:
    Runtime: python3.7
    Handler: lambda_function.lambda_handler
    Layers:
      - !Ref pDatalakeLibLayer
    KmsKeyArn: !Ref pKMSInfraKeyId

Resources:
  ######## SQS #########
  rQueueRoutingStep:
    Type: AWS::SQS::Queue
    Properties:
      QueueName: !Sub sdlf-${pTeamName}-${pPipeline}-queue-a.fifo
      FifoQueue: True
      RedrivePolicy:
        deadLetterTargetArn: !GetAtt rDeadLetterQueueRoutingStep.Arn
        maxReceiveCount: 1
      VisibilityTimeout: 60
      KmsMasterKeyId: !Ref pKMSInfraKeyId

  rDeadLetterQueueRoutingStep:
    Type: AWS::SQS::Queue
    Properties:
      QueueName: !Sub sdlf-${pTeamName}-${pPipeline}-dlq-a.fifo
      FifoQueue: True
      MessageRetentionPeriod: 1209600
      VisibilityTimeout: 60
      KmsMasterKeyId: !Ref pKMSInfraKeyId

  rQueueLambdaEventSourceMapping:
    Type: AWS::Lambda::EventSourceMapping
    Properties:
      BatchSize: 10
      Enabled: True
      EventSourceArn: !GetAtt rQueueRoutingStep.Arn
      FunctionName: !GetAtt rLambdaRoutingStep.Arn

  ######## IAM #########
  rLambdaCommonPolicy:
    Type: AWS::IAM::ManagedPolicy
    Properties:
      ManagedPolicyName: !Sub sdlf-${pTeamName}-${pPipeline}-common-a
      PolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Action:
              - logs:CreateLogGroup
            Resource: !Sub arn:aws:logs:${AWS::Region}:${AWS::AccountId}:*
          - Effect: Allow
            Action:
              - logs:CreateLogStream
              - logs:PutLogEvents
            Resource: !Sub arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/sdlf-${pTeamName}-*
          - Effect: Allow
            Action:
              - ssm:GetParameter
              - ssm:GetParameters
            Resource: !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/SDLF/*
          - Effect: Allow
            Action:
              - dynamodb:BatchGetItem
              - dynamodb:BatchWriteItem
              - dynamodb:DeleteItem
              - dynamodb:DescribeTable
              - dynamodb:GetItem
              - dynamodb:GetRecords
              - dynamodb:PutItem
              - dynamodb:Query
              - dynamodb:Scan
              - dynamodb:UpdateItem
            Resource:
              - !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/octagon-*
          - Effect: Allow
            Action:
              - kms:CreateGrant
              - kms:Decrypt
              - kms:DescribeKey
              - kms:Encrypt
              - kms:GenerateDataKey*
              - kms:ReEncrypt*
            Resource:
              - !Ref pKMSInfraKeyId

  # Routing Role
  rRoleLambdaExecutionRoutingStep:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !Sub sdlf-${pTeamName}-${pPipeline}-routing-a
      PermissionsBoundary: !Ref pPermissionsBoundaryManagedPolicy
      ManagedPolicyArns:
        - !Ref rLambdaCommonPolicy
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service: lambda.amazonaws.com
            Action: sts:AssumeRole
      Path: /state-machine/
      Policies:
        - PolicyName: !Sub sdlf-${pTeamName}-${pPipeline}-routing-a
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Effect: Allow
                Action:
                  - states:StartExecution
                Resource:
                  - !Ref rStateMachine
              - Effect: Allow
                Action:
                  - sqs:DeleteMessage
                  - sqs:DeleteMessageBatch
                  - sqs:GetQueueAttributes
                  - sqs:GetQueueUrl
                  - sqs:ListQueues
                  - sqs:ListDeadLetterSourceQueues
                  - sqs:ListQueueTags
                  - sqs:ReceiveMessage
                  - sqs:SendMessage
                  - sqs:SendMessageBatch
                Resource:
                  - !GetAtt rQueueRoutingStep.Arn
                  - !GetAtt rDeadLetterQueueRoutingStep.Arn

  # Step1 Role
  rRoleLambdaExecutionStep1:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !Sub sdlf-${pTeamName}-${pPipeline}-preupdate-a
      PermissionsBoundary: !Ref pPermissionsBoundaryManagedPolicy
      ManagedPolicyArns:
        - !Ref rLambdaCommonPolicy
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service: lambda.amazonaws.com
            Action: sts:AssumeRole
      Path: /state-machine/
      Policies:
        - PolicyName: !Sub sdlf-${pTeamName}-${pPipeline}-preupdate-a
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Effect: Allow
                Action:
                  - s3:ListBucket
                Resource:
                  - !Sub arn:aws:s3:::${pStageBucket}
              - Effect: Allow
                Action:
                  - s3:GetObject
                Resource:
                  - !Sub arn:aws:s3:::${pStageBucket}/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/stage/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/pre-stage/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/post-stage/${pTeamName}/*

  # Step2 Role
  rRoleLambdaExecutionStep2:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !Sub sdlf-${pTeamName}-${pPipeline}-process-a
      PermissionsBoundary: !Ref pPermissionsBoundaryManagedPolicy
      ManagedPolicyArns:
        - !Ref rLambdaCommonPolicy
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service: lambda.amazonaws.com
            Action: sts:AssumeRole
      Path: /state-machine/
      Policies:
        - PolicyName: !Sub sdlf-${pTeamName}-${pPipeline}-process-a
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Effect: Allow
                Action:
                  - s3:GetBucketVersioning
                  - s3:ListBucket
                Resource:
                  - !Sub arn:aws:s3:::${pDatasetBucket}
                  - !Sub arn:aws:s3:::${pStageBucket}
                  - !Sub arn:aws:s3:::${pArtifactsBucket}
              - Effect: Allow
                Action:
                  - s3:GetObject
                  - s3:PutObject
                Resource:
                  - !Sub arn:aws:s3:::${pDatasetBucket}/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pDatasetBucket}/raw/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/stage/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/pre-stage/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/post-stage/${pTeamName}/*
              - Effect: Allow
                Action:
                  - kms:DescribeKey
                  - kms:Encrypt
                  - kms:Decrypt
                  - kms:ReEncrypt*
                  - kms:GenerateDataKey*
                  - kms:CreateGrant
                Resource:
                  - !Ref pKMSDataKeyId

  # Step3 Role
  rRoleLambdaExecutionStep3:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !Sub sdlf-${pTeamName}-${pPipeline}-postupdate-a
      PermissionsBoundary: !Ref pPermissionsBoundaryManagedPolicy
      ManagedPolicyArns:
        - !Ref rLambdaCommonPolicy
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service: lambda.amazonaws.com
            Action: sts:AssumeRole
      Path: /state-machine/
      Policies:
        - PolicyName: !Sub sdlf-${pTeamName}-${pPipeline}-postupdate-a
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Effect: Allow
                Action:
                  - sqs:GetQueueAttributes
                  - sqs:GetQueueUrl
                  - sqs:ListQueues
                  - sqs:ListDeadLetterSourceQueues
                  - sqs:ListQueueTags
                  - sqs:SendMessage
                  - sqs:SendMessageBatch
                Resource:
                  - !Sub arn:aws:sqs:${AWS::Region}:${AWS::AccountId}:sdlf-${pTeamName}-*
              - Effect: Allow
                Action:
                  - s3:ListBucket
                Resource:
                  - !Sub arn:aws:s3:::${pStageBucket}
              - Effect: Allow
                Action:
                  - s3:GetObject
                Resource:
                  - !Sub arn:aws:s3:::${pStageBucket}/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/stage/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/pre-stage/${pTeamName}/*
                  - !Sub arn:aws:s3:::${pStageBucket}/post-stage/${pTeamName}/*

  # Error Handling Lambda Role
  rRoleLambdaExecutionErrorStep:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !Sub sdlf-${pTeamName}-${pPipeline}-error-a
      PermissionsBoundary: !Ref pPermissionsBoundaryManagedPolicy
      ManagedPolicyArns:
        - !Ref rLambdaCommonPolicy
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service: lambda.amazonaws.com
            Action: sts:AssumeRole
      Path: /state-machine/
      Policies:
        - PolicyName: !Sub sdlf-${pTeamName}-${pPipeline}-error-a
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Effect: Allow
                Action:
                  - sqs:DeleteMessage
                  - sqs:DeleteMessageBatch
                  - sqs:GetQueueAttributes
                  - sqs:GetQueueUrl
                  - sqs:ListQueues
                  - sqs:ListDeadLetterSourceQueues
                  - sqs:ListQueueTags
                  - sqs:ReceiveMessage
                  - sqs:SendMessage
                  - sqs:SendMessageBatch
                Resource:
                  - !GetAtt rDeadLetterQueueRoutingStep.Arn

  ######## LAMBDA FUNCTIONS #########
  rLambdaRoutingStep:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: ./lambda/stage-a-routing/src
      FunctionName: !Sub sdlf-${pTeamName}-${pPipeline}-routing-a
      Description: Routes S3 PutObject Logs to the relevant StageA State Machine
      MemorySize: 256
      Timeout: 60
      Role: !GetAtt rRoleLambdaExecutionRoutingStep.Arn

  rLambdaRedriveStep:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: ./lambda/stage-a-redrive/src
      FunctionName: !Sub sdlf-${pTeamName}-${pPipeline}-redrive-a
      Environment:
        Variables:
          TEAM: !Ref pTeamName
          PIPELINE: !Ref pPipeline
          STAGE: StageA
      Description: Redrives Failed S3 PutObject Logs to the routing queue
      MemorySize: 256
      Timeout: 300
      Role: !GetAtt rRoleLambdaExecutionRoutingStep.Arn

  rLambdaStep1:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: ./lambda/stage-a-preupdate-metadata/src
      FunctionName: !Sub sdlf-${pTeamName}-${pPipeline}-preupdate-a
      Description: Pre-Update the metadata in the DynamoDB Catalog table
      MemorySize: 128
      Timeout: 300
      Role: !GetAtt rRoleLambdaExecutionStep1.Arn

  rLambdaStep2:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: ./lambda/stage-a-process-object/src
      FunctionName: !Sub sdlf-${pTeamName}-${pPipeline}-process-a
      Description: Processing pipeline
      MemorySize: 1536
      Timeout: 600
      Role: !GetAtt rRoleLambdaExecutionStep2.Arn
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



