aws-cdk-lambdecor
Transform native python function into AWS CDK Custom Resources.
from aws_cdk_lambdecor import aws_lambda
from aws_cdk import core as cdk
app = cdk.App()
stack = cdk.Stack(app, 'HelloLambdecor')
@aws_lambda(stack)
def greet():
return 'hello'
# invoke the function just like a regular function
greeting = greet()
# return value is a token that can be used later on
cdk.CfnOutput(stack, 'Greeting', value=greeting)
app.synth()
You can also use tokens:
from aws_cdk_lambdecor import aws_lambda
from aws_cdk import core as cdk
from aws_cdk import s3
from aws_cdk import aws_apigateway as apigateway
app = cdk.App()
stack = cdk.Stack(app, 'HelloLambdecor')
@aws_lambda(stack)
def ping(url):
http = urllib3.PoolManager()
r = http.request('GET', url)
return r.status
api = apigateway.LambdaRestApi(...)
status = ping(api.url)
cdk.CfnOutput(stack, 'Status', value=status)
app.synth()
Runtime
The Custom Resource is created with the Python3.6 Lambda Runtime
Imports
The following modules are pre-imported into the lambda environment:
jsonurllib3
To use any other module, you would need to do an inline import.
Install
pip install aws-cdk-lambdecor
Possible Future Work
- Support customizing all properties of the CDK Lambda Function (i.e runtime, memory, environment...)
- Pre-import additional common libraries.
- Implicit CDK scope creation to support CDK applications consisting of just these lambda functions.
- Implicit creation of Stack output.
- Command line invocation of function that runs
cdk deployand parses the stack output. (i.eresult=$(aws-cdk-lamdecor invoke func.py))
Metadata
Release files for aws-cdk-lambdecor 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aws_cdk_lambdecor-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Release files / aws_cdk_lambdecor-0.2.1-py3-none-any.whl
| Download URL | aws_cdk_lambdecor-0.2.1-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7e0d1b6b2b639043f3d3b93bc14ee760fb65be4beff68083144a5f433dc6c5e7
|
|
BLAKE2b-256 checksum How to use checksums |
83743cc359c075805f955bc6aa481aef3cfbbf812ea775ecd1311e281e2c5457
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.8
|
Security for aws-cdk-lambdecor 0.2.1
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.