Sidecar — Deploy and execute AWS Lambda functions from your Laravel application.

Environments

Sidecar functions are separated by environment, so that your local development functions don't overwrite your production functions. You can have as many environments as you please.

By default, Sidecar will use the environment from your Laravel application, which itself comes from the APP_ENV environment variable.

If you'd rather use a dedicated environment variable for Sidecar, you can use the SIDECAR_ENV variable.

1<?php
2 
3return [
4 /*
5 * Sidecar separates functions by environment. If you'd like to change
6 * your Sidecar environment without changing your entire application
7 * environment, you may do so here.
8 */
9 'env' => env('SIDECAR_ENV', env('APP_ENV')),
10];

This can be particularly useful when you're developing in a team. If everyone on your team has APP_ENV=local in their environment file, then it's likely that functions will inadvertently be overwritten by your teammates, which is both confusing and frustrating.

In this case, it would make sense to set your Sidecar environment to e.g. SIDECAR_ENV=aaron_local, SIDECAR_ENV=sean_local, etc.

This way Sean & Aaron have different environments and won't overwrite each other's work.

Faking the Environment

If you need to deploy an environment other than the one you are in, you can override the environment from the config by passing an --env flag to the Deploy and Activate commands.

1php artisan sidecar:deploy --env=production
2php artisan sidecar:activate --env=production
Code highlighting powered by torchlight.dev, a Hammerstone product.

This is useful when you want to build and deploy from either your local machine, your CI pipeline, or GitHub Actions, and then you want to activate as your Laravel application rolls out.

Head over to the Deploying section to read more about activating & deploying your functions.