aws / aws/aws-cdk

(aws-lambda): Expose `logGroup` prop in IFunction

Open
#33,708 3 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-lambda feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

Expose a `logGroup` prop in `IFunction` that is:
- populated with a `logGroup` prop, when using `Function.fromFunctionAttributes()`
- defaults to the conventional `/aws/lambda/` logGroup generated by Lambda

### Use Case

I have a CDK app, that imports some Lambdas (`Function.fromFunctionAttributes/Name/Arn`) to create LogQueryWidgets in a CloudWatch dashboard. This widget expects log group names, which by default are `/aws/lambda/`, however functions can override this.

As I also control how the functions are created, I can expose the `logGroup` name along with the rest of the function attributes, if I have it set to something custom.

### Proposed Solution

1. Extend `IFunction` to expose a `logGroup` prop
2. Update `Function.fromFunctionAttributes()` to accept this prop (and maybe defaults to the auto-generated logGroup name?)

### Other Information

_No response_

### Acknowledgements

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

### CDK version used

2.180.0

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

MacOS

Contributor guide

Open the contributing guide

Research direction

Start at the IFunction declaration and Function.fromFunctionAttributes(), the entry points named in the issue, and trace how imported Lambda attributes are represented. Done means IFunction exposes logGroup, fromFunctionAttributes() accepts a custom value, and the conventional /aws/lambda/ value is available when no override is supplied.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.