Ir al contenido principal

Entradas

Mostrando las entradas etiquetadas como Storage

Unique bucket names in Google Cloud Storage

One interesting thing about Google Cloud Storage buckets, that maybe not all people is aware of, is that their name is unique at Google Cloud Storage level (and not at project level, as most of us would assume). That means that a bucket name must be unique at global level, and that is a problem as some of the names we choose may already exist. The way Google Cloud recommends is creating the names of the buckets as subdomains of an owned domain. Google ensures that it will verify the domain property before creating the bucket. In that way nobody will be able to create buckets using our domain and, therefore, our buckets will become unique at Google Cloud level. For multisite projects, it is also a good idea to add the bucket location to the name, so equivalent buckets could coexist in different locations. Examples of that exposed would be: mybucket.mydomain.net for a global "mybucket" bucket associated to our domain "mydomain.net" mybucke...

Google Cloud Storage: List files with wildcards

One of the most fustrating things when using Google Cloud Storage is not being able to search files using wildcards: Google Cloud web interface only allows stating a file prefix, what in many cases is not enough. Luckly, Google Cloud SDK gsultil ls , also available throught the Google Cloud Console, allows listing storage bucket contents using wildcards. Let's see some examples: Listing all the available buckets gsutil ls Listing a specific bucket content gsutil ls gs://my_bucket Listing, in a specific bucket, all the files matching a classic wilcard pattern As usual, * symbol matches zero or more characters, ? symbol matches only one character. gsutil ls gs://my_bucket/foo*.json gsutil ls gs://my_bucket/*bar.json gsutil ls gs://my_bucket/foo*bar.json gsutil ls gs://my_bucket/foo*.jso? Listing, in a specific bucket, content matching advanced wilcard pattern A set of characters into brackets matches all the filenames that has one of those characters. For i...