aws / aws/aws-cdk

Reuse Logical IDs of existing serverless framework resources for the L2 Constructs

Open
#32,957 1 comment 2 reactions 0 assignees View on GitHub
@aws-cdk/aws-s3 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

Hoping to prevent CFN from creating a resource that an existing serverless framework stack had already created allowing us to reuse the Logical IDs for new L2 Constructs. This prevents the deletion of the stacks created by Serverless Framework (preventing data loss etc) and prevents CDK having to recreate these stacks.

### Use Case

Currently CFN has an issue with the Logical IDs that AWS CDK is generating (the adding of a "8-digit hash"). Allowing CDK to recreate the stacks do work but trying to avoid that as it would be preferred to NOT delete each stack created by Serverless Framework since some stacks create S3 buckets and DynamoDB tables which have data.

Instead, looking for a way to use L2 constructs, similar to what is happening in the below link but without relying on the template JSON file as I am looking to reuse the existing logical ids for new L2 constructs natively:
https://docs.aws.amazon.com/cdk/v1/guide/use_cfn_template.html

### Proposed Solution

It is noted that for a workaround I can use an excape hatch to access the node default child in order to interfact with its L1 interface, then use the L1 method overrideLogicalId to change the logical ID, but putting in this feature request for a more native way of being able to reuse the logical IDs.

### Other Information

_No response_

### Acknowledgements

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

### CDK version used

v2.175.0

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

n/a

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the AWS CDK L2 Constructs and the L1 escape-hatch path described in the issue, including overrideLogicalId and the linked use_cfn_template documentation. Determine where a native logical-ID reuse capability would belong and define completion as reusing existing Serverless Framework logical IDs without template JSON, resource recreation, or the escape hatch.

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
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.