Creating a Bucket Website

You can create a bucket and host a static website on it using OUTSCALE Object Storage (OOS).

A static website displays web pages with content primarily coded in HTML that remains consistent for users. Interactive features can still be incorporated to a static website (using JavaScript, for example), but to a lesser degree than dynamic websites that make use of server-side rendering or databases.

Creating a Bucket Website Using AWS CLI (s3api)

Before you begin: Install and configure AWS CLI. For more information, see Installing and Configuring AWS CLI.

  1. Create an index.html file and an error.html file. For more information on how to structure those files, see Bucket Website Configuration Reference > Index and Error Files Samples.

    The index file (most commonly named index.html) is the default returned file when a user accesses the root of your domain. The error file (most commonly named error.html) is the file that is returned when an error occurs on your website.

  2. Create a configuration file named website.json. For more information on how to structure this file, see Bucket Website Configuration Reference > Website Configuration Structure.

    The website configuration file, usually in JSON format, serves as a blueprint for how your bucket should behave when accessed as a website. You can specify your index and error files as well as other configuration rules. The examples used across this tutorial are kept basic on purpose.

  3. Upload your objects index.html and error.html in the bucket of your choice, configuring a public-read ACL for both. For more information, see Uploading an Object to a Bucket.

    Request Sample
    $ aws s3api put-object \
        --profile YOUR_PROFILE \
        --bucket BUCKET \
        --key index.html \
        --body ~/path/to/index.html \
        --acl public-read \
        --endpoint https://oos.eu-west-2.outscale.com
    Request Sample
    $ aws s3api put-object \
        --profile YOUR_PROFILE \
        --bucket BUCKET \
        --key error.html \
        --body ~/path/to/error.html \
        --acl public-read \
        --endpoint https://oos.eu-west-2.outscale.com
  4. Create your website with the put-bucket-website command following this syntax:

    Request Sample
    $ aws s3api put-bucket-website \
        --profile YOUR_PROFILE \
        --bucket BUCKET \
        --website-configuration file://~/path/to/website.json \
        --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 host your website.

    • website-configuration: The path to the JSON configuration file containing your index and error documents.

    • endpoint: The endpoint corresponding to the Region you want to send the request to. For more information, see Installing and Configuring AWS CLI.

    Your website is created and accessible using the following URL format: https://<BUCKET>.oos-website.<REGION>.outscale.com

Creating a Bucket Website Using AWS CLI (s3)

Before you begin: Install and configure AWS CLI. For more information, see Installing and Configuring AWS CLI.

  1. Create an index.html file and an error.html file. For more information on how to structure those files, see Bucket Website Configuration Reference > Index and Error Files Samples.

    The index file (most commonly named index.html) is the default returned file when a user accesses the root of your domain. The error file (most commonly named error.html) is the file that is returned when an error occurs on your website.

  2. Upload your objects index.html and error.html in the bucket of your choice, configuring a public-read ACL for both. For more information, see Uploading an Object to a Bucket.

    Request Sample
    $ aws s3 cp ~/path/to/index.html s3://BUCKET/ \
       --profile YOUR_PROFILE \
       --acl public-read \
       --endpoint https://oos.eu-west-2.outscale.com
    Request Sample
    $ aws s3 cp ~/path/to/error.html s3://BUCKET/ \
       --profile YOUR_PROFILE \
       --acl public-read \
       --endpoint https://oos.eu-west-2.outscale.com
  3. 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/: The path to the bucket where your website is hosted.

    • (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 use for the website.

    • error-document: The path to the error file to use for the website.

    • endpoint: The endpoint corresponding to the Region you want to send the request to. For more information, see Installing and Configuring AWS CLI.

    Your website is created and accessible using the following URL 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.