Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the ARN of an AWS-CDK delivery stream construct

I am creating a CfnDeliveryStream in CDK and I would like to use the ARN later in an IAM role. I found the attribute attrArn, but it is undocumented. My question is: how do I access the ARN of a delivery stream (similar to what is available in S3 constructs).

Thanks, Benni

like image 779
Benni Avatar asked Oct 26 '25 06:10

Benni


1 Answers

You can use the following syntax -

const resourceARN = cdk.Fn.getAtt(%ID_YOU_WANT_TO_GET%, "Arn").toString();

Usage:

    const lambdaFunction = new sam.CfnFunction(scope, "myLambdaID", {
      functionName: name,
      runtime: 'nodejs10.x',
      codeUri: {
        bucket: lambdaAssest.s3BucketName,
        key: lambdaAssest.s3ObjectKey
      },
      handler: handler,
      timeout: timeout,
      autoPublishAlias : `current`
    });

    const lambdaARN = cdk.Fn.getAtt( lambdaFunction.logicalId, "Arn").toString();

To verify the ARN, use cdk.CfnOutput -

new cdk.CfnOutput(scope, `output-arn`, { value: lambdaARN });
like image 101
Amit Baranes Avatar answered Oct 29 '25 07:10

Amit Baranes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!