Getting started with PHP on AWS Lambda | Thomas Bley


Learn how to get started with PHP on AWS Lambda, the managed service for running PHP code without servers. Discover how to compile and package PHP code, and explore the various features and integrations available.

Key takeaways
  • AWS Lambda is a managed service that allows running PHP code without provisioning or managing servers.
  • It’s event-driven, so code is executed in response to specific events, such as changes to an S3 bucket or API Gateway requests.
  • To use PHP with AWS Lambda, you need to compile the PHP source code on a special platform and create a binary that can run on the Lambda environment.
  • The binary can be packaged with your code and uploaded to Lambda as a ZIP file.
  • Each Lambda function has a limited amount of memory available, which is specified when the function is created.
  • Lambda functions can be scaled automatically, and can handle thousands of requests per second.
  • The maximum execution time for a Lambda function is 15 minutes.
  • Error handling is important, as Lambda functions will automatically retry up to three times if they fail.
  • AWS Lambda provides a range of built-in integrations with other AWS services, such as S3, SQS, and DynamoDB.
  • The pricing model for AWS Lambda is based on the amount of memory used and the number of requests processed.
  • Lambda functions can be triggered by a variety of event sources, including API Gateway, S3, Kinesis, and more.
  • AWS Lambda provides a range of features for handling errors, such as dead letter queues and retries.
  • The Lambda environment provides a range of extensions and libraries, including MySQL and PostgreSQL drivers.
  • To deploy a Lambda function, you need to create a ZIP file containing your code and upload it to Lambda.
  • You can also use Docker to package your code and deploy it to Lambda.
  • The Lambda environment provides a range of logging options, including CloudWatch logs.
  • AWS Lambda provides a range of security features, including IAM roles and access controls.