0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Amazon S3の基礎概念

Last updated at Posted at 2020-04-23

S3のデータ構造

  • 一般的なデータ構造
    • データをファイル単位で格納し、フォルダという階層構造を持つ。
  • S3のデータ構造
    • 単純なKVS(Key-Value型データストア)
    • hoge/foo.txtがあった場合、S3では以下のようにデータを認識する
キー(フルパス名) バリュー(ファイルの内容)
hoge/ (空)
hoge/foo.txt contents

S3における空フォルダ

  • 既存の空フォルダの中にファイルを配置すると、S3上では2要素管理される。
キー(フルパス名) バリュー(ファイルの内容)
hoge/ (空)
hoge/foo.txt contents
  • 存在しないフォルダに直接ファイルを配置すると、S3上では1要素管理される。
  • ※管理コンソールからfoo.txtを消すと、hoge/が要素として認識される
キー(フルパス名) バリュー(ファイルの内容)
hoge/foo.txt contents

S3コマンドの形式

aws s3 <Command> [<Arg> ...]
  • ローカルのパス:[ローカルファイルまたはディレクトリの絶対パスまたは相対パス]
  • S3のパス:[s3://<bucket>/<prefix>/<object>]
  • prefixはディレクトリやフォルダと思えばよい

ファイルのアップロード

aws s3 cp ./sampledata.txt s3://sample-bucket-**********/dir/
  • コピー先の末尾がスラッシュで終わる
    • コピー元と同名でファイルをコピー
  • コピー先の末尾がスラッシュで終わらない
    • 末尾の文字列に拡張子が無くディレクトリ名のように見えても、ファイル名として認識される

引用

https://www.task-notes.com/entry/20150904/1441335600
https://qiita.com/nakazax/items/b62309884a19d71f9a34#ls---%E3%82%AA%E3%83%96%E3%82%B8%E3%82%A7%E3%82%AF%E3%83%88%E3%81%AE%E3%83%AA%E3%82%B9%E3%83%88
https://dev.classmethod.jp/articles/amazon-s3-folders/

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?