AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: > Sagemaker presigned App # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst Globals: Function: Timeout: 3 Resources: SMPresigned: Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction Properties: CodeUri: presigned/ Handler: app.lambda_handler Runtime: python3.8 Policies: - Statement: - Sid: SagemakerPresignedInlinePolicy Effect: Allow Action: - sagemaker:CreatePresignedDomainUrl Resource: '*' Events: PresignRequestEvent: Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api Properties: Path: / Method: get Outputs: # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function # Find out more about other implicit resources you can reference within SAM # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api SMPresignedApi: Description: "API Gateway endpoint URL for Prod stage for Sagemaker Presigned function" Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod" SMPresigned: Description: "SMPresigned Lambda Function ARN" Value: !GetAtt SMPresigned.Arn SMPresignedIamRole: Description: "Implicit IAM Role created for presigned function" Value: !GetAtt SMPresignedRole.Arn