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: AliasOptions and VersionOptions should not extend EventInvokeConfigOptions #6966

Closed
eladb opened this issue Mar 24, 2020 · 3 comments
Labels
@aws-cdk/aws-lambda Related to AWS Lambda closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1

Comments

@eladb
Copy link
Contributor

eladb commented Mar 24, 2020

In v2.0 we should change the way we model event invoke configuration in AWS Lambda.

Originally posted by @iph in #6771

This was already there but since we are changing it to AliasOptions, it's strange to see EventInvokeConfigOptions as the base object here, as the two are two separate objects in cfn. Technically an alias can have an event invoke config and there is no mixin for typescript (unsure, I'm new to the language) so this was the best way? It seems brittle to tie that together because there will be additional concepts. Are we going to have multi-extends clauses per concept that is added to a qualifier that aliases supports? Will that work with JSII?

To me, it's about the degree of freedom. The kind of object relationship looks more like this:

                            event invoke config
                            -------------------
                                retries: 1
                                success: sqs ---+
                                                |
                                                |
Alias    develop      gamma         live <------+
             |         |              |
             |         |              |
Version: $LATEST------ v3-------------v2 ....
             |
         function:
           code +     code +         code +
           config     config         config

An event config you can move freely from the underlying version/alias. This is super awesome because we've seen customers who accidentally create a like million message async invoke backlog, and event invoke config is a way to drain the backlog rapidly. If we were to put that object onto a version, which is immutable, then a customer would have to override their deployment systems to move the alias for "live" extremely forward in time to $LATEST potentially.

Again, it's technically correct today: all options in event invoke config are optional and you can attach an event invoke config to an alias, so this works out. The two, over time, will diverge in responsibilities due to their degrees of freedom that Lambda team intentionally decided to separate at an object level and it sparks a saddened emotion to see them tied together.

@SomayaB SomayaB added the @aws-cdk/aws-lambda Related to AWS Lambda label Mar 25, 2020
@SomayaB SomayaB added the feature-request A feature should be added or improved. label Mar 25, 2020
@nija-at nija-at added the effort/medium Medium work item – several days of effort label Mar 25, 2020
@nija-at nija-at added the p1 label Aug 18, 2020
@nija-at
Copy link
Contributor

nija-at commented Aug 24, 2020

@iph -

An event config you can move freely from the underlying version/alias. This is super awesome because we've seen customers who accidentally create a like million message async invoke backlog, and event invoke config is a way to drain the backlog rapidly.

I have a follow up question about your statement here.

According to the CloudFormation documentation on EventInvokeConfig, updates to the FunctionName or the Qualifier attributes require replacement, i.e., recreates the underlying resource.
Can a CloudFormation user actually move the event invoke config from one qualifier to the other?

On the other hand, the lambda APIs have the UpdateFunctionEventInvokeConfig API separate from the PutFunctionEventInvokeConfig API that likely allows a user to do what you describe, i.e., point the event invoke config at a different qualifier on the same function.

@nija-at
Copy link
Contributor

nija-at commented Sep 1, 2020

Summarizing the conversation with @iph over another channel

There is no 'state' stored in an event invoke config, so the Put API and the Update API are really the same thing.

nija-at pushed a commit that referenced this issue Sep 1, 2020
Event invoke config was incorrectly modeled as properties of a function,
version or alias. This is an incorrect relationship as described in #6966.

closes #6966
@github-actions
Copy link

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda Related to AWS Lambda closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants