Qiita Conference 2025

Qiita史上最多!豪華12名のゲストが登壇

特別講演ゲスト(敬称略)

ymrl、成瀬允宣、鹿野壮、伊藤淳一、uhyo、徳丸浩、ミノ駆動、みのるん、桜庭洋之、tenntenn、けんちょん、こにふぁー

51
51

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.

s3 sync がとても便利

Last updated at Posted at 2017-06-30

この記事を読んでわかること

  • ローカルのあるディレクトリ内のデータをごっそりS3の指定した場所にアップロードする方法

環境

  • Windows

前準備

IAM USERを作成する

  • S3へのアクセスを許可するIAMユーザーを作成
  • シークレットアクセスキーをきちんと書き留めておく
Policy
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Stmt1446117060000",
            "Effect": "Allow",
            "Action": [
                "s3:GetObject",
                "s3:ListAllMyBuckets",
                "s3:ListBucket",
                "s3:PutObject"
            ],
            "Resource": [
                "arn:aws:s3:::*"
            ]
        }
    ]
}

ローカルからAWSのS3にアクセスする設定を行う

cli
$ aws configure
  • 上記のコマンドをたたくと、アクセスキー、シークレットアクセスキー、リージョン、出力形式の順番で聞かれるので、入力とEnterを繰り返して設定を進める

cliでローカルファイルをS3にアップロードする

cli
$ aws s3 sync [ローカルファイルのディレクトリ] s3://[バケット名]
  • 上記コマンドをたたくたびに同期が実行される

  • 2回目以降は差分のみ取り込まれる

  • バケット内のディレクトリを指定する場合↓

cli
$ aws s3 sync [ローカルファイルのディレクトリ] s3://[バケット名]/[ディレクトリ名]
51
51
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

Qiita Conference 2025 will be held!: 4/23(wed) - 4/25(Fri)

Qiita Conference is the largest tech conference in Qiita!

Keynote Speaker

ymrl、Masanobu Naruse, Takeshi Kano, Junichi Ito, uhyo, Hiroshi Tokumaru, MinoDriven, Minorun, Hiroyuki Sakuraba, tenntenn, drken, konifar

View event details
51
51

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?