Tutorial: Getting Started with OOS Using AWS CLI
The aim of this tutorial is to present the main operations possible with OUTSCALE Object Storage (OOS) using AWS CLI.
These operations are not presented in their comprehensive form. For more information, see the linked complete procedures. |
Creating a Bucket
Before you begin: Install and configure AWS CLI and set up your profile. For more information, see Installing and Configuring AWS CLI. |
To create a bucket, use the create-bucket command following this syntax:
$ aws s3api create-bucket \
--profile YOUR_PROFILE \
--bucket BUCKET \
--endpoint https://oos.eu-west-2.outscale.com
This command contains the following attributes that you need to specify:
-
(optional)
profile
: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI. -
bucket
: The name you want to give to your bucket, according to the corresponding naming rules.As a reminder, the name of a bucket must:
-
Be unique for the whole Region
-
Contain between 3 and 63 characters
-
Contain only lowercase characters, numbers and hyphens (-)
-
Start with an alphanumeric character
-
-
endpoint
: The endpoint corresponding to the Region you want to send the request to.
The bucket is created.
For more information, see Creating a Bucket. |
Uploading an Object to a Bucket
Before you begin: Install and configure AWS CLI and set up your profile. For more information, see Installing and Configuring AWS CLI. |
Objects are not limited in size. The maximum size for one upload is 5 GiB, but you can also upload files in multiple parts. For optimal upload performance, it is recommended that files larger than 100 MiB be uploaded in multiple parts. For more information, see Using Multipart Upload. |
To upload a local object in a bucket, use the put-object command following this syntax:
$ aws s3api put-object \
--profile YOUR_PROFILE \
--bucket BUCKET \
--key OBJECT \
--body usr/bin/OBJECT \
--endpoint https://oos.eu-west-2.outscale.com
This command contains the following attributes that you need to specify:
-
(optional)
profile
: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI. -
bucket
: The bucket in which you want to upload the object. -
key
: The name you want to give to the object in the bucket. -
body
: The path to the object on your machine. -
endpoint
: The endpoint corresponding to the Region you want to send the request to.
The object is uploaded to the bucket.
To correctly display a binary file such as PDF in a web browser, you must upload it using the following s3 command:
|
For more information, see Uploading an Object to a Bucket. |
Configuring a Bucket ACL
Before you begin: Install and configure AWS CLI and set up your profile. For more information, see Installing and Configuring AWS CLI. |
To configure the ACL of a bucket, use the put-bucket-acl command following this syntax:
$ aws s3api put-bucket-acl \
--profile YOUR_PROFILE \
--bucket BUCKET \
--grant-read id=S3_USER_ID \
--endpoint https://oos.eu-west-2.outscale.com
This command contains the following attributes that you need to specify:
-
(optional)
profile
: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI. -
bucket
: The bucket in which you want to upload the object. -
grant-read
: The S3 ID of the user to which you grant theread
permission.To retrieve S3 user IDs, you need to use the Listing Your Buckets or Listing the Objects of a Bucket methods.
-
endpoint
: The endpoint corresponding to the Region you want to send the request to.
The ACL is configured for the bucket.
For more information, see Configuring a Bucket ACL. |
Configuring an Object ACL
Before you begin: Install and configure AWS CLI and set up your profile. For more information, see Installing and Configuring AWS CLI. |
To set the ACL for an object, use the put-object-acl command following this syntax:
$ aws s3api put-object-acl \
--profile YOUR_PROFILE \
--bucket BUCKET \
--key OBJECT \
--grant-read id=S3_USER_ID \
--endpoint https://oos.eu-west-2.outscale.com
This command contains the following attributes that you need to specify:
-
(optional)
profile
: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI. -
bucket
: The bucket in which you want to upload the object. -
key
: The name of the object in the bucket. -
grant-read
: The S3 ID of the user to which you grant theread
permission.To retrieve S3 user IDs, you need to use the Listing Your Buckets or Listing the Objects of a Bucket methods.
-
endpoint
: The endpoint corresponding to the Region you want to send the request to.
The ACL is configured for the object.
For more information, see Configuring an Object ACL. |
Configuring a Pre-signed URL
Before you begin: Install and configure AWS CLI and set up your profile. For more information, see Installing and Configuring AWS CLI. |
To configure a pre-signed URL, use the presign command following this syntax:
$ aws s3 presign s3://BUCKET/OBJECT \
--profile YOUR_PROFILE \
--expires-in 3600 \
--endpoint https://oos.eu-west-2.outscale.com
This command contains the following attributes that you need to specify:
-
s3://BUCKET/OBJECT
: The path to the object you want to share in the bucket. -
(optional)
profile
: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI. -
expires-in
: The time before the URL expires, in seconds. -
endpoint
: The endpoint corresponding to the Region you want to send the request to.
For more information, see Configuring a Pre-signed URL. |
Creating a Website
Before you begin: Install and configure AWS CLI and set up your profile. For more information, see Installing and Configuring AWS CLI. |
-
Copy an index.html object in your bucket and configure a
public-read
ACL:Request sample$ aws s3 cp index.html s3://BUCKET/ \ --profile YOUR_PROFILE \ --acl public-read \ --endpoint https://oos.eu-west-2.outscale.com
This command contains the following attributes that you need to specify:
-
s3://BUCKET/OBJECT
: The path to the object you want to share in the bucket. -
(optional)
profile
: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI. -
(optional)
acl
: The permissions for your object (private
|public-read
|public-read-write
|authenticated-read
). -
endpoint
: The endpoint corresponding to the Region you want to send the request to.
-
-
Copy an error.html object in your bucket and configure a
public-read
ACL:Request sample$ aws s3 cp error.html s3://BUCKET/ \ --profile YOUR_PROFILE \ --acl public-read \ --endpoint https://oos.eu-west-2.outscale.com
This command contains the following attributes that you need to specify:
-
s3://BUCKET/OBJECT
: The path to the object you want to share in the bucket. -
(optional)
profile
: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI. -
(optional)
acl
: The permissions for your object (private
|public-read
|public-read-write
|authenticated-read
). -
endpoint
: The endpoint corresponding to the Region you want to send the request to.
-
-
Create a website.json file with the following content:
{ "IndexDocument": { "Suffix": "index.html" }, "ErrorDocument": { "Key": "error.html" } }
-
Copy the website.json file in your bucket and configure a
public-read
ACL:Request sample$ aws s3 cp website.json s3://BUCKET/ \ --profile YOUR_PROFILE \ --acl public-read \ --endpoint https://oos.eu-west-2.outscale.com
This command contains the following attributes that you need to specify:
-
s3://BUCKET/OBJECT
: The path to the object you want to share in the bucket. -
(optional)
profile
: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI. -
(optional)
acl
: The permissions for your object (private
|public-read
|public-read-write
|authenticated-read
). -
endpoint
: The endpoint corresponding to the Region you want to send the request to.
-
-
Create your website with the website command following this syntax:
Request Sample$ aws s3 website s3://BUCKET/ \ --profile YOUR_PROFILE \ --index-document index.html \ --error-document error.html \ --endpoint https://oos.eu-west-2.outscale.com
This command contains the following attributes that you need to specify:
-
s3://BUCKET/OBJECT
: The path to the object you want to share in the bucket. -
(optional)
profile
: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI. -
index-document
: The path to the index file to be used for the website. -
error-document
: The path to the error file to be used for the website. -
endpoint
: The endpoint corresponding to the Region you want to send the request to.
Your website is created and accessible with the following address format: https://<BUCKET>.oos-website.<REGION>.outscale.com
Related Pages
AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.