AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: >-
  An Amazon S3 trigger that retrieves metadata for the object that has been
  updated.
Resources:
  ambtiparktowerrawtoprepbucketlambda:
    Type: 'AWS::Serverless::Function'
    Properties:
      FunctionName: ambt-iparktower-execute-sagemaker
      Handler: lambda_function.lambda_handler
      Runtime: python3.8
      CodeUri: .
      Description: >-
        An Amazon S3 trigger that retrieves metadata for the object that has
        been updated.
      MemorySize: 128
      Timeout: 60
      Role: 'arn:aws:iam::314854109580:role/ambt-anoicos-lambda-role-dev'
      Events:
        BucketEvent1:
          Type: S3
          Properties:
            Bucket:
              Ref: Bucket1
            Events:
              - 's3:ObjectCreated:*'
            Filter:
              S3Key:
                Rules:
                  - Name: prefix
                    Value: dev/site_name%3Dipark_tower/
                  - Name: suffix
                    Value: .csv
      VpcConfig:
        SecurityGroupIds:
          - sg-004b2ab1a1236c38a
          - sg-0c06df8f1801f1223
        SubnetIds:
          - subnet-085e7dbb921a37896
          - subnet-08c7f7957ac229a39
          - subnet-093c720e80523ae87
          - subnet-096b6165c35976bed
      Tags:
        'lambda-console:blueprint': s3-get-object-python
  LambdaInvocationPermission:
    Type: AWS::Lambda::Permission
    Properties:
      SourceArn: 'arn:aws:s3:::hdci-ambt-anoicos-prep'
      Action: lambda:InvokeFunction
      Principal: s3.amazonaws.com
      FunctionName: !GetAtt ambtiparktowerrawtoprepbucketlambda.Arn
      SourceAccount: !Ref AWS::AccountId

  Bucket1:
    Type: 'AWS::S3::Bucket'
