0
0
GCPcloud~20 mins

Storage commands (gsutil) in GCP - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
gsutil Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
Understanding gsutil cp behavior with directories

You run the command gsutil cp -r ./localdir gs://my-bucket/backup/. What will be the result in the bucket?

AOnly the files in the root of <code>localdir</code> will be copied, subfolders will be ignored.
BAll files inside <code>localdir</code> will be copied directly into <code>backup/</code> without creating a <code>localdir</code> folder.
CA new folder named <code>localdir</code> will be created inside <code>backup/</code> with all files copied inside it.
DThe command will fail because <code>gsutil cp</code> does not support recursive copying.
Attempts:
2 left
💡 Hint

Think about how gsutil cp -r handles directory structures when copying.

Configuration
intermediate
2:00remaining
Setting ACLs with gsutil

You want to make all objects in gs://my-bucket/data/ publicly readable using gsutil. Which command achieves this?

Agsutil acl set public-read gs://my-bucket/data/**
Bgsutil iam ch allUsers:objectViewer gs://my-bucket/data
Cgsutil set-acl public-read gs://my-bucket/data
Dgsutil acl ch -u AllUsers:R gs://my-bucket/data/**
Attempts:
2 left
💡 Hint

Consider the difference between ACLs and IAM policies in gsutil.

Architecture
advanced
2:00remaining
Optimizing gsutil for large data transfers

You need to upload 10 TB of data to a bucket quickly. Which gsutil option helps maximize upload speed?

AUse <code>gsutil cp -m</code> to enable multi-threaded uploads.
BUse <code>gsutil cp --quiet</code> to reduce output and speed up uploads.
CUse <code>gsutil rsync</code> without any flags for faster transfer.
DUse <code>gsutil cp -r</code> to recursively upload files in parallel.
Attempts:
2 left
💡 Hint

Think about how gsutil can upload multiple files at once.

security
advanced
2:00remaining
Preventing accidental deletion with gsutil

You want to prevent accidental deletion of objects in your bucket using gsutil. Which feature should you enable?

AEnable Object Versioning on the bucket.
BUse <code>gsutil rm -n</code> to simulate deletions.
CSet bucket IAM policy to deny delete permissions.
DUse <code>gsutil cp -n</code> to prevent overwriting.
Attempts:
2 left
💡 Hint

Think about how to recover deleted objects.

Best Practice
expert
3:00remaining
Efficiently syncing local and cloud storage with gsutil

You want to keep a local directory and a bucket folder in sync, copying only changed files and deleting removed files in the bucket. Which gsutil command and flags achieve this?

Agsutil cp -m -r ./localdir gs://my-bucket/folder
Bgsutil rsync -d -r ./localdir gs://my-bucket/folder
Cgsutil rsync -r ./localdir gs://my-bucket/folder
Dgsutil cp -n -r ./localdir gs://my-bucket/folder
Attempts:
2 left
💡 Hint

Consider how to delete files in the destination that no longer exist in the source.