{"id":35012,"date":"2024-09-25T16:06:31","date_gmt":"2024-09-25T09:06:31","guid":{"rendered":"http:\/\/jupitek.maudemo.vip\/index.php\/2024\/09\/25\/use-the-linode-cli-with-object-storage\/"},"modified":"2024-09-25T16:06:31","modified_gmt":"2024-09-25T09:06:31","slug":"use-the-linode-cli-with-object-storage","status":"publish","type":"post","link":"https:\/\/jupitek.maudemo.vip\/index.php\/2024\/09\/25\/use-the-linode-cli-with-object-storage\/","title":{"rendered":"S\u1eed d\u1ee5ng Linode CLI v\u1edbi Object Storage"},"content":{"rendered":"<p>Giao di\u1ec7n d\u00f2ng l\u1ec7nh Linode (CLI) l\u00e0 ti\u1ec7n \u00edch d\u00f2ng l\u1ec7nh cung c\u1ea5p cho b\u1ea1n quy\u1ec1n ki\u1ec3m so\u00e1t ho\u00e0n to\u00e0n \u0111\u1ed1i v\u1edbi t\u00e0i kho\u1ea3n Linode. \u0110\u1ec3 t\u01b0\u01a1ng t\u00e1c v\u1edbi Object Storage, c\u00f3 hai l\u1ec7nh ri\u00eang bi\u1ec7t trong&nbsp;Linode CLI&nbsp;.<\/p>\n<ul>\n<li><code>linode object-storage [command]<\/code>:T\u00e0i nguy\u00ean n\u00e0y cung c\u1ea5p quy\u1ec1n truy c\u1eadp \u0111\u1ec3 qu\u1ea3n l\u00fd L\u01b0u tr\u1eef \u0111\u1ed1i t\u01b0\u1ee3ng tr\u00ean t\u00e0i kho\u1ea3n Linode.<\/li>\n<li><code>linode obj [command]<\/code>:V\u1edbi plugin Object Storage, b\u1ea1n c\u0169ng c\u00f3 th\u1ec3 t\u1ea1o v\u00e0 x\u00f3a nh\u00f3m, t\u1ea3i l\u00ean \u0111\u1ed1i t\u01b0\u1ee3ng, v.v.<\/li>\n<\/ul>\n<p>H\u01b0\u1edbng d\u1eabn n\u00e0y tr\u00ecnh b\u00e0y chi ti\u1ebft c\u00e1ch s\u1eed d\u1ee5ng&nbsp;plugin. \u0110\u1ec3 bi\u1ebft&nbsp;c\u00e1ch s\u1eed d\u1ee5ng, h\u00e3y xem l\u1ec7nh&nbsp;<a href=\"https:\/\/techdocs.akamai.com\/cloud-computing\/docs\/cli-commands-for-object-storage\">Linode CLI&nbsp;cho Object Storage<\/a>&nbsp;.<code>objlinode object-storage<\/code><\/p>\n<p>\u0110\u1ec3 c\u00f3 danh s\u00e1ch t\u1ea5t c\u1ea3 c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng trong m\u1ed9t th\u00f9ng, h\u00e3y s\u1eed d\u1ee5ng l\u1ec7nh&nbsp;c\u00f3 nh\u00e3n c\u1ee7a th\u00f9ng:<code>ls<\/code><\/p>\n<pre class=\"wp-block-code\"><code>linode-cli obj ls my-example-bucket<\/code><\/pre>\n<p>\u0110\u1ec3 bi\u1ebft danh s\u00e1ch \u0111\u1ea7y \u0111\u1ee7 c\u00e1c l\u1ec7nh c\u00f3 s\u1eb5n v\u1edbi plugin Object Storage, h\u00e3y s\u1eed d\u1ee5ng&nbsp;c\u1edd:<code>--help<\/code><\/p>\n<pre class=\"wp-block-code\"><code>linode-cli obj --help<\/code><\/pre>\n<h1 id=\"h-t\u1ea1o-m\u1ed9t-thung-ch\u1ee9a-v\u1edbi-cli\">T\u1ea1o m\u1ed9t th\u00f9ng ch\u1ee9a v\u1edbi CLI<a href=\"https:\/\/techdocs.akamai.com\/cloud-computing\/docs\/using-the-linode-cli-with-object-storage#create-a-bucket-with-the-cli\"><\/a><\/h1>\n<p>\u0110\u1ec3 t\u1ea1o bucket b\u1eb1ng&nbsp;Linode CLI&nbsp;, h\u00e3y s\u1eed d\u1ee5ng&nbsp;l\u1ec7nh. Xem trang&nbsp;<a href=\"https:\/\/techdocs.akamai.com\/cloud-computing\/docs\/create-and-manage-buckets#create-a-bucket\">T\u1ea1o v\u00e0 qu\u1ea3n l\u00fd bucket<\/a>&nbsp;\u0111\u1ec3 bi\u1ebft c\u00e1c quy t\u1eafc \u0111\u1eb7t t\u00ean cho bucket.<code>mb<\/code><a href=\"https:\/\/techdocs.akamai.com\/cloud-computing\/docs\/create-and-manage-buckets#create-a-bucket\"><\/a><\/p>\n<pre class=\"wp-block-code\"><code>linode-cli obj mb my-example-bucket\n<\/code><\/pre>\n<p>\u0110\u1ec3 x\u00f3a m\u1ed9t th\u00f9ng, h\u00e3y s\u1eed d\u1ee5ng&nbsp;l\u1ec7nh:<code>rb<\/code><\/p>\n<pre class=\"wp-block-code\"><code>linode-cli obj rb my-example-bucket\n<\/code><\/pre>\n<p>Hi\u1ec7n t\u1ea1i,&nbsp;Linode CLI&nbsp;m\u1eb7c \u0111\u1ecbnh t\u1ea1o bucket trong trung t\u00e2m d\u1eef li\u1ec7u Newark. \u0110\u1ec3 thay \u0111\u1ed5i c\u1ee5m bucket \u0111\u01b0\u1ee3c t\u1ea1o, h\u00e3y s\u1eed d\u1ee5ng&nbsp;t\u00f9y ch\u1ecdn, theo sau l\u00e0 t\u00ean c\u1ee5m b\u00ean d\u01b0\u1edbi:<code>--cluster<\/code><\/p>\n<ul>\n<li><code>us-east-1<\/code>cho trung t\u00e2m d\u1eef li\u1ec7u Newark. \u0110\u00e2y l\u00e0 m\u1eb7c \u0111\u1ecbnh hi\u1ec7n t\u1ea1i.<\/li>\n<li><code>eu-central-1<\/code>cho trung t\u00e2m d\u1eef li\u1ec7u Frankfurt.<\/li>\n<li><code>ap-south-1<\/code>cho trung t\u00e2m d\u1eef li\u1ec7u Singapore<\/li>\n<\/ul>\n<p class=\"has-background\" style=\"background-color:#d1ffed\">B\u1ea1n c\u1ea7n s\u1eed d\u1ee5ng&nbsp;t\u00f9y ch\u1ecdn n\u00e0y cho m\u1ecdi t\u01b0\u01a1ng t\u00e1c v\u1edbi nh\u00f3m c\u1ee7a m\u00ecnh n\u1ebfu n\u00f3 kh\u00f4ng c\u00f3 trong&nbsp;.<code>--cluster<\/code><code>us-east-1<\/code><\/p>\n<ol>\n<li>\u0110\u1ec3 t\u1ea3i m\u1ed9t \u0111\u1ed1i t\u01b0\u1ee3ng l\u00ean bucket b\u1eb1ng&nbsp;Linode CLI&nbsp;, h\u00e3y s\u1eed d\u1ee5ng&nbsp;l\u1ec7nh. Cung c\u1ea5p t\u00ean \u0111\u1ed1i t\u01b0\u1ee3ng l\u00e0m tham s\u1ed1 \u0111\u1ea7u ti\u00ean v\u00e0 nh\u00e3n bucket l\u00e0m tham s\u1ed1 th\u1ee9 hai:<code>putlinode-cli obj put --acl-public example.txt my-example-bucket<\/code>\n<ul>\n<li>N\u1ebfu th\u00f9ng d\u1eef li\u1ec7u n\u1eb1m trong trung t\u00e2m d\u1eef li\u1ec7u Newark, t\u1ec7p c\u00f3 th\u1ec3 truy c\u1eadp \u0111\u01b0\u1ee3c t\u1ea1i URL&nbsp;.<code>http:\/\/my-example-bucket.us-east-1.linodeobjects.com\/example.txt<\/code>N\u1ebfu th\u00f9ng d\u1eef li\u1ec7u n\u1eb1m trong trung t\u00e2m d\u1eef li\u1ec7u Frankfurt, t\u1ec7p c\u00f3 th\u1ec3 truy c\u1eadp \u0111\u01b0\u1ee3c t\u1ea1i URL&nbsp;.<code>http:\/\/my-example-bucket.eu-central-1.linodeobjects.com\/example.txt<\/code>N\u1ebfu th\u00f9ng n\u1eb1m trong trung t\u00e2m d\u1eef li\u1ec7u Singapore, t\u1ec7p c\u00f3 th\u1ec3 truy c\u1eadp \u0111\u01b0\u1ee3c t\u1ea1i URL<code>https:\/\/my-example-bucket.ap-south-1.linodeobjects.com\/example.txt<\/code><\/li>\n<\/ul>\n<\/li>\n<li>\u0110\u1ec3 t\u1ea3i xu\u1ed1ng m\u1ed9t \u0111\u1ed1i t\u01b0\u1ee3ng, h\u00e3y s\u1eed d\u1ee5ng&nbsp;l\u1ec7nh. Cung c\u1ea5p nh\u00e3n c\u1ee7a th\u00f9ng l\u00e0m tham s\u1ed1 \u0111\u1ea7u ti\u00ean v\u00e0 t\u00ean c\u1ee7a t\u1ec7p l\u00e0m tham s\u1ed1 th\u1ee9 hai:<code>get<\/code><code>linode-cli obj get my-example-bucket example.txt<\/code><\/li>\n<li>\u0110\u1ec3 x\u00f3a m\u1ed9t \u0111\u1ed1i t\u01b0\u1ee3ng, h\u00e3y s\u1eed d\u1ee5ng l\u1ec7nh&nbsp;or&nbsp;. Cung c\u1ea5p nh\u00e3n c\u1ee7a bucket l\u00e0m tham s\u1ed1 \u0111\u1ea7u ti\u00ean v\u00e0 t\u00ean c\u1ee7a \u0111\u1ed1i t\u01b0\u1ee3ng l\u00e0m tham s\u1ed1 th\u1ee9 hai:<code>rmdellinode-cli obj rm my-example-bucket example.txt<\/code><\/li>\n<\/ol>\n<h1>T\u1ea1o m\u1ed9t url \u0111\u00e3 k\u00fd b\u1eb1ng CLI<a href=\"https:\/\/techdocs.akamai.com\/cloud-computing\/docs\/using-the-linode-cli-with-object-storage#create-a-signed-url-with-the-cli\"><\/a><\/h1>\n<p>T\u1ea1o&nbsp;<strong>URL \u0111\u00e3 k\u00fd<\/strong>&nbsp;cho ph\u00e9p b\u1ea1n t\u1ea1o li\u00ean k\u1ebft \u0111\u1ebfn c\u00e1c \u0111\u1ed1i t\u01b0\u1ee3ng c\u00f3 quy\u1ec1n h\u1ea1n h\u1ea1n ch\u1ebf v\u00e0 gi\u1edbi h\u1ea1n th\u1eddi gian truy c\u1eadp. \u0110\u1ec3 t\u1ea1o URL \u0111\u00e3 k\u00fd tr\u00ean m\u1ed9t \u0111\u1ed1i t\u01b0\u1ee3ng \u0111\u00e3 t\u1ed3n t\u1ea1i tr\u01b0\u1edbc \u0111\u00f3 b\u1eb1ng CLI, h\u00e3y s\u1eed d\u1ee5ng c\u00fa ph\u00e1p sau:<\/p>\n<pre class=\"wp-block-code\"><code>linode-cli obj signurl my-example-bucket example.txt +300<\/code><\/pre>\n<p>\u0110\u1ea7u ra c\u1ee7a l\u1ec7nh l\u00e0 m\u1ed9t URL c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng trong m\u1ed9t kho\u1ea3ng th\u1eddi gian nh\u1ea5t \u0111\u1ecbnh \u0111\u1ec3 truy c\u1eadp \u0111\u1ed1i t\u01b0\u1ee3ng, ngay c\u1ea3 khi ACL \u0111\u01b0\u1ee3c \u0111\u1eb7t th\u00e0nh ri\u00eang t\u01b0. Trong tr\u01b0\u1eddng h\u1ee3p n\u00e0y,&nbsp;bi\u1ec3u th\u1ecb kho\u1ea3ng th\u1eddi gian t\u00ednh b\u1eb1ng gi\u00e2y m\u00e0 li\u00ean k\u1ebft v\u1eabn ho\u1ea1t \u0111\u1ed9ng ho\u1eb7c t\u1ed5ng c\u1ed9ng l\u00e0 n\u0103m ph\u00fat. Sau khi th\u1eddi gian n\u00e0y tr\u00f4i qua, li\u00ean k\u1ebft s\u1ebd h\u1ebft h\u1ea1n v\u00e0 kh\u00f4ng th\u1ec3 s\u1eed d\u1ee5ng \u0111\u01b0\u1ee3c n\u1eefa.<code>+300<\/code><\/p>\n<h1>T\u1ea1o m\u1ed9t trang web t\u0129nh v\u1edbi CLI<a href=\"https:\/\/techdocs.akamai.com\/cloud-computing\/docs\/using-the-linode-cli-with-object-storage#create-a-static-site-with-the-cli\"><\/a><\/h1>\n<p>\u0110\u1ec3 t\u1ea1o m\u1ed9t trang web t\u0129nh t\u1eeb m\u1ed9t th\u00f9ng:<\/p>\n<ol>\n<li>S\u1eed d\u1ee5ng&nbsp;l\u1ec7nh, bao g\u1ed3m c\u1ea3 c\u1edd&nbsp;v\u00e0&nbsp;:<code>ws-create<\/code><code>--ws-index<\/code><code>--ws-error<\/code><code>linode-cli obj ws-create my-example-bucket --ws-index=index.html --ws-error=404.html <\/code>C\u1edd&nbsp;v\u00e0&nbsp;c\u1edd ch\u1ec9 \u0111\u1ecbnh \u0111\u1ed1i t\u01b0\u1ee3ng n\u00e0o m\u00e0 th\u00f9ng s\u1ebd s\u1eed d\u1ee5ng \u0111\u1ec3 ph\u1ee5c v\u1ee5 trang ch\u1ec9 m\u1ee5c v\u00e0 trang l\u1ed7i c\u1ee7a trang web t\u0129nh.<code>--ws-index<\/code><code>--ws-error<\/code><\/li>\n<li>B\u1ea1n c\u1ea7n t\u1ea3i ri\u00eang c\u00e1c t\u1ec7p&nbsp;v\u00e0&nbsp;(ho\u1eb7c b\u1ea5t k\u1ef3 t\u00ean n\u00e0o b\u1ea1n \u0111\u1eb7t cho c\u00e1c trang ch\u1ec9 m\u1ee5c v\u00e0 l\u1ed7i) v\u00e0o th\u00f9ng:<code>index.html<\/code><code>404.html<\/code><code>echo 'Index page' &gt; index.html echo 'Error page' &gt; 404.html linode-cli obj put index.html 404.html my-example-bucket<\/code><\/li>\n<li>\u0110\u1eb7t&nbsp;c\u1edd tr\u00ean c\u1ea3 hai t\u1ec7p&nbsp;v\u00e0&nbsp;:<code>--aclpublic<\/code><code>index.html<\/code><code>404.html<\/code><code>linode-cli obj setacl --acl-public my-example-bucket index.html linode-cli obj setacl --acl-public my-example-bucket 404.html<\/code><\/li>\n<li>Trang web t\u0129nh \u0111\u01b0\u1ee3c truy c\u1eadp t\u1eeb m\u1ed9t URL kh\u00e1c v\u1edbi URL chung cho th\u00f9ng Object Storage. C\u00e1c trang web t\u0129nh c\u00f3 s\u1eb5n t\u1ea1i t\u00ean&nbsp;mi\u1ec1n ph\u1ee5 cho trung t\u00e2m d\u1eef li\u1ec7u Newark,&nbsp;t\u00ean mi\u1ec1n ph\u1ee5 cho trung t\u00e2m d\u1eef li\u1ec7u Frankfurt ho\u1eb7c&nbsp;t\u00ean mi\u1ec1n ph\u1ee5 cho trung t\u00e2m d\u1eef li\u1ec7u Singapore. S\u1eed d\u1ee5ng&nbsp;l\u00e0m v\u00ed d\u1ee5, \u0111i\u1ec1u h\u01b0\u1edbng \u0111\u1ebfn m\u1ed9t trong hai:<code>website-us-east-1<\/code><code>website-eu-central-1<\/code><code>website-ap-south-1<\/code><code>my-example-bucket<\/code>\n<ul>\n<li><code>http:\/\/my-example-bucket.website-us-east-1.linodeobjects.com<\/code>ho\u1eb7c<\/li>\n<li><code>http:\/\/my-example-bucket.website-eu-central-1.linodeobjects.com<\/code>ho\u1eb7c<\/li>\n<li><code>http:\/\/my-example-bucket.website-ap-south-1.linodeobjects.com<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>\u0110\u1ec3 bi\u1ebft th\u00eam th\u00f4ng tin v\u1ec1 vi\u1ec7c l\u01b0u tr\u1eef trang web t\u0129nh t\u1eeb Linode Object Storage, h\u00e3y xem h\u01b0\u1edbng d\u1eabn&nbsp;<a href=\"https:\/\/linode.com\/docs\/guides\/host-static-site-object-storage\/\" target=\"_blank\" rel=\"noreferrer noopener\">L\u01b0u tr\u1eef trang web t\u0129nh tr\u00ean Object Storage c\u1ee7a Linode<\/a>&nbsp;.<\/p>\n<h1>T\u1ea1o kh\u00f3a truy c\u1eadp m\u1edbi<a href=\"https:\/\/techdocs.akamai.com\/cloud-computing\/docs\/using-the-linode-cli-with-object-storage#create-a-new-access-key\"><\/a><\/h1>\n<p>N\u1ebfu v\u00ec l\u00fd do n\u00e0o \u0111\u00f3 m\u00e0 kh\u00f3a truy c\u1eadp m\u00e0 b\u1ea1n \u0111\u00e3 thi\u1ebft l\u1eadp khi&nbsp;<a href=\"https:\/\/techdocs.akamai.com\/cloud-computing\/docs\/using-the-linode-cli-with-object-storage#install-and-configure-the-cli\">C\u1ea5u h\u00ecnh CLI<\/a>&nbsp;ban \u0111\u1ea7u b\u1ecb thu h\u1ed3i ho\u1eb7c x\u00f3a, b\u1ea1n c\u00f3 th\u1ec3 th\u1ea5y th\u00f4ng b\u00e1o l\u1ed7i sau:\u0110\u1ea7u ra<\/p>\n<pre class=\"wp-block-code\"><code>Error: InvalidAccessKeyId\n<\/code><\/pre>\n<p>B\u1ea1n c\u00f3 th\u1ec3 t\u1ea1o v\u00e0 c\u1ea5u h\u00ecnh Kh\u00f3a truy c\u1eadp m\u1edbi b\u1ea5t k\u1ef3 l\u00fac n\u00e0o b\u1eb1ng c\u00e1ch ch\u1ea1y l\u1ec7nh sau:<\/p>\n<pre class=\"wp-block-code\"><code>linode-cli obj regenerate-keys\n<\/code><\/pre>\n<p>Sau khi ch\u1ea1y l\u1ec7nh, quy\u1ec1n truy c\u1eadp s\u1ebd \u0111\u01b0\u1ee3c kh\u00f4i ph\u1ee5c v\u00e0 b\u1ea1n c\u00f3 th\u1ec3 th\u1ea5y kh\u00f3a m\u1edbi \u0111\u01b0\u1ee3c li\u1ec7t k\u00ea b\u1ea5t k\u1ef3 l\u00fac n\u00e0o b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng l\u1ec7nh sau:<\/p>\n<pre class=\"wp-block-code\"><code>linode-cli object-storage keys-list\n<\/code><\/pre>\n<p class=\"has-background\" style=\"background-color:#c8f8e8\">B\u1ea5t k\u1ef3 kh\u00f3a l\u01b0u tr\u1eef \u0111\u1ed1i t\u01b0\u1ee3ng m\u1edbi n\u00e0o \u0111\u01b0\u1ee3c c\u1ea5p th\u00f4ng qua CLI \u0111\u1ec1u \u0111\u01b0\u1ee3c th\u00eam ti\u1ec1n t\u1ed1&nbsp;l\u00e0 nh\u00e3n.<code>linode-cli<\/code><\/p>\n<p>Ngu\u1ed3n: https:\/\/techdocs.akamai.com\/cloud-computing\/docs\/using-the-linode-cli-with-object-storage<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Giao di\u1ec7n d\u00f2ng l\u1ec7nh Linode (CLI) l\u00e0 ti\u1ec7n \u00edch d\u00f2ng l\u1ec7nh cung c\u1ea5p cho b\u1ea1n quy\u1ec1n ki\u1ec3m so\u00e1t ho\u00e0n to\u00e0n \u0111\u1ed1i v\u1edbi t\u00e0i kho\u1ea3n Linode. \u0110\u1ec3 t\u01b0\u01a1ng t\u00e1c v\u1edbi Object Storage, c\u00f3 hai l\u1ec7nh ri\u00eang bi\u1ec7t trong&nbsp;Linode CLI&nbsp;. H\u01b0\u1edbng d\u1eabn n\u00e0y tr\u00ecnh b\u00e0y chi ti\u1ebft c\u00e1ch s\u1eed d\u1ee5ng&nbsp;plugin. \u0110\u1ec3 bi\u1ebft&nbsp;c\u00e1ch s\u1eed d\u1ee5ng, h\u00e3y xem l\u1ec7nh&nbsp;Linode<\/p>\n","protected":false},"author":1,"featured_media":36199,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[103],"tags":[],"class_list":["post-35012","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-clients-and-tooling"],"_links":{"self":[{"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/posts\/35012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/comments?post=35012"}],"version-history":[{"count":0,"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/posts\/35012\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/media\/36199"}],"wp:attachment":[{"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/media?parent=35012"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/categories?post=35012"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jupitek.maudemo.vip\/index.php\/wp-json\/wp\/v2\/tags?post=35012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}