AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: Process a user-provided video (e.g video.mp4) into a series of screenshots. Parameters: InputFile: Type: String Default: video.MP4 EFSpath: Type: String Default: /mnt/efs SecurityGroupIds: Type: CommaDelimitedList SubnetIDs: Type: CommaDelimitedList Description: The list of SubnetIDs in your Virtual Private Cloud (VPC) AccessPointARN: Type: String Description: Access point ARN Resources: ProcessFileFunction: Type: AWS::Serverless::Function Properties: CodeUri: processFile/ Timeout: 300 MemorySize: 2048 Handler: app.handler Layers: - <ARN of the Lambda Layer for ffmpeg> Environment: Variables: INPUT_FILE: !Ref InputFile EFS_PATH: !Ref EFSpath Runtime: nodejs12.x Events: API: Type: Api Properties: Path: /processFile Method: get VpcConfig: SecurityGroupIds: !Ref SecurityGroupIds SubnetIds: !Ref SubnetIDs FileSystemConfigs: - Arn: !Ref AccessPointARN LocalMountPath: !Ref EFSpath Policies: - Statement: - Sid: AWSLambdaVPCAccessExecutionRole Effect: Allow Action: - logs:CreateLogGroup - logs:CreateLogStream - logs:PutLogEvents - ec2:CreateNetworkInterface - ec2:DescribeNetworkInterfaces - ec2:DeleteNetworkInterface Resource: "*" - Sid: AmazonElasticFileSystemClientFullAccess Effect: Allow Action: - elasticfilesystem:ClientMount - elasticfilesystem:ClientRootAccess - elasticfilesystem:ClientWrite - elasticfilesystem:DescribeMountTargets Resource: "*"