title: How Can I Load The Output of AWS Cloudformation In AWS Lambda?
body: <p>Hi I have a cloudformation stack which creates a couple of ec2 instances. And I'm planing to use aws lambda to ssh into those ec2 instance to manage them.</p>
  <p>I need to provide my aws lambda function with the ip address of those ec2 instance. I need to delete the stack and re-run for testing purpose. So the instances' ip address are different every time when I re-run the cloudformation stack. I can't hardcode or set those ip address as environment variable for my aws lambda function.</p>
  <p>The stack's name will be the same. And I set up the cloudformation stack to output the ip address of each ec2 instance. Thus, I think I can use the stack name as the reference to let my aws lambda function to access and load its output to achieve this goal.</p>
  <p>I found a similar post: <a href="https://stackoverflow.com/questions/35781529/aws-lambda-read-parameter-or-outputs-from-cloudformation/35826223">AWS lambda read parameter or outputs from CloudFormation</a> saying this.</p>
  <p>But he only described &quot;Grant your Lambda function cloudformation:DescribeStacks permission to read outputs of your CloudFormation stack and load this output in your code at runtime&quot;.</p>
  <p>Could someone provide me more specific steps about how to load in aws lambda? I can't find any aws docs about this so could someone please help me?</p>
  <p>Thanks a lot!</p>