This is such a tiny project and yet so useful, at least to us. CodePipeline needs a Bucket to store temporary files for each stage in a Pipeline. The problem is that after a while you end up with GB of data that is costing you money and wasting unnecessary space. The simple solution is to add a Life Time Policy to the bucket, but we kept having the following recurring issues:
- Forgetting how to name the bucket in a meaningful way that is organized.
- Forgetting to add the region in the name of the bucket.
- Enable a life time policy which would remove artifacts after 24h.
So yes, this stack will literally make one bucket with a standardized name, and one life time policy which deletes any object after 24h.
We now deploy this stack for each AWS Account that has CodePipeline - and we don't have to think about it anymore. If this helps us be more organize, and spend less – maybe it will help you to.
This stack is available to anyone at no cost, but on an as-is basis. 0x4447, LLC is not responsible for damages or costs of any kind that may occur when you use the stack. You take full responsibility when you use it.
Why don't you include a CodePipeline bucket to the main CloudFormation file?
Because we would end up having dozens of buckets just to store this temporary files. You can just have one, and use it's name when you deploy the main stack - so those multiple pipelines can use a single bucket.
This is it?
Yes it is :)
To deploy this stack, all you need to do is click the button to the left and follow the instructions that CloudFormation provides in your AWS Dashboard. Alternatively, you can download the CF file from here.
The stack takes advantage of just S3.
- 1x S3 Bucket with a life time policy.
Standard S3 Pricing applies.
When you want to deploy the stack, the only file you should be interested in is the CloudFormation.json
file. If you'd like to modify the stack, we recommend that you use the Grapes framework, which was designed to make it easier to work with the CloudFormation file. If you'd like to keep your sanity, never edit the main CF file 🤪.
If you enjoyed this project, please consider giving it a 🌟. And check out our 0x4447 GitHub account, where you'll find additional resources you might find useful or interesting.
This project is brought to you by 0x4447 LLC, a software company specializing in building custom solutions on top of AWS. Follow this link to learn more: https://0x4447.com. Alternatively, send an email to [email protected].