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

Unable to create a Lambda Alias to version $LATEST #2776

Closed
igilham opened this issue Jun 6, 2019 · 0 comments · Fixed by #2792 or MechanicalRock/tech-radar#14 · May be fixed by MechanicalRock/cdk-constructs#5, MechanicalRock/cdk-constructs#6 or MechanicalRock/cdk-constructs#7

Comments

@igilham
Copy link
Contributor

igilham commented Jun 6, 2019

CloudFormation supports an AWS::Lambda::Alias with a FunctionVersion of $LATEST.

"LambdaAlias": {
        "Properties": {
            "FunctionName": {
                "Ref": "LambdaFunction"
            },
            "FunctionVersion": "$LATEST",
            "Name": "PROD"
        },
        "Type": "AWS::Lambda::Alias"
    }
}

I can find no way to achieve the same using the abstractions provided by the AWS CDK using either lambda.Alias or lambda.CfnAlias (which has no documentation at present).

new lambda.Alias(this, 'FunctionAlias', {
    aliasName: environmentParam.ref,
    version: '$LATEST', // error
})

The CDK seems to assume that I need to build a lambda.Version, but this is not what I want for my use case.

@igilham igilham added the gap label Jun 6, 2019
RomainMuller added a commit that referenced this issue Jun 7, 2019
Sometimes, one wants to create an `Alias` to the `$LATEST` version of a
`Function`, but this requires access to an `IVersion` representing that.
This features adds a `latestVersion` property to `IFunction` that offers
simple access to `$LATEST`. Prior to this, each user needing to access
this would have had to roll theiw own implementation of `IVersion`,
which is rather cumbersome.

Fixes #2776
rix0rrr pushed a commit that referenced this issue Jun 12, 2019
Sometimes, one wants to create an `Alias` to the `$LATEST` version of a
`Function`, but this requires access to an `IVersion` representing that.
This features adds a `latestVersion` property to `IFunction` that offers
simple access to `$LATEST`. Prior to this, each user needing to access
this would have had to roll theiw own implementation of `IVersion`,
which is rather cumbersome.

Fixes #2776
ScOut3R pushed a commit to ScOut3R/aws-cdk that referenced this issue Jun 13, 2019
Sometimes, one wants to create an `Alias` to the `$LATEST` version of a
`Function`, but this requires access to an `IVersion` representing that.
This features adds a `latestVersion` property to `IFunction` that offers
simple access to `$LATEST`. Prior to this, each user needing to access
this would have had to roll theiw own implementation of `IVersion`,
which is rather cumbersome.

Fixes aws#2776
This was referenced Dec 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment