Replies: 4 comments
-
The current use case is for a migration from SAM to CDK. Is it possible to get the CDK artifact bucket/key for the lambda source code to input to a CfnFunction. After being imported, the CfnFunction constructs have hard-coded references to the currently deployed S3 object key.
|
Beta Was this translation helpful? Give feedback.
-
Yes it would be possible but you will need to bake the CfnFunction yourself and you lose all the benefits of lambda.Function L2. Do you have any errors? |
Beta Was this translation helpful? Give feedback.
-
You should try to use L2 whenever possible. For example, you can create a lambda.Function with dummy inline assets. // create a dummy lambda func
const lambda = new cdk.aws_lambda.Function(this, 'lambda', {
runtime: cdk.aws_lambda.Runtime.NODEJS_20_X,
code: cdk.aws_lambda.Code.fromInline('dummy'),
handler: 'index.handler',
});
(lambda.node.defaultChild as lambda.CfnFunction).addPropertyOverride('Code', {
'S3Bucket': 'your-bucket-name',
'S3Key': 'your-s3-key',
}) |
Beta Was this translation helpful? Give feedback.
-
They aren't sure that converting to L2 Lambda constructs would help here. They still need the s3 bucket and key, which is the center of the problem. They are not able to retrieve the s3 bucket and key of the lambda code when using Unfortunately they can't use the Stage construct to insert the TestStack resulting in them being stuck on the prepare/deploy actions. The goal of this initial push to CDK is to simply be able to deploy all of the resources generated by |
Beta Was this translation helpful? Give feedback.
-
Hi Team,
Is there a way to use
new CodePipeline()
to simplify having the artifact s3 bucket and key for use in the CfnFunction calls in TestStack?So far I have this:
new CodePipeline() is a construct and retrievable properties are these:
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.pipelines.CodePipeline.html#properties
I have an issue where they building the whole pipeline piece by piece instead of using
new CodePipeline()
The problem is that they have to create all the policies and resources individually to just have the s3 bucket and key for use in the CfnFunction calls in TestStack.
Beta Was this translation helpful? Give feedback.
All reactions