MarkEdmondson1234 / googleCloudRunner

Easy R scripts on Google Cloud Platform via Cloud Run, Cloud Build and Cloud Scheduler
https://code.markedmondson.me/googleCloudRunner/
Other
81 stars 26 forks source link

cr_deploy_plumber need for permanent Bucket storage (and cost)? #144

Closed dcaud closed 2 years ago

dcaud commented 2 years ago

Hi. I'm seeing some new charges for bucket storage and I believe they are a result of cr_deploy_plumber() adding data to a bucket. A couple questions:

  1. If I delete that bucket will a Plumber API deployed via cr_deploy_plumber still work? I'm thinking that the bucket is just needed for the Cloud Build portion of things to run, and then the permanent storage for things in Cloud Run is stored elsewhere. But I don't know!

  2. Is there a way to programmatically delete unused and unneeded items in the bucket that cr_deploy_plumber created?

Ultimately, I want to reduce storage costs so I am trying to figure out what I can delete.

MarkEdmondson1234 commented 2 years ago
  1. You can delete it safely after deployment, it's used only as the code source for deployment. I usually use the GitHub source instead, but can't assume everyone has GitHub so use cloud storage. You can see some explanation in the cr_build discussion on sources on the website.
MarkEdmondson1234 commented 2 years ago
  1. You could add a step to the cloud build to delete the storage bucket afterwards, or make your own deployment using GitHub by customizing the build yaml. cr_deploy are convenient to get you going but for custom stuff create your own via the underlying build steps.

But if it's cloud storage costs as the reason, it's likely to only be under $1 a year to store the app data unless you have GBs of included data in your app.

dcaud commented 2 years ago

Thanks! Both of those options sound like good ideas. It seemed to me that each new deployment of a plumber API was taking up approx. 2 GB (and there was no data included in the app). So, I was worried that launching say, 20 APIs, would rack up some substantial costs. The time it would take to delete the bucket is probably not worth the < $1/year that it would cost to just let it stay up. Thanks again!!

MarkEdmondson1234 commented 2 years ago

It depends a bit what type of bucket but looking here https://cloud.google.com/storage/pricing 20GB looks to be around $0.50 a month. So more like $6 for a year.