Create a static access key for Object Storage
Create an S3-compatible static key for a service account; the secret is shown only once, so save it right away.
yc iam access-key create --service-account-name <name> --format json | jq -r '"AWS_ACCESS_KEY_ID=\(.access_key.key_id)\nAWS_SECRET_ACCESS_KEY=\(.secret)"'
- tool
- yc32 commands
More yc commands
-
aws --endpoint-url=https://storage.yandexcloud.net s3 sync ./dist s3://<name>/<id>/ --delete --exclude '*.map'Sync files to a Yandex Cloud bucket through the S3 API; --delete removes objects that no longer exist locally.
-
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-dockerCreate 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.