{"id":6924,"date":"2021-04-14T15:51:56","date_gmt":"2021-04-14T08:51:56","guid":{"rendered":"http:\/\/gcloudvn.wam.vn\/cach-dua-du-lieu-vao-cloud-storage\/"},"modified":"2023-12-11T15:43:43","modified_gmt":"2023-12-11T08:43:43","slug":"cach-dua-du-lieu-vao-cloud-storage","status":"publish","type":"post","link":"https:\/\/gcloudvn.com\/en\/kienthuc\/cach-dua-du-lieu-vao-cloud-storage\/","title":{"rendered":"5 ways to get your data into Cloud Storage"},"content":{"rendered":"<p style=\"text-align: justify;\">Once you have created it <a href=\"https:\/\/cloud.google.com\/blog\/topics\/developers-practitioners\/optimizing-your-bucket-options-cloud-storage\" rel=\"nofollow noopener\" target=\"_blank\">buckets <\/a>and now you want to use the power of the cloud to deliver your content. With the to-do attitude and insights of this post, you will learn how to get data into Cloud Storage using a variety of data upload methods.<\/p>\n<p style=\"text-align: justify;\">When you upload an object to the group <a href=\"https:\/\/gcloudvn.com\/en\/cloud-storage\/\">Storage Cloud<\/a> Your object will include the data you want to store, along with any associated metadata. When it comes to the actual upload, you have a few different options to choose from which we&#039;ll look at below. For more details, please <a href=\"https:\/\/cloud.google.com\/storage\/docs\/uploading-objects\" rel=\"nofollow noopener\" target=\"_blank\">Document Viewer<\/a>. And for general, conceptual information about uploading and downloading, <a href=\"https:\/\/cloud.google.com\/storage\/docs\/uploads-downloads\" rel=\"nofollow noopener\" target=\"_blank\">Please read this<\/a>.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_80 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/gcloudvn.com\/en\/kienthuc\/cach-dua-du-lieu-vao-cloud-storage\/#Bang_dieu_khien_dam_may_%E2%80%93_Cloud_Console\" >Cloud Console \u2013 Cloud Console<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/gcloudvn.com\/en\/kienthuc\/cach-dua-du-lieu-vao-cloud-storage\/#Cong_cu_gsutil\" >gsutil tool<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/gcloudvn.com\/en\/kienthuc\/cach-dua-du-lieu-vao-cloud-storage\/#Client_libraries\" >Client libraries<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/gcloudvn.com\/en\/kienthuc\/cach-dua-du-lieu-vao-cloud-storage\/#Vi_du\" >Eg:<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/gcloudvn.com\/en\/kienthuc\/cach-dua-du-lieu-vao-cloud-storage\/#JSON_and_XML\" >JSON and XML<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/gcloudvn.com\/en\/kienthuc\/cach-dua-du-lieu-vao-cloud-storage\/#Cloud_Storage_Transfer_Appliance\" >Cloud Storage Transfer Appliance<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/gcloudvn.com\/en\/kienthuc\/cach-dua-du-lieu-vao-cloud-storage\/#Nhieu_may_hon_nhieu_van_de_hon_Khong_phai_vay\" >More clouds, more problems? Not so!<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/gcloudvn.com\/en\/kienthuc\/cach-dua-du-lieu-vao-cloud-storage\/#Gio_thi_sao\" >So what now?<\/a><\/li><\/ul><\/nav><\/div>\n<h2 style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"Bang_dieu_khien_dam_may_%E2%80%93_Cloud_Console\"><\/span>Cloud Console \u2013 Cloud Console<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">The first thing to mention is the Cloud Console. This gives you an in-browser experience where you can easily click to create groups and folders, then select or drag and drop files from your local machine to upload.<\/p>\n<figure id=\"attachment_18603\" aria-describedby=\"caption-attachment-18603\" style=\"width: 700px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-18603 size-full\" src=\"https:\/\/gcloudvn.com\/wp-content\/uploads\/2021\/03\/google-cloud-console-example-bucket.jpg\" alt=\"Google cloud console example bucket\" width=\"700\" height=\"394\" \/><figcaption id=\"caption-attachment-18603\" class=\"wp-caption-text\"><em>Google cloud console example bucket<\/em><\/figcaption><\/figure>\n<p style=\"text-align: justify;\">Pro tip: folder uploads are also supported if you&#039;re using the Chrome browser.<\/p>\n<h2 style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"Cong_cu_gsutil\"><\/span>gsutil tool<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">For production environments, you may want an automated, command-line solution.<\/p>\n<p style=\"text-align: justify;\">For this, Google provides the gsutil tool. gsutil is a Python application that allows you to access Cloud Storage from the command line, giving you the ability to do all sorts of things like create buckets, move objects, or even edit metadata.<\/p>\n<p style=\"text-align: justify;\">To use it, run the gsutil program with many command line options. For example, this command uploads a folder of files from your local machine to your Cloud Storage bucket using parallel upload.<\/p>\n<p style=\"text-align: justify;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-18604 size-full\" src=\"https:\/\/gcloudvn.com\/wp-content\/uploads\/2021\/03\/gsutil-code-create-bucket.png\" alt=\"gsutil tool\" width=\"700\" height=\"184\" \/><\/p>\n<p style=\"text-align: justify;\">And this command lists specific objects with instance-specific URLs using wildcards.<\/p>\n<p style=\"text-align: justify;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-18605 size-full\" src=\"https:\/\/gcloudvn.com\/wp-content\/uploads\/2021\/03\/gsutil.png\" alt=\"gsutil tool 2\" width=\"700\" height=\"184\" \/><\/p>\n<p style=\"text-align: justify;\">You can find more interesting things you can do with the gsutil tool in <a href=\"https:\/\/cloud.google.com\/storage\/docs\/quickstart-gsutil\" rel=\"nofollow noopener\" target=\"_blank\">this document.<\/a><\/p>\n<h2 style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"Client_libraries\"><\/span><strong>Client libraries<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">At some point, you may need to interface with Cloud Storage directly from your code, rather than going outside a command line option. You can include client libraries in your code and call a simple api to get data into a bucket or folder.<\/p>\n<p style=\"text-align: justify;\">And before you ask about languages, with options in C++, C #, Go, Java, Node.js, PHP, Python and Ruby \u2014 we&#039;ve got you covered.<\/p>\n<h3 style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"Vi_du\"><\/span>Eg:<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p style=\"text-align: justify;\">Take a look at this Python code to upload an object to a Cloud Storage bucket:<\/p>\n<p style=\"text-align: justify;\">Language: Python<\/p>\n<pre>from google.cloud import storage def upload_blob(bucket_name, source_file_name, destination_blob_name): &quot;&quot;&quot;Uploads a file to the bucket.&quot;&quot;&quot; # bucket_name = &quot;your-bucket-name&quot; # source_file_name = &quot;local\/path\/to\/file &quot; # destination_blob_name = &quot;storage-object-name&quot; storage_client = storage.Client() bucket = storage_client.bucket(bucket_name) blob = bucket.blob(destination_blob_name) blob.upload_from_filename(source_file_name)<\/pre>\n<p style=\"text-align: justify;\">Check out more designs <a href=\"https:\/\/cloud.google.com\/storage\/docs\/uploading-objects#storage-upload-object-code-sample\" rel=\"nofollow noopener\" target=\"_blank\">here<\/a>.<\/p>\n<h2 style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"JSON_and_XML\"><\/span><strong>JSON and XML<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">And finally, if none of that does the trick, there&#039;s always the JSON and XML APIs, which can let you initiate an HTTP POST request to upload data directly to a bucket or directory. item. It&#039;s a bit more complicated, but there if you need it.<\/p>\n<pre>POST \/OBJECT_NAME HTTP\/2 Host: BUCKET_NAME.storage.googleapis.com Date: DATE Content-Length: REQUEST_BODY_LENGTH Content-Type: MIME_TYPE X-Goog-Resumable: start Authorization: AUTHENTICATION_STRING<\/pre>\n<h2 style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"Cloud_Storage_Transfer_Appliance\"><\/span><strong>Cloud Storage Transfer Appliance<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">Now, for those of you with a LOT of data, it&#039;s worth noting that uploading it all directly from your on-premises system <a href=\"https:\/\/gcloudvn.com\/en\/google-cloud-platform\/\">Google Cloud Platform<\/a> may not be possible \u2013 so you can use the Cloud Storage Transfer Tool.<\/p>\n<p><strong>&gt; Reference:<\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/gcloudvn.com\/en\/kienthuc\/top-5-nen-tang-dien-toan-dam-may-tren-thi-truong\/\">Top 5 cloud computing platforms on the market<\/a><\/li>\n<li><a href=\"https:\/\/gcloudvn.com\/en\/kienthuc\/cloud-cdn-la-gi-va-no-hoat-dong-nhu-the-nao\/\">What is a Cloud CDN and how does it work?<\/a><\/li>\n<li><a href=\"https:\/\/gcloudvn.com\/en\/kienthuc\/firebase-google-cloud-la-gi\/\">What is Firebase Google Cloud? Find out the features of this platform<\/a><\/li>\n<\/ul>\n<p style=\"text-align: justify;\">Google presents you with a device, you connect it, add your data and send it back to google. Plus, you can leave this fun-looking box on your desk for a while, which can be a great conversation starter, if you&#039;re into that sort of thing. <a href=\"https:\/\/cloud.google.com\/storage-transfer\/docs\/overview\" rel=\"nofollow noopener\" target=\"_blank\">More details here<\/a>.<\/p>\n<figure id=\"attachment_18606\" aria-describedby=\"caption-attachment-18606\" style=\"width: 400px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-18606 size-full\" src=\"https:\/\/gcloudvn.com\/wp-content\/uploads\/2021\/03\/google-cloud-storage.png\" alt=\"Cloud Storage Transfer Appliance\" width=\"400\" height=\"216\" \/><figcaption id=\"caption-attachment-18606\" class=\"wp-caption-text\"><em>Cloud Storage Transfer Appliance<\/em><\/figcaption><\/figure>\n<h2 style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"Nhieu_may_hon_nhieu_van_de_hon_Khong_phai_vay\"><\/span><strong>More clouds, more problems? Not so!<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">Don&#039;t worry if your data is in another cloud, Google has it <a href=\"https:\/\/cloud.google.com\/storage\/docs\/interoperability\" rel=\"nofollow noopener\" target=\"_blank\">instruct<\/a> easy to use to get you up and running with supporting multi-cloud environments and moving that data to Cloud Storage.<\/p>\n<h2 style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"Gio_thi_sao\"><\/span><strong>So what now?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: justify;\">Of course, now that the data is in Cloud Storage, you have to figure out the best ways to distribute that data to your users around the world. Stay tuned for best practices for getting that data out into the world in the next Google Cloud post.<\/p>\n<p style=\"text-align: justify;\">Learn more about your storage options in Cloud Storage Bytes (Link: <a href=\"https:\/\/youtube.com\/playlist?list=PLIivdWyY5sqJcBvDh5dfPoblLGhG1R1-O\" rel=\"nofollow noopener\" target=\"_blank\">https:\/\/youtube.com\/playlist?list=PLIivdWyY5sqJcBvDh5dfPoblLGhG1R1-O<\/a>) or view <a href=\"https:\/\/cloud.google.com\/storage\/docs\/uploading-objects\" rel=\"nofollow noopener\" target=\"_blank\">document <\/a>for more information, including instructions.<\/p>\n<p style=\"text-align: justify;\"><i>Contact Gimasys for advice on transformation strategies that are suitable for your business situation and free Google Cloud service experience:\u00a0<\/i><\/p>\n<ul style=\"text-align: justify;\">\n<li><b>Hotline:\u00a0<\/b>Hanoi: 0987 682 505 \u2013 Ho Chi Minh: 0974 417 099<\/li>\n<li><b>Email:\u00a0<\/b>gsuite@gimasys.com<\/li>\n<li><b>Register Form:\u00a0<strong><a href=\"https:\/\/gcloudvn.com\/en\/dang-ky-dung-thu\/\" rel=\"nofollow\">Here<\/a><\/strong><\/b><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Khi b\u1ea1n \u0111\u00e3 t\u1ea1o buckets v\u00e0 b\u00e2y gi\u1edd b\u1ea1n mu\u1ed1n s\u1eed d\u1ee5ng s\u1ee9c m\u1ea1nh c\u1ee7a \u0111\u00e1m m\u00e2y \u0111\u1ec3 ph\u00e2n ph\u00e1t n\u1ed9i dung c\u1ee7a m\u00ecnh. V\u1edbi th\u00e1i \u0111\u1ed9 l\u00e0 vi\u1ec7c c\u1ea7n l\u00e0m v\u00e0 th\u00f4ng tin chi ti\u1ebft c\u1ee7a b\u00e0i \u0111\u0103ng n\u00e0y,&hellip;<\/p>","protected":false},"author":1,"featured_media":6925,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6924","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-kienthuc","entry","has-media"],"_links":{"self":[{"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/posts\/6924","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/comments?post=6924"}],"version-history":[{"count":0,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/posts\/6924\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/media\/6925"}],"wp:attachment":[{"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/media?parent=6924"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/categories?post=6924"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/tags?post=6924"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}