Use aws s3 with Yandex Object Storage

Sync files to a Yandex Cloud bucket through the S3 API; --delete removes objects that no longer exist locally.

aws --endpoint-url=https://storage.yandexcloud.net s3 sync ./dist s3://<name>/<id>/ --delete --exclude '*.map'

tool
yc32 commands
tags
ycclouddisk

More yc commands

  • yc storage bucket list --format json | jq -r '.[] | "\(.name)\t\(.max_size/1073741824)GiB\t\(.default_storage_class)"'

    List buckets with their size limit in GiB and storage class.

  • aws --endpoint-url=https://storage.yandexcloud.net s3api put-bucket-lifecycle-configuration --bucket <name> --lifecycle-configuration '{"Rules":[{"ID":"expire-logs","Status":"Enabled","Filter":{"Prefix":"logs/"},"Expiration":{"Days":30}}]}'

    Delete objects under logs/ after 30 days automatically to save on storage.

  • yc container registry create --name <name> && yc container registry configure-docker

    Create a Container Registry and set yc as Docker's credential helper, so no docker login is needed.

  • docker tag <name>:<id> cr.yandex/$(yc container registry get --name <name> --format json | jq -r .id)/<name>:<id> && docker push cr.yandex/$(yc container registry get --name <name> --format json | jq -r .id)/<name>:<id>

    Tag the image with the registry ID looked up on the fly, then push it, so cr.yandex/<reg-id> is not hardcoded.

  • yc container repository list --format json | jq -r '.[].name' | while read r; do yc container image list --repository-name "$r" --format json | jq -r '.[] | "\(.name):\(.tags[]? // "<none>")"'; done

    List every tag in every repository; handy before a registry cleanup.

all 32 yc commands