aws cli command output as value in cloudformation template

0 votes

I have an independent lambda layer, the arn is retrieved using the below CLI command.

aws lambda list-layer-versions --layer-name my-custom-lambda-layer --region us-east-1 --query 'LayerVersions[0].LayerVersionArn'

How can I refer this output to my cloud formation template, like below,

Resources:
  Parameters:
    MYLAYERARN: $(aws lambda list-layer-versions --layer-name my-custom-lambda-layer --region us-east-1 --query 'LayerVersions[0].LayerVersionArn')

Or use it directly in any of my lambda function as below,

Resources:
  MyLambdaFuntion:
    handler: Hello.lambda_handler
    timeout: 60
    memorySize: 256
    layers:
      - $(aws lambda list-layer-versions --layer-name my-custom-lambda-layer --region us-east-1 --query 'LayerVersions[0].LayerVersionArn')

Currenlty it is not executing the AWS CLI command, but taking the CLI command as the value

Jan 9, 2023 in AWS by Ashwini
• 5,430 points

edited 5 days ago 11 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP