-
Package and upload to S3 a ZIP for the Lambda definition
$ cd edge-lambda/ $ yarn uploadToS3 ... Finished uploading dist/wellcome_library_redirect.zip to s3://wellcomecollection-edge-lambdas/wellcome_library/wellcome_library_redirect.zip
(Note: this automatically happens whenever new code is pushed to the main branch.)
-
Apply the Terraform changes:
$ cd terraform/ $ terraform plan -out=terraform.plan # review the changes $ terraform apply terraform.plan
This will deploy the new version of the redirects to the staging domains. The new versions will be returned as an output:
stage_lambda_function_versions = { "archive" = "28" "blog" = "45" "encore" = "24" "passthru" = "61" "wellcomelibrary" = "80" }
We have multiple versions of the Lambda@Edge functions. When you upload a new zip package and run Terraform, it creates a new version. The staging domains always use the latest version, whereas the prod domains use a pinned version.
-
Test the redirects in staging:
$ cd edge-lambda/ $ yarn testRedirectsStage
-
Update the versions of the Lambda functions in prod in
lambda_versions.tf
, using the versions output from Terraform above. Then do another Terraform plan/apply. -
Test the redirects in prod:
$ cd edge-lambda/ $ yarn testRedirects