## Using Object Storage with Atlas Buckets Atlas Storage is S3-compatible, allowing you to use the AWS CLI for managing buckets and objects. You can also create and manage buckets via the Atlas Cloud web interface. ### Via UI #### Creating a Bucket 1. Log in to the Atlas Cloud Platform. 2. Navigate to the **Storage** section. 3. Click "Create Bucket". 4. Enter a unique bucket name. 5. Set the quota (e.g., 1 GiB). 6. Choose access policy, Public for web hosting, Private for secure storage (default). 7. Click "OK". #### Uploading Files 1. In the bucket's detail page, go to the "Browse" tab. 2. Click "Upload". 3. Select files or folders from your local machine. 4. Confirm the upload. #### Setting Bucket Access 1. In the bucket's detail page, go to the "Details" tab. 2. Edit the "Access Policy" (Public for web access, Private for secure storage). 3. Save changes. Note: For fine-grained permissions, use bucket policies via CLI. #### Generating Pre-signed URLs Pre-signed URLs are not supported in the Atlas UI. Use the CLI method below. ### Via CLI #### Prerequisites - [AWS CLI](https://aws.amazon.com/cli/) installed on your local machine. - Access key and secret key from your bucket in Atlas Cloud (found in Buckets > "your bucket" > Details). #### Alternatives to AWS CLI <!-- markdownlint-disable MD033 --> <details> <summary>s3cmd</summary> <p>s3cmd is another tool for S3-compatible storage. Download from <a href="https://s3tools.org/s3cmd">s3tools.org/s3cmd</a>.</p> <ul> <li>Configure: <code>s3cmd --configure</code> (enter access key, secret, endpoint)</li> <li>Upload: <code>s3cmd put --recursive ./path/to/files s3://bucket/</code></li> <li>Sync: <code>s3cmd sync ./path/to/files s3://bucket/</code></li> </ul> </details> <!-- markdownlint-enable MD033 --> <!-- markdownlint-disable MD033 --> <details> <summary>s5cmd</summary> <p>s5cmd is a fast alternative. Download from <a href="https://github.com/peak/s5cmd">github.com/peak/s5cmd</a>.</p> <ul> <li>Set env vars: <code>export AWS_ACCESS_KEY_ID=... AWS_SECRET_ACCESS_KEY=... S3_ENDPOINT_URL=https://s3.alpha.runatlas.is</code></li> <li>Upload: <code>s5cmd --endpoint-url https://s3.alpha.runatlas.is cp --recursive ./path/to/files s3://bucket/</code></li> <li>Sync: <code>s5cmd --endpoint-url https://s3.alpha.runatlas.is sync ./path/to/files s3://bucket/</code></li> </ul> </details> <!-- markdownlint-enable MD033 --> #### Configure AWS CLI 1. Open your terminal and configure the AWS CLI with your Atlas credentials: ```bash aws configure --profile atlas ``` - AWS Access Key ID: Enter your bucket access key. - AWS Secret Access Key: Enter your bucket secret key. - Default region name: Leave blank. - Default output format: Leave blank or enter `json`. 2. Set the endpoint URL for Atlas Storage: ```bash aws configure set endpoint_url https://s3.alpha.runatlas.is --profile atlas ``` Alternatively, you can manually edit the AWS config files: Example `~/.aws/config`: ```ini [profile atlas] endpoint_url = https://s3.alpha.runatlas.is ``` Example `~/.aws/credentials`: ```ini [atlas] aws_access_key_id = YOUR_ACCESS_KEY aws_secret_access_key = YOUR_SECRET_KEY ``` Then run commands without `--profile atlas` or set the profile as an environment variable `export AWS_PROFILE=atlas`. Verify by listing your buckets: ```bash aws s3 ls --profile atlas ``` #### Creating a Bucket with `aws` CLI To create a new bucket: ```bash aws s3 mb s3://your-bucket-name --profile atlas ``` #### Uploading Files with `aws` CLI To upload your static files to the bucket: ```bash aws s3 cp ./path/to/your/static/files s3://your-bucket-name/ --recursive --profile atlas ``` Replace `./path/to/your/static/files` with the path to your local static files directory, `your-bucket-name` with your bucket name. To sync and update your files (uploads new/changed files, deletes removed ones): ```bash aws s3 sync ./path/to/your/static/files s3://your-bucket-name/ --profile atlas ``` #### Setting Bucket Access with `aws` CLI Buckets are private by default. To make objects publicly accessible, set a bucket policy (note `"Effect": "Allow"`): ```bash aws s3api put-bucket-policy --bucket your-bucket-name --policy '{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::your-bucket-name/*" } ] }' --profile atlas ``` To remove public access (make private): ```bash aws s3api delete-bucket-policy --bucket your-bucket-name --profile atlas ``` #### Generating Pre-signed URLs with `aws` CLI Create a temporary URL (expires in 1 hour by default): ```bash aws s3 presign s3://your-bucket-name/path/to/file --expires-in 3600 --profile atlas ``` For more AWS CLI commands, refer to the [AWS CLI S3 documentation](https://docs.aws.amazon.com/cli/latest/reference/s3/).