Syntax highlighting of devops/s3

= Simple Storage Service (S3) =

<<TableOfContents()>>

== Minio ==

[[https://min.io/]]

[[https://min.io/docs/minio/linux/reference/minio-mc.html]]

[[https://docs.min.io/docs/minio-quickstart-guide.html|Quickstart Guide|class=" moin-https"]]

[[https://docs.min.io/docs/setup-nginx-proxy-with-minio.html|Set up Nginx proxy with MinIO Server|class=" moin-https"]] (USE 9001 in PROXY!)

=== Run ===

{{{#!highlight bash
mkdir -p ~/minio/data

docker run -d \
  -p 127.0.0.1:9000:9000 \
  -p 127.0.0.1:9001:9001 \
  --name minio \
  -v ~/minio/data:/data \
  -e "MINIO_ROOT_USER=user" \
  -e "MINIO_ROOT_PASSWORD=secret" \
  quay.io/minio/minio server /data --console-address ":9001"

}}}

{{{
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:*" ], "Resource": [ "arn:aws:s3:::blob3", "arn:aws:s3:::blob3/*" ] } ] }

}}}

== s3cmd ==

{{{#!highlight bash
sudo apt install s3cmd
# --- configuration
s3cmd --configure
# --- upload file to bucket
s3cmd put </path/to/file> s3://bucket_name
# --- set several labels for several files
s3cmd modify --add-header=x-amz-meta-patient:petrov \
  --add-header=x-amz-meta-status:ok \
  s3://hospital/image01.dat \
  s3://hospital/image02.dat
# --- get file info
s3cmd info s3://hospital/image01.dat s3://hospital/image02.dat
# --- sync files with local dir
s3cmd sync s3://<имя бакета> <путь к локальной папке на компьютере>/

}}}

Файл конфигурации ''~/.s3cfg''
{{{
[default]
access_key = "access_key"
secret_key = "secret_key"
bucket_location = ru-1
host_base = endpoint_url
host_bucket = endpoint_url
use_https = True
}}}