S3 buckets: Difference between revisions

From MediaWiki
Jump to navigation Jump to search
Line 96: Line 96:
Default output format [None]: json # set to json
Default output format [None]: json # set to json
</syntaxhighlight>
</syntaxhighlight>
This will then create config files on your machine in the following locations:
* ~/.aws/config
* ~/.aws/credentials


=== General usage - Connect - S3cmd ===
=== General usage - Connect - S3cmd ===

Revision as of 16:20, 11 November 2024

Overview

This page describes the creation and management of S3 buckets in our OpenStack-based stoney cloud.

Credential pair

In order to use the S3 API you have to create EC2 (Amazon Elastic Compute Cloud) credentials using the OpenStack Keystone service.

This section will guide you through the creation process in our OpenStack-based cloud.

Credential pair - Create

Create new EC2 credentials in OpenStack using the OpenStack-CLI:

openstack ec2 credentials create

This will give you an output in the following format:

+------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| Field      | Value                                                                                                                                          |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| access     | tpvx3i0gk5rf4duomnr7davjxl517z9c                                                                                                               |
| links      | {'self': 'https://api.os.stoney-cloud.com:5000/v3/users/tpvx3i0gk5rf4duomnr7davjxl517z9c/credentials/OS-EC2/tpvx3i0gk5rf4duomnr7davjxl517z9c'} |
| project_id | hw3rr6x6ktyuv7erwpuyxbijihx1phdw                                                                                                               |
| secret     | 6lifckxv1005z60csekl7qynwxwbv3re                                                                                                               |
| trust_id   | None                                                                                                                                           |
| user_id    | tpvx3i0gk5rf4duomnr7davjxl517z9c                                                                                                               |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------+

Credential pair - Show

If you ever need to look the credentials up again, use the following command:

access_id=tpvx3i0gk5rf4duomnr7davjxl517z9c
openstack ec2 credentials show ${access_id}

This will give you an output formatted like this:

+------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| Field      | Value                                                                                                                                          |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| access     | tpvx3i0gk5rf4duomnr7davjxl517z9c                                                                                                               |
| links      | {'self': 'https://api.os.stoney-cloud.com:5000/v3/users/tpvx3i0gk5rf4duomnr7davjxl517z9c/credentials/OS-EC2/tpvx3i0gk5rf4duomnr7davjxl517z9c'} |
| project_id | hw3rr6x6ktyuv7erwpuyxbijihx1phdw                                                                                                               |
| secret     | 6lifckxv1005z60csekl7qynwxwbv3re                                                                                                               |
| trust_id   | None                                                                                                                                           |
| user_id    | tpvx3i0gk5rf4duomnr7davjxl517z9c                                                                                                               |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------+

Credential pair - Delete

If you need to delete your credentials, you can so like this:

access_id=tpvx3i0gk5rf4duomnr7davjxl517z9c
openstack ec2 credentials delete ${access_id}

When running 'delete' you should get no response apart from the status code 0.

General usage

When using the S3 technology, you have different possible cli-tools. The most popular implementations are:

  • aws
  • s3cmd

This page focuses on the usage of those two implementations.

General usage - Connect

General usage - Connect - AWS client

This section explains the general usage such as configuring the connection using the AWS-client.

General usage - Connect - AWS client - Installation

Install the awscli using your favorite package manager:

# Fedora/RHEL
sudo dnf install awscli
# Ubuntu/Debian
sudo apt install awscli
# Alpine Linux
sudo apk add aws-cli
# Arch Linux
sudo pacman -S aws-cli

General usage - Connect - AWS client - Configuration

After installing the awscli package, you can configure it like so:

aws configure

The configuration helper will prompt you to enter the following information:

AWS Access Key ID [None]: tpvx3i0gk5rf4duomnr7davjxl517z9c # access (from EC2 credentials)
AWS Secret Access Key [None]: 6lifckxv1005z60csekl7qynwxwbv3re # secret (from EC2 credentials)
Default region name [None]: # leave empty
Default output format [None]: json # set to json

This will then create config files on your machine in the following locations:

  • ~/.aws/config
  • ~/.aws/credentials

General usage - Connect - S3cmd

Activate versioning

Set retention policy