Im using AWS lambda(using python 2.7) to invoke StackResource api to get the Stack Id of the resource created as part of nested stack .Im getting below error
"An error occurred during JSON serialization of response: cloudformation.StackResource(stack_name='Mystack', logical_id='Ec2Stack') is not JSON serializable"
import boto3
import time
import json
cloudformation = boto3.resource('cloudformation')
stack_resource = cloudformation.StackResource('prodUpgradeForchestartorFullStack','ApplicationStack')
def lambda_handler(event, context):
return stack_resource
i have tried describe_stack_resources api which gives below error
"An error occurred during JSON serialization of response: datetime.datetime(2016, 7, 12, 15, 23, 16, 451000, tzinfo=tzlocal()) is not JSON serializable"
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
Please suggest!