Posts

Showing posts with the label amazon-cloudformation

How do I set a TTL in an AWS SAM template for lambda?

How do I set a TTL in an AWS SAM template for lambda? Cloudformation has this feature where you can set a TTL which triggers a command that deletes the stack: https://aws.amazon.com/blogs/devops/scheduling-automatic-deletion-of-application-environments/ Is there a way to do something similar with AWS lambda SAM template? I want some dev lambdas to be automatically deleted after an expiration period I set. 1 Answer 1 AWS SAM is just syntactic sugar on top of CloudFormation. You can use arbitrary CloudFormation resources in SAM templates as well, so the linked solution should work the same way when using SAM. Just include the linked CloudFormation template in your SAM template. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website...

Can terraform tf file or module automatically expire resources?

Can terraform tf file or module automatically expire resources? In cloudformation you can set a TTL on a stack that runs a command which deletes the stack: https://aws.amazon.com/blogs/devops/scheduling-automatic-deletion-of-application-environments/ How do I do this in a TF file? OR maybe I could have a script that gets the create time of a tf file (the state file), compare that with the current time and do a destroy? that might work too Cloudformation itself doesn't have a way of self terminating at some specific time. That link shows a Cloudformation template that creates an instance that tears down the stack using at to run a script to delete the stack at a specific time. You could use the same principle with Terraform as long as your Terraform config created an instance with permissions and configuration to be able to do that. – ydaetskcoR Jul 2 at 13:09 ...