You are creating a solution to remove backup files older than 90 days from your backup Cloud Storage bucket. You want to optimize ongoing Cloud Storage spend. What should you do?
A.
Write a lifecycle management rule in XML and push it to the bucket with gsutil
B.
Write a lifecycle management rule in JSON and push it to the bucket with gsutil
C.
Schedule a cron script using gsutil ls ג€"lr gs://backups/** to find and remove items older than 90 days
D.
Schedule a cron script using gsutil ls ג€"l gs://backups/** to find and remove items older than 90 days and schedule it with cron
All four are correct answers. Google has built in cron job schduling with Cloud Schedule, so that would place "D" behind "C" in Google's perspective. Google also has it's own lifecycle management command line prompt gcloud lifecycle so "A" or "B" could be used. JSON is slightly faster than XML because of the "{" verse "<c>" distinguisher, with a Trie tree used for alphanumeric parsing. So between "A" and "B", choose "B". Between "B" and "A", "B" is slightly more efficient from the GCP operator perspective. So choose "B".
gsutil command takes only json as input for lifecycle management. In case of API, both XML and json can be used.
https://cloud.google.com/storage/docs/gsutil/commands/lifecycle
https://cloud.google.com/storage/docs/xml-api/put-bucket-lifecycle
https://cloud.google.com/storage/docs/json_api/v1/buckets/update
I'll go with B.
A is not reasonable because life cycle policies are not written in XML.
B is reasonable and is cloud native.
C requires a cron script which needs something to run the script and is a non-cloud native approach.
D requires a cron script which needs something to run the script and is a non-cloud native approach.
1. Lifecycle Management: Google Cloud Storage offers built-in lifecycle management rules specifically designed for automated data retention and deletion. This is the most efficient and cost-effective way to manage your backup files.
2. JSON Format: Lifecycle rules are defined in JSON format.
3. gsutil: The gsutil command-line tool is used to interact with Cloud Storage, including setting lifecycle configuration.
Cloud Storage has lifecycle management rules and could be applied with gsutil and gcloud storage buckets. It is common to use JSON for transferring data.
To remove backup files older than 90 days from a Cloud Storage bucket and optimize ongoing Cloud Storage spend, you should consider writing a lifecycle management rule in JSON and pushing it to the bucket with gsutil, as described in option B.
Lifecycle management rules allow you to automatically delete objects from a Cloud Storage bucket based on age or other criteria, such as the object's storage class. By writing a rule in JSON and pushing it to the bucket with gsutil, you can specify that objects older than 90 days should be deleted, ensuring that the bucket only contains current backup files and minimizing Cloud Storage spend.
Option A, C and D would not be suitable for this use case, as they do not allow you to specify lifecycle management rules that delete objects based on age.
B. Write a lifecycle management rule in JSON and push it to the bucket with gsutil
To remove backup files older than 90 days from a Cloud Storage bucket, you can use the lifecycle management feature in Cloud Storage. This feature allows you to specify rules to automatically delete objects based on their age.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Eroc
Highly Voted 5 years agoghitesh
4 years, 10 months agotartar
4 years, 3 months agonitinz
3 years, 8 months agoclouddude
Highly Voted 4 years, 6 months agoEkramy_Elnaggar
Most Recent 1 week, 5 days agoHungdv
3 months, 2 weeks agosquishy_fishy
1 year agoeka_nostra
1 year, 4 months agoalekonko
1 year, 8 months agoomermahgoub
1 year, 11 months agoi_am_robot
1 year, 11 months agoMelampos
1 year, 11 months agoBry_040706
1 year, 12 months agoAniketD
2 years agomegumin
2 years agoMahmoud_E
2 years, 1 month agozr79
2 years, 1 month agoAzureDP900
2 years, 1 month agominmin2020
2 years, 1 month ago