service: cad-lambdas # app and org for use with dashboard.serverless.com #app: your-app-name #org: your-org-name # plugins: # - serverless-offline # You can pin your service to only deploy with a specific Serverless version # Check out our docs for more details frameworkVersion: '2' provider: name: aws lambdaHashingVersion: 20201221 ecr: images: # this image is built locally and push to ECR openscadimage: path: ./ file: ./openscad/Dockerfile cadqueryimage: path: ./ file: ./cadquery/Dockerfile apiGateway: metrics: true # you can overwrite defaults here # stage: dev # region: us-east-1 # you can add statements to the Lambda function's IAM Role here iam: role: statements: - Effect: "Allow" Action: - "s3:GetObject" Resource: "arn:aws:s3:::cad-preview-bucket-prod-001/*" - Effect: "Allow" Action: - "s3:PutObject" Resource: "arn:aws:s3:::cad-preview-bucket-prod-001/*" # Dev bucket is cad-preview-bucket-dev-001/*" # you can define service wide environment variables here # environment: # variable1: value1 functions: openscadpreview: image: name: openscadimage command: - openscad.preview entryPoint: - '/entrypoint.sh' events: - http: path: openscad/preview method: post cors: true timeout: 25 environment: BUCKET: cad-preview-bucket-prod-001 openscadstl: image: name: openscadimage command: - openscad.stl entryPoint: - '/entrypoint.sh' events: - http: path: openscad/stl method: post cors: true timeout: 30 environment: BUCKET: cad-preview-bucket-prod-001 cadquerystl: image: name: cadqueryimage command: - cadquery.stl entryPoint: - '/entrypoint.sh' events: - http: path: cadquery/stl method: post cors: true timeout: 30 environment: BUCKET: cad-preview-bucket-prod-001 # The following are a few example events you can configure # NOTE: Please make sure to change your handler code to work with those events # Check the event documentation for details # events: # - httpApi: # path: /users/create # method: get # - websocket: $connect # - s3: ${env:BUCKET} # - schedule: rate(10 minutes) # - sns: greeter-topic # - stream: arn:aws:dynamodb:region:XXXXXX:table/foo/stream/1970-01-01T00:00:00.000 # - alexaSkill: amzn1.ask.skill.xx-xx-xx-xx # - alexaSmartHome: amzn1.ask.skill.xx-xx-xx-xx # - iot: # sql: "SELECT * FROM 'some_topic'" # - cloudwatchEvent: # event: # source: # - "aws.ec2" # detail-type: # - "EC2 Instance State-change Notification" # detail: # state: # - pending # - cloudwatchLog: '/aws/lambda/hello' # - cognitoUserPool: # pool: MyUserPool # trigger: PreSignUp # - alb: # listenerArn: arn:aws:elasticloadbalancing:us-east-1:XXXXXX:listener/app/my-load-balancer/50dc6c495c0c9188/ # priority: 1 # conditions: # host: example.com # path: /hello # Define function environment variables here # environment: # variable2: value2 # you can add CloudFormation resource templates here #resources: # Resources: # NewResource: # Type: AWS::S3::Bucket # Properties: # BucketName: my-new-bucket # Outputs: # NewOutput: # Description: "Description for the output" # Value: "Some output value" resources: Resources: GatewayResponseDefault4XX: Type: 'AWS::ApiGateway::GatewayResponse' Properties: ResponseParameters: gatewayresponse.header.Access-Control-Allow-Origin: "'*'" gatewayresponse.header.Access-Control-Allow-Headers: "'*'" ResponseType: DEFAULT_4XX RestApiId: Ref: 'ApiGatewayRestApi' GatewayResponseDefault5XX: Type: 'AWS::ApiGateway::GatewayResponse' Properties: ResponseParameters: gatewayresponse.header.Access-Control-Allow-Origin: "'*'" gatewayresponse.header.Access-Control-Allow-Headers: "'*'" ResponseType: DEFAULT_5XX RestApiId: Ref: 'ApiGatewayRestApi'