I have a Lambda with an alias, but the Lambda code changes frequently, and I’m trying to figure out a way to have the Lambda version up to date and keep the alias pointing to the latest version, (without messing with things in the console, I want to keep everything in the CDK).
The Lambda:
lambda_fn = _lambda.Function(
self,
"MainLambda",
runtime=_lambda.Runtime.PYTHON_3_12,
handler="main.handler",
memory_size=1024,
vpc=vpc,
security_groups=[sg_vidual_lambda],
vpc_subnets=ec2.SubnetSelection(
subnet_type=ec2.SubnetType.PRIVATE_ISOLATED
),
environment=env_vars,
timeout=Duration.seconds(30),
role=multi_service_role,
code=_lambda.Code.from_bucket(
bucket=packages_bucket, key="deployment_package.zip"
),
)
The alias:
lambda_alias = _lambda.Alias(
self,
"MainLambdaAlias",
alias_name="DEV",
version=lambda_fn.current_version,
provisioned_concurrent_executions=1,
)
Is there a convenient way of publishing
1