aws / aws/aws-cdk

(asset): Create an `Asset` from a JS object (POJO)

Open
#20,795 1 comment 3 reactions 0 assignees View on GitHub
@aws-cdk/aws-opensearch effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

I would like to be able to create an asset from a plain JS object.

### Use Case

## Generic

Include a large JS object as part of the deployment, so that it can then be used in a Custom Resource handler.

## Specific

We are working on an OpenSearch construct that interacts with the OpenSearch domain.

This construct has methods that _do things_, such as create an index map or can even, potentially, add data to the index (seed data).

These objects are arbitrary in size, and are not suitable for Custom Resource parameter passing.

The idea is to create an asset from this object (props), and then pass it as the CR prop to the handler.

### Proposed Solution

Similar to how S3 Deployment construct works, but for generic assets.

https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3_deployment-readme.html#supported-sourcesconstructs

### Other Information

Roll our own.

### Acknowledgements

- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

2

### Environment details (OS name and version, etc.)

N/A

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Start by reviewing the linked S3 Deployment supported-sources documentation and the existing Custom Resource asset flow; done means a plain JavaScript object can become a generic asset and be passed to a handler as a custom-resource property.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.