Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lambda code: add asset metadata to support SAM CLI #1432

Closed
eladb opened this issue Dec 26, 2018 · 0 comments · Fixed by #1433
Closed

Lambda code: add asset metadata to support SAM CLI #1432

eladb opened this issue Dec 26, 2018 · 0 comments · Fixed by #1433
Labels
@aws-cdk/assets Related to the @aws-cdk/assets package @aws-cdk/aws-lambda Related to AWS Lambda feature-request A feature should be added or improved.

Comments

@eladb
Copy link
Contributor

eladb commented Dec 26, 2018

In order to enable AWS Lambda functions defined in CDK apps to be locally invoked through SAM CLI, the CLI needs to know the location of the Lambda handler code on the local disk.

The current implementation of Lambda code assets decouples the asset management from the Lambda resource, such that the resource's representation in the synthesized CloudFormation template basically just refers to the asset's S3 bucket and key indirectly via asset parameters.

This makes it quite complicated to traverse back from an asset to the resource which uses it. We propose to add CloudFormation metadata to the template so that SAM CLI will be able to infer the CodeUri of the function automatically.

Copy: @jfuss

@eladb eladb added enhancement @aws-cdk/assets Related to the @aws-cdk/assets package @aws-cdk/aws-lambda Related to AWS Lambda labels Dec 26, 2018
eladb pushed a commit that referenced this issue Dec 26, 2018
Initial RFC for design of #1432
eladb pushed a commit that referenced this issue Dec 27, 2018
Adds CloudFormation resource metadata which enables tools such as SAM
CLI to find local assets used by resources in the template.

See design document under [design/code-asset-metadata.md](./design/code-asset-metadata.md)

Fixes #1432
eladb pushed a commit that referenced this issue Dec 27, 2018
…#1433)

Adds CloudFormation resource metadata which enables tools such as SAM
CLI to find local assets used by resources in the template.

The toolkit enables this feature by default, but it can be disabled using `--no-asset-metadata` or by setting `assetMetadata` to `false` in `cdk.json`.

See design document under [design/code-asset-metadata.md](./design/code-asset-metadata.md)

Fixes #1432
@srchase srchase added feature-request A feature should be added or improved. and removed enhancement labels Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/assets Related to the @aws-cdk/assets package @aws-cdk/aws-lambda Related to AWS Lambda feature-request A feature should be added or improved.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants