I'm creating a pipeline which creates a CloudFormation Stack, deploy my code to the instance and destroy the CloudFormation Stack at the end (Whether the pipeline fails or successfully completes).
But before destroying the stack I want to copy the logs of Jenkins and save them in amazon-S3. I'm able to successfully create the stack and delete it. But not sure how to copy logs to amazon-s3.
I'm using Jenkins2
This way the stack gets created with a custom lambda resource which will upload the logs by the executing the script in the instance upon deletion of the stack.