Cloud Storage Quickstart
Welcome to Google Cloud Storage!
Powerful and cost-effective storage solution for unstructured objects.
Hosting live web content to storing data for analytics to archiving and backup.
Create a bucket
Buckets hold the objects (any type of file) you want to store in Cloud Storage.
Upload and share objects
Start using your bucket by uploading an object and making it publicly available.
Create a bucket
In Cloud Storage, you store your objects in buckets. To create a bucket, you need to go to the Cloud Storage browser. Then select Buckets.
Create a bucket
Before you can start uploading objects, you need to create a "bucket" to store them in.
Buckets help you organize your objects and control access to them.
Click Create bucket
On the bucket creation page, specify the bucket's properties.
Note: Selected Region to keep costs down
Unchecked Enforce public access prevention to allow for web access
Name: Think of something unique. You'll see an error if you enter a name that's
the same as another bucket's name in Cloud Storage.
Default storage class:This is the storage class assigned to your bucket's objects by default.
Your choice depends mainly on how frequently you expect the objects to be accessed and whether you're serving the data worldwide. The storage class affects your cost.
Location: You'll want to keep your data close to the applications and users accessing it. The available choices depend on your storage class selection.
Click Create
Once we have a bucket create we need to allow all users viewing access. Click on permissions.
Allow public access of bucket GRANT ACCESS Allusers
For Assign roles use Cloud storage and Storage Object Viewer
Then Save
The storage Bucket is now public for all users to access via browsers
.
Note: When an object is shared publicly, any user with knowledge of the object
URI can access the object for as long as the object is public.
Once bucket is public we can now upload files that can be viewed
Click into bucket name uconn-stamford-web
We can create an html file locally or on our cloud shell
Locally
Use notepad to create a file
Save file on Desktop as first.html
Now you can upload it to your Cloud Storage UPLOAD FILES
Select the file you want to upload and click open
File will now appear in the bucket
Click on file and you can see the URL link to the web page
Using Cloud Shell
Access your cloud shell
Make a directory for your web site.
admin_@cloudshell:~ (sentiment-analysis-379200)$ mkdir website
john_iacovacci1@cloudshell:~ (uconn-engr)$ mkdir website
Go into Open Editor
Make sure the directory that was just created is highlighted
Create a file called example.html
<!DOCTYPE html>
<html>
<head>
<title>Example Web Page
</title>
</head>
<body>
This is an Example of a Web Page
</body>
</html>
Then go to file menu and hit save
It will create the file called example.html in your website directory
Go back to your terminal via Open terminal button
Use the gsutil command to copy the newly created page to your storage bucket
Make sure you are in the directory where the file is located
admin_@cloudshell:~ (sentiment-analysis-379200)$ cd website
admin_@cloudshell:~/website (sentiment-analysis-379200)$
And the file is in the directory
admin_@cloudshell:~/website (sentiment-analysis-379200)$ ls -lt example.html
-rw-r--r-- 1 admin_ admin_ 156 Sep 2 19:13 example.html
admin_@cloudshell:~/website (sentiment-analysis-379200)$
Then use the gsutil command to copy the file to your cloud storage bucket
admin_@cloudshell:~/website (sentiment-analysis-379200)$ gsutil cp example.html gs://uconn-stamford-web/
Copying file://example.html [Content-Type=text/html]...
/ [1 files][ 156.0 B/ 156.0 B]
Operation completed over 1 objects/156.0 B.
admin_@cloudshell:~/website (sentiment-analysis-379200)$
Go back to your cloud storage bucket
Click into example.html
Then the public url
gsutil tool
gsutil is a Python application that lets you access Cloud Storage from the command line. You can use gsutil to do a wide range of bucket and object management tasks, including:
Creating and deleting buckets.
Uploading, downloading, and deleting objects.
Listing buckets and objects.
Moving, copying, and renaming objects.
Editing object and bucket ACLs.
No comments:
Post a Comment