Skip to content

Latest commit

 

History

History
59 lines (43 loc) · 1.62 KB

deploy-redirect-lambda.md

File metadata and controls

59 lines (43 loc) · 1.62 KB

How to deploy a new version of the redirection Lambda

  1. 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.)

  2. 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.

  3. Test the redirects in staging:

    $ cd edge-lambda/
    $ yarn testRedirectsStage
  4. 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.

  5. Test the redirects in prod:

    $ cd edge-lambda/
    $ yarn testRedirects