Skip to main content

lambda_freezer

Goals:

  • Make it easy to deploy one or many services under the same Amazon API Gateway.
  • Make it easy to deploy a stage in an immutable way.

Deploy a specific stage

The main aim of this module is to help your Amazon API Gateway work in such a way that each stage is immutable. This is achieved by using the versioning and aliasing features of Lambda function, as well as stage variables. The gist is this:

  • When deploying a stage, each underlying Lambda function is frozen to a specific version.
  • When calling the resouces for that particular stage, the "frozen" versioning of Lambda functions will be called (indirectly via an alias).

For more information of how that is achieved "manually" in more details: https://aws.amazon.com/blogs/compute/using-api-gateway-stage-variables-to-manage-lambda-functions/

Python 3.6.9 (default, Nov  7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lambda_freezer
>>> REST_API_ID = "r5ltm5nqr6"
>>> REGION = "us-east-1"
>>> APILIB_DEFAULT_ALIAS_NAME = "uat"
>>> DOMAIN_NAME = "api-library.puno.io" # this guy is optional
>>> deploy(REST_API_ID, REGION, "0.0.1", "some description", APILIB_DEFAULT_ALIAS_NAME, DOMAIN_NAME)

Flow (super opinionated)

  • use serverless framework and configure like something below.
 - provider:
      name: aws
      runtime: python3.6
      stage: latest # IMPORTANT - this need to match -> APILIB_DEFAULT_ALIAS_NAME
      versionFunctions: false # versioning would be done only upon deploying/"freezing" to a stage
      apiGateway: # make sure you point to a common api gateway
        restApiId:
          'Fn::ImportValue': 'OUTPUT-ApiGatewayRestApiId-REPLACE-WITH-OWN'
        restApiRootResourceId:
          'Fn::ImportValue': 'OUTPUT-ApiGatewayRestApiRootResourceId-REPLACE-WITH-OWN'
  • To push your functions and make sure the api gateway integration gets changed. (We want that every function integrations' are such that the api gateway can only call a specific version of any lambda functions via an alias, using a stage variable).
serverless deploy
Python 3.6.9 (default, Nov  7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lambda_freezer
>>> REST_API_ID = "r5ltm5nqr6"
>>> REGION = "us-east-1"
>>> APILIB_DEFAULT_ALIAS_NAME = "uat"
>>> DOMAIN_NAME = "api-library.puno.io" # this guy is optional
>>> run_after_default_deployment(REST_API_ID, REGION, APILIB_DEFAULT_ALIAS_NAME, DOMAIN_NAME)
  • When you like a specific version of your functions, just "freeze" them using the deploy cmd described above.

Metadata

Release files for lambda-freezer 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lambda-freezer 0.0.9
File Size Uploaded Provenance Actions
lambda-freezer-0.0.9.tar.gz 7.3 kB Without provenance Details for lambda-freezer-0.0.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lambda-freezer 0.0.9
File Interpreter ABI Platform Actions
lambda_freezer-0.0.9-py3-none-any.whl Python 3 none any Details for lambda_freezer-0.0.9-py3-none-any.whl

Total release size: 15.0 kB

Release files / lambda-freezer-0.0.9.tar.gz

Download URL lambda-freezer-0.0.9.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
229be8bda2161b44cea1f8f0f69e26039844bf232e0284fe307f4a6020c55cd7
BLAKE2b-256 checksum
How to use checksums
396a1dc3b0e9c40481c3389192c0a742463ac41699cc90ff6dfdafce436a40a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release files / lambda_freezer-0.0.9-py3-none-any.whl

Download URL lambda_freezer-0.0.9-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01522a9aa50c5afb98fc01c40d7e733d34a4728cb631b6110e80291874be8623
BLAKE2b-256 checksum
How to use checksums
3df31e06942f1de53676856d191465532bf64cab272ef28b3b4f4e5922035513
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Security for lambda-freezer 0.0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page