- run
yarn
- run
yarn build
- run
cdk bootstrap
- run
sam build
-> notice correct python pandas dependency in.aws-sam/build/pickletovizservicePickleToVizHandler68C6D6E2/pandas
- run
sam local invoke
-> notice errorUnable to import module 'handler': No module named 'pandas'
This readme is based one a few resources that you should read to fully understand the framework
- https://docs.aws.amazon.com/cdk/latest/guide/getting_started.html
- AWS Profile Changer: https://github.com/antonbabenko/awsp
- for local lambda development use AWS SAM CLI: https://github.com/awslabs/aws-sam-cli
The cdk.json
file tells the CDK Toolkit how to execute your app.
- run
yarn run init
to bootrap the cdk - run
yarn dev
to start local dev API
yarn run build
compile typescript to jsyarn run watch
watch for changes and compileyarn run test
perform the jest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation template
cdk synth --no-staging > template.yaml
to create a template.yml file which sam will use to invoke the functionsam local invoke mywidgetserviceWidgetHandlerFAB6825C --event events/get.json --env-vars environment.json
fire a localmywidgetserviceWidgetHandlerFAB6825C
is the lambda function reference, you can find it intemplate.yml
- you can define GET/POST/ANY events as json and send them along your local function invocation
- if your lambda accesses real ressources (e.g. an S3 bucket), local invocation wont be able to access the real bucket because the local environment variables are just the references in
template.yml
, not the real urls of AWS resources. - local invocations can therefore only access real existing AWS resources. You need to manually define environment variables to sam like that:
{
"mywidgetserviceWidgetHandlerFAB6825C": {
"BUCKET": "real-bucket-url"
}
}
- start local development API:
sam local start-api --env-vars environment.json