PolarSPARC

Essential Cloud Infrastructure: Core Services - Summary Notes - Part 2


Bhaskar S 11/02/2019


Storage and Database Services

Cloud Storage

Cloud SQL

Cloud Spanner

Cloud Firestore

Cloud Bigtable

Cloud Memorystore

Hands-on with Cloud Storage

Download a sample file from the Internet using curl

curl http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/ClusterSetup.html > setup.html

Create a Cloud Storage Bucket called my-ps-bucket-01

gsutil mb gs://my-ps-bucket-01

Copy the downloaded setup.html to the Bucket my-ps-bucket-01

gsutil cp setup.html gs://my-ps-bucket-01

The following will be the typical output:

Output.1

Copying file://setup.html [Content-Type=text/html]...
/ [1 files][ 56.5 KiB/ 56.5 KiB]
Operation completed over 1 objects/56.5 KiB.

Get the default ACL for the Object setup.html from the Bucket my-ps-bucket-01

gsutil acl get gs://my-ps-bucket-01/setup.html

The following will be the typical output:

Output.2

[
  {
    "entity": "project-owners-874190793151",
    "projectTeam": {
      "projectNumber": "874190793151",
      "team": "owners"
    },
    "role": "OWNER"
  },
  {
    "entity": "project-editors-874190793151",
    "projectTeam": {
      "projectNumber": "874190793151",
      "team": "editors"
    },
    "role": "OWNER"
  },
  {
    "entity": "project-viewers-874190793151",
    "projectTeam": {
      "projectNumber": "874190793151",
      "team": "viewers"
    },
    "role": "READER"
  },
  {
    "email": "student-00-8509ae9e0f48@qwiklabs.net",
    "entity": "user-student-00-8509ae9e0f48@qwiklabs.net",
    "role": "OWNER"
  }
]

Set the ACL to private for the Object setup.html in the Bucket my-ps-bucket-01

gsutil acl set private gs://my-ps-bucket-01/setup.html

The following will be the typical output:

Output.3

Setting ACL on gs://my-ps-bucket-01/setup.html...
/ [1 objects]
Operation completed over 1 objects.

Once again, get the ACL for the Object setup.html from the Bucket my-ps-bucket-01

gsutil acl get gs://my-ps-bucket-01/setup.html

The following will be the typical output:

Output.4

[
  {
    "email": "student-00-8509ae9e0f48@qwiklabs.net",
    "entity": "user-student-00-8509ae9e0f48@qwiklabs.net",
    "role": "OWNER"
  }
]

Update the ACL to make the Object setup.html in the Bucket my-ps-bucket-01 publicly readable

gsutil acl ch -u AllUsers:R gs://my-ps-bucket-01/setup.html

The following will be the typical output:

Output.5

Updated ACL on gs://my-ps-bucket-01/setup.html

Once again, get the ACL for the Object setup.html from the Bucket my-ps-bucket-01

gsutil acl get gs://my-ps-bucket-01/setup.html

The following will be the typical output:

Output.6

[
  {
    "email": "student-00-8509ae9e0f48@qwiklabs.net",
    "entity": "user-student-00-8509ae9e0f48@qwiklabs.net",
    "role": "OWNER"
  },
  {
    "entity": "allUsers",
    "role": "READER"
  }
]

Get the Lifecycle Management policy on the Bucket my-ps-bucket-01

gsutil lifecycle get gs://my-ps-bucket-01

The following will be the typical output:

Output.7

gs://my-ps-bucket-01/ has no lifecycle configuration.

Create a lifecycle policy file called lifecycle.json with the following contents:

lifecycle.json
{
  "rule":
  [
    {
      "action": {"type": "Delete"},
      "condition": {"age": 31}
    }
  ]
}

Set the Lifecycle Management policy on the Bucket my-ps-bucket-01 using the policy file lifecycle.json

gsutil lifecycle set lifecycle.json gs://my-ps-bucket-01

The following will be the typical output:

Output.8

Setting lifecycle configuration on gs://my-ps-bucket-01/...

Once again, get the Lifecycle Management policy on the Bucket my-ps-bucket-01

gsutil lifecycle get gs://my-ps-bucket-01

The following will be the typical output:

Output.9

{"rule": [{"action": {"type": "Delete"}, "condition": {"age": 31}}]}

Get the Versioning status on the Bucket my-ps-bucket-01

gsutil versioning get gs://my-ps-bucket-01

The following will be the typical output:

Output.10

gs://my-ps-bucket-01: Suspended

Enable Versioning on the Bucket my-ps-bucket-01

gsutil versioning set on gs://my-ps-bucket-01

The following will be the typical output:

Output.11

Enabling versioning for gs://my-ps-bucket-01/...

Once again, get the Versioning status on the Bucket my-ps-bucket-01

gsutil versioning get gs://my-ps-bucket-01

The following will be the typical output:

Output.12

gs://my-ps-bucket-01: Enabled

Once again, copy the downloaded setup.html to the Bucket my-ps-bucket-01

gsutil cp setup.html gs://my-ps-bucket-01

The following will be the typical output:

Output.13

Copying file://setup.html [Content-Type=text/html]...
Created: gs://my-ps-bucket-01/setup.html#1572201130871188
Operation completed over 1 objects/56.1 KiB.

List all the versions of setup.html in the Bucket my-ps-bucket-01

gsutil ls -a gs://my-ps-bucket-01/setup.html

The following will be the typical output:

Output.14

gs://my-ps-bucket-01/setup.html#1572199690809910
gs://my-ps-bucket-01/setup.html#1572201130871188

References

Coursera - Essential Cloud Infrastructure: Core Services

Essential Cloud Infrastructure: Core Services - Summary Notes - Part 1



© PolarSPARC