Skip to content

Instantly share code, notes, and snippets.

@thibaudlemaire
Last active June 3, 2019 15:54
Show Gist options
  • Save thibaudlemaire/eb05cab322da20cb9d77128bdf283bc6 to your computer and use it in GitHub Desktop.
Save thibaudlemaire/eb05cab322da20cb9d77128bdf283bc6 to your computer and use it in GitHub Desktop.
Basic Sam template to run Symfony application on AWS Lambda using Bref
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Globals:
Function:
Environment:
Variables:
APP_ENV: prod
Resources:
Website:
Type: AWS::Serverless::Function
Properties:
FunctionName: 'symfony-website'
CodeUri: .
Handler: public/index.php
Timeout: 30 # in seconds (API Gateway has a timeout of 30 seconds)
MemorySize: 1024
Runtime: provided
Layers:
- 'arn:aws:lambda:us-east-1:209497400698:layer:php-73-fpm:6'
Events:
HttpRoot:
Type: Api
Properties:
Path: /
Method: ANY
HttpSubPaths:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY
Console:
Type: AWS::Serverless::Function
Properties:
FunctionName: 'symfony-console'
CodeUri: .
Handler: bin/console
Timeout: 120 # in seconds
Runtime: provided
Layers:
- 'arn:aws:lambda:us-east-1:209497400698:layer:php-73:6' # PHP
- 'arn:aws:lambda:us-east-1:209497400698:layer:console:6' # The "console" layer
Outputs:
Website:
Description: 'URL of our function in the *Prod* environment'
Value: !Sub 'https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment