title: write StackId to S3 using Lambda
body: <p>Im using create_stack api using AWS Lambda(with nested stack)..but i would like to store each stack Id in S3 which is created as part of nested stack.
  Im using python for Lambda function.</p>
  
  <p>Whenever a individual stack is created as part of nested stack(cloudformation) it appends each stack with unique Id as below</p>
  
  <p>MYnestedStack-Ec2Stack-1WQDHSJFIFNFN</p>
  
  <p>i want to store this value in S3 bucket so that i can use that Id to delete the stack without manually going to AWS cloudformation console to delete the same..</p>
  
  <p>I have tried as suggested by @ataylor below but im getting error </p>
  
  <p><strong>"An error occurred during JSON serialization of response: datetime.datetime(2016, 7, 12, 15, 23, 16, 451000, tzinfo=tzlocal()) is not JSON serializable"</strong></p>
  
  <pre><code>import boto3
  import time
  import json
  
  client = boto3.client('cloudformation')
  
  
  response = client.describe_stack_resources(
      StackName='Mystack',
      LogicalResourceId='Ec2Stack'
  )
  
  def lambda_handler(event, context):
          return response
  </code></pre>
  
  <p>I have also tried below code and getting error as</p>
  
  <p><strong>"An error occurred during JSON serialization of response: cloudformation.StackResource(stack_name='Mystack', logical_id='Ec2Stack') is not JSON serializable"</strong></p>
  
  <pre><code>import boto3
  import time
  import json
  
  cloudformation = boto3.resource('cloudformation')
  stack_resource = cloudformation.StackResource('prodUpgradeForchestartorFullStack','ApplicationStack')
  
  def lambda_handler(event, context):
          return stack_resource
  </code></pre>
  
  <p>Please Suggest!!</p>