Migrating a PHP application to AWS Lambda with Bref

A conventional PHP application usually assumes a long-lived web server, a writable document root and extensions such as PDO already installed. Those assumptions do not disappear when code is copied into AWS Lambda. Bref supplies a PHP runtime and a bridge to Lambda’s managed execution environment, letting a Composer application run behind API Gateway, a function URL or an application load balancer. It reduces server patching, but it remains an architecture change rather than a deployment shortcut.

For an Australian team running a booking platform, customer portal or Laravel storefront, the work begins by separating synchronous requests from background jobs. A staged move can start with a low-risk endpoint, measure cold starts and database connections, and retain a rollback path. The goal is to preserve the controls systems administrators expect: least-privilege access, repeatable infrastructure, useful logs and a rehearsed cutover.

Why Bref suits Lambda

Bref packages the PHP application, Composer dependencies and runtime files into a Lambda deployment. A function can use a web handler for HTTP requests, while Bref manages PHP-FPM inside the execution environment. Existing framework routing, service classes and externally stored sessions can remain in place. This is useful for tested PHP applications that need elastic scaling and less operating-system maintenance.

The boundary matters. Lambda provides a temporary filesystem and limited execution time, not the persistent disk, resident worker or operating-system configuration of a traditional VPS. Long-running consumers, image processing and scheduled scripts should become separate functions with their own timeouts and concurrency settings. Move writable uploads to S3 and local cache data to Redis or DynamoDB. Bref removes packaging friction, not the need to redesign stateful assumptions.

Preparing the application

Inventory the PHP version, extensions, Composer packages, environment variables, cron entries and outbound calls. Run the test suite, then exercise the same code through Bref’s local tooling so differences in headers, request bodies, uploads and error handling appear before deployment. Remove assumptions about permanent files, local locks and writable application directories. Confirm that database drivers, XML and mbstring are available in the selected runtime, and update packages that rely on removed system libraries.

Package the application as a reproducible artifact. Give each Lambda function an explicit handler, pinned runtime, memory setting, timeout and environment variables pointing to managed services. Keep secrets out of code and deployment files, retrieving them from AWS Secrets Manager or Parameter Store at runtime. Use separate development, staging and production accounts or stacks, and promote the same tested artifact through the pipeline. This prevents a local PHP install from hiding a missing extension or an incorrectly scoped IAM policy.

Operational readiness belongs in the same checklist. If technicians carry company iPhones, the recovering a powered-off iPhone process is a useful support-runbook reference, while application access should be revoked centrally when a device is lost. For the migration, verify password resets, support impersonation, audit trails and emergency access without the familiar web server.

Infrastructure, events, and observability

For HTTP traffic, API Gateway is a common front door; an application load balancer or Lambda function URL may better suit an existing domain and routing model. Preserve required request limits, binary support, WebSocket behaviour and custom headers. Test redirects, cookies, validation errors and exception responses, because a generic gateway error can conceal an application fault.

Match background work to its semantics: SQS for queue-driven jobs, EventBridge for scheduled rules, and SNS or EventBridge for fan-out. Each worker needs a bounded batch, retry policy and dead-letter queue. Schedule in UTC and display Australian times carefully because Sydney and Melbourne change clocks while Brisbane does not. A Lambda connected to Aurora or RDS in a VPC also brings DNS, subnet, routing and NAT considerations, plus strict connection-pool limits.

Use CloudWatch logs, custom metrics and alarms for invocations, errors, duration, throttles, queue age and database latency. Put a correlation identifier in structured logs, while redacting tokens, card details and personal information. Place workloads in the region that best serves Australian users: Sydney, ap-southeast-2, and Melbourne, ap-southeast-4, are the usual starting points, with Brisbane commonly closest to Sydney. Test latency from major cities and confirm residency, backup and support-access terms for regulated data.

Security, data, and Australian requirements

Lambda removes the need to patch a web-server operating system, but it does not remove application-security work. Give each function a dedicated execution role with only required permissions, restrict API access, and encrypt data in transit and at rest. Use TLS, sensible authentication, rate limiting and a WAF where appropriate. Pin dependencies, scan packages, review Lambda layers and update them regularly. Place workforce access behind identity controls, and record configuration changes in CloudTrail.

For an Australian organisation handling personal information, map data flows before changing hosting. Where the Privacy Act 1988 and Australian Privacy Principles apply, the organisation may need a documented privacy policy, purpose limitation, access controls, correction and deletion processes, and a defensible breach response. If the Notifiable Data Breaches scheme applies, the legal threshold can require notification to affected people and the Office of the Australian Information Commissioner. Marketing email and SMS also bring Spam Act 2003 and Do Not Call Register obligations. AWS supplies technical controls; legal responsibility stays with the organisation using the service.

The same planning discipline applies to adjacent systems. My on-premises Exchange migration guide shows how a staged infrastructure move can preserve identity, coexistence and rollback instead of relying on one cutover weekend. For PHP, the equivalent checkpoints include authentication, file access, scheduled jobs, webhooks, email delivery and reporting. Assign an owner to each integration and document its behaviour when AWS, a database or a third-party API is unavailable.

Practical recommendations for a controlled launch

Treat production migration as a rehearsable release, not a last-minute file copy. Start with a read-only or low-impact route, keep the legacy environment available for comparison, and define abort thresholds for error rate, latency, queue backlog and support volume. Automate infrastructure and database changes, then use a game day to exercise failures as well as the happy path. The following recommendations keep the change observable and reversible:

  • Record PHP versions, extensions, dependencies, cron jobs, scheduled tasks and outbound integrations before changing the runtime.
  • Run existing tests and Bref local checks covering authentication, uploads, redirects, errors and background jobs.
  • Store sessions, uploads and caches in managed services rather than relying on Lambda’s filesystem.
  • Keep execution roles narrow, load secrets at runtime, encrypt sensitive data and scan dependencies.
  • Deploy separate environments and promote the same immutable, tested artifact.
  • Monitor latency, cold starts, throttles, queue age, database connections and business failures.
  • Rehearse rollback, database recovery, secret rotation and incident communication before traffic moves.

After launch, compare availability and response times with the legacy server, then review memory, concurrency and cost. More memory can reduce CPU time; provisioned concurrency may help a latency-sensitive endpoint but adds expense. Check NAT charges, log retention and storage growth, remove unused resources, and assign owners to follow-up actions. That evidence makes the next phase safer and easier to justify.


Australian SMEs running PHP shops, membership portals and internal tools can reduce undifferentiated server administration while keeping a familiar programming model. The gain comes from predictable deployment, observability and recovery, not merely replacing a VPS with a function.

For an independent architecture review or migration-planning discussion, my Karl Katzke’s resume provides relevant cloud migration, infrastructure-planning and systems-administration experience. Select one representative workflow, document its dependencies, and test it in a staging stack before shifting customer traffic.

Experience

Information Technology Consulting

Independent Practice

Provides IT consulting services focused on infrastructure planning, cloud migration strategy, and systems architecture. Engagements draw on years of hands-on sysadmin and development experience across Linux, Windows, and hybrid environments.

K9 Search & Rescue Volunteer

Ongoing

Active participant in K9 Search & Rescue operations, combining technical logistics skills with field support for canine search teams.

Karl Katzke's Blog

October 2006 – May 2014

Published a long-running personal technology blog covering cloud vs. in-house infrastructure, F# and Mono on OSX, hardware vendor critiques, RAID card performance analysis, and sysadmin storytelling. Notable posts include "When Sysadmins Ruled the Earth" (May 15, 2014) and "Getting Started with F# and Mono on OSX" (December 22, 2012).

Credentials

A small badge icon with a shield shape in muted blue tones on a light background

Systems Administration

Deep experience with Linux (RHEL, SLES, CentOS), high-availability clusters, and STONITH configurations.

A small badge icon with a gear shape in muted blue tones on a light background

Cloud Infrastructure

Practical knowledge of AWS EC2, reserved instances, and cost analysis for cloud vs. on-premises deployments.

A small badge icon with a code symbol in muted blue tones on a light background

Development

Proficient in F#, PHP (Symfony), and cross-platform tooling including Mono and MonoDevelop on OSX.

Studies

F# & Functional Programming

Self-directed, 2012

Explored strongly typed functional programming with F# on OSX using the Mono runtime. Published a detailed getting-started guide covering toolchain setup and cross-platform game development research.

High-Availability & Cluster Management

Professional Development, 2009

Configured and documented crm_mon email alerting for STONITH events on SLES11-HAE clusters, integrating with Nagios monitoring for production environments.

Hardware & Storage Performance

Ongoing

Conducted hands-on benchmarking of SATA/SAS RAID controllers including HighPoint RocketRaid 2740 and LSI/SuperMicro AOC-USASLP2-H8iR, comparing against software RAID configurations.

Skills

A small icon representing a server with clean geometric lines in slate blue

Linux Administration

RHEL, SLES, CentOS — package management, kernel tuning, HA clustering, and monitoring integration.

A small icon representing a cloud shape with clean geometric lines in slate blue

Cloud Architecture

AWS EC2, reserved-instance planning, cost modeling, and hybrid infrastructure strategy.

A small icon representing code brackets with clean geometric lines in slate blue

F# & .NET/Mono

Functional programming on OSX, MonoDevelop toolchain, and cross-platform game-dev exploration.

A small icon representing a database cylinder with clean geometric lines in slate blue

PHP & Symfony

Web application development with the Symfony framework and the broader PHP ecosystem.

A small icon representing a storage drive with clean geometric lines in slate blue

Storage & RAID

SATA/SAS controller evaluation, md RAID configuration, and performance benchmarking.

A small icon representing a shield with clean geometric lines in slate blue

High Availability

Pacemaker, STONITH, crm_mon alerting, and Nagios integration for production cluster monitoring.