<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xml" href="https://scaleway.com/feed.xslt.xml"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><generator uri="http://jekyllrb.com" version="3.3.1">Jekyll</generator><link href="https://scaleway.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://scaleway.com/" rel="alternate" type="text/html" hreflang="en" /><updated>2018-09-28T12:50:11+00:00</updated><id>https://scaleway.com//</id><title type="html">Scaleway</title><subtitle>Scaleway is a cloud platform, offering SSD cloud servers for any workload starting at €0.006 on an hourly basis. Pay as you go with a simple and flexible pricing.</subtitle><author><name>Scaleway</name><email>contact@scaleway.com</email><uri>https://scaleway.com</uri></author><entry><title type="html">S3 Object Storage - Generate a AWSv4 Authentication Signature</title><link href="https://scaleway.com/docs/s3/generate-awsv4-signature/" rel="alternate" type="text/html" title="S3 Object Storage - Generate a AWSv4 Authentication Signature" /><published>2018-09-21T00:00:00+00:00</published><updated>2018-09-21T00:00:00+00:00</updated><id>https://scaleway.com/docs/s3/generate-awsv4-signature</id><content type="html" xml:base="https://scaleway.com/docs/s3/generate-awsv4-signature/">&lt;h2 class=&quot;anchor-wrap&quot;&gt;Object Storage - Generate a AWSv4 Authentication Signature&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Object-Storage--Generate-a-AWSv4-Authentication-Signature&quot; href=&quot;#-Object-Storage--Generate-a-AWSv4-Authentication-Signature&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Requests sent to the Object storage API require to include an HTTP Authorization header.
Currently the &lt;a href=&quot;https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html&quot;&gt;AWS v4 Signature type&lt;/a&gt; is supported.&lt;/p&gt;

&lt;p&gt;Throughout the Object Storage documentation, v4 signatures are used.
When you are using a client library such as &lt;a href=&quot;https://www.scaleway.com/docs/object-storage-with-aws-cli/&quot;&gt;aws-cli&lt;/a&gt;, &lt;a href=&quot;https://www.scaleway.com/docs/object-storage-with-s3cmd/&quot;&gt;s3cmd&lt;/a&gt; or &lt;a href=&quot;https://www.scaleway.com/docs/object-storage-with-s3fs/&quot;&gt;s3fs&lt;/a&gt;, signatures are automatically generated by the library for you.&lt;/p&gt;

&lt;p&gt;To generate the signature, you need to have an Access Key and Secret Key generated in the &lt;a href=&quot;https://cloud.scaleway.com/#/credentials&quot;&gt;Credentials section&lt;/a&gt; of your management console.&lt;/p&gt;

&lt;p&gt;A v4 signature consists of a number of parts. The table below provides more information on each piece of it individually:&lt;/p&gt;

&lt;table class=&quot;doc-matrix-table matrix-table-no-color&quot;&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;AWS4-HMAC-SHA256&lt;/td&gt;
      &lt;td&gt;Indicates AWS Signature Version 4 (AWS4) and the signing algorithm (HMAC-SHA256).&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Credential&lt;/td&gt;
      &lt;td&gt;Contains your access key and information about the request in the format: &lt;code class=&quot;highlighter-rouge&quot;&gt;${ACESS_KEY}/${YYYMMDD}/${REGION_SLUG}/s3/aws4_request&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;SignedHeaders&lt;/td&gt;
      &lt;td&gt;A lower-cased list of the names of the request headers used when computing the signature. (e.g. &lt;code class=&quot;highlighter-rouge&quot;&gt;host;x-amz-acl;x-amz-content-sha256;x-amz-date&lt;/code&gt;)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Signature&lt;/td&gt;
      &lt;td&gt;A signed hash consisting of a hash of the request body, your secret key, and information about the request (i.e. the canonical request).&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;The canonical request included in the signature is made up of:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The HTTP request method used.&lt;/li&gt;
  &lt;li&gt;The path component of the request URI.&lt;/li&gt;
  &lt;li&gt;The query string parameters included in the request.&lt;/li&gt;
  &lt;li&gt;The list of request headers and their values, newline separated, lower-cased, and trimmed of whitespace.&lt;/li&gt;
  &lt;li&gt;The list of header names without their values, sorted alphabetically, lower-cased, and semicolon-separated.&lt;/li&gt;
  &lt;li&gt;The SHA256 hash of the request body.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This means the following example:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;GET /?acl HTTP/1.1

Host: mybucket.s3.ams-nl.scw.cloud
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date: 20180914T121549Z
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Would be based on the following canonical code:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;GET
/
acl=
host:mybucket.s3.ams-nl.scw.cloud
x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20180914T121549Z

host;x-amz-content-sha256;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example Authorization Header&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Authorization: AWS4-HMAC-SHA256
Credential=II5JDQBAN3JYM4DNEB6C/20180914/nl-ams/s3/aws4_request,
SignedHeaders=host;x-amz-acl;x-amz-content-sha256;x-amz-date,
Signature=6cab03bef74a80a0441ab7fd33c829a2cdb46bba07e82da518cdb78ac238fda5
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Signing Example (Pseudo Code)&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;canonicalRequest = `
${HTTPMethod}\n
${canonicalURI}\n
${canonicalQueryString}\n
${canonicalHeaders}\n
${signedHeaders}\n
${hashedPayload}
`

stringToSign = &quot;AWS4-HMAC-SHA256&quot; + &quot;\n&quot; +
    date(format=ISO08601) + &quot;\n&quot; +
    date(format=YYYYMMDD) + &quot;/&quot; + ${REGION} + &quot;/&quot; + &quot;s3/aws4_request&quot; + &quot;\n&quot; +
    Hex(SHA256Hash(canonicalRequest))

dateKey = HMAC-SHA256(&quot;AWS4&quot; + ${SECRET_KEY}, date(format=YYYYMMDD))
dateRegionKey = HMAC-SHA256(dateKey, ${REGION})
dateRegionServiceKey = HMAC-SHA256(dateRegionKey, &quot;s3&quot;)
signingKey = HMAC-SHA256(dateRegionServiceKey, &quot;aws4_request&quot;)

signature = Hex(HMAC-SHA256(signingKey, stringToSign))
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</content><author><name>Scaleway</name><email>contact@scaleway.com</email><uri>https://scaleway.com</uri></author><category term="documentation-api-s3" /><category term="compute" /><category term="networking" /><category term="storage" /><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://scaleway.com/assets/images/og/scaleway.png" /></entry><entry><title type="html">S3 Object Storage - Object Operations</title><link href="https://scaleway.com/docs/s3/object-operations/" rel="alternate" type="text/html" title="S3 Object Storage - Object Operations" /><published>2018-09-17T00:00:00+00:00</published><updated>2018-09-17T00:00:00+00:00</updated><id>https://scaleway.com/docs/s3/object-operations</id><content type="html" xml:base="https://scaleway.com/docs/s3/object-operations/">&lt;h2 class=&quot;anchor-wrap&quot;&gt;Object Storage - Object Operations&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Object-Storage--Object-Operations&quot; href=&quot;#-Object-Storage--Object-Operations&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;DELETE Object&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-DELETE-Object&quot; href=&quot;#-DELETE-Object&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This operation allows you to remove the null version (if available) of an object and inserts a delete marker, which becomes the latest version of the object.&lt;/p&gt;

&lt;p&gt;If there is no no null version, no object is removed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;DELETE /sammy.png HTTP/1.1

Host: bucket.s3.nl-ams.scw.cloud
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date: 20170710T194408Z
Authorization: authorization string
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;HTTP/1.1 204 No Content

Date: Mon, 10 Jul 2017 19:44:09 GMT
x-amz-request-id: tx0000000000000027bbc48-005963d908-1268c-ams1
Connection: close
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also use &lt;code class=&quot;highlighter-rouge&quot;&gt;aws s3api delete-object --bucket BucketName --key ObjectName&lt;/code&gt;. If bucket versioning is enabled, the output will contain the version ID of the delete marker.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;GET Object&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-GET-Object&quot; href=&quot;#-GET-Object&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This operation allows you to retrieve objects from Scaleway Object Storage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;GET /example.txt HTTP/1.1

Host: bucket.s3.nl-ams.scw.cloud
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date: 20180910T190539Z
Authorization: authorization string
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;HTTP/1.1 200 OK

Date: Mon, 10 Sep 2018 19:05:39 GMT
x-amz-request-id: tx00000000000000279f46e-005963d003-1268c-ams1
Content-Type: text/plain
Content-Length: 14
Accept-Ranges: bytes
Last-Modified: Mon, 10 Jul 2017 19:05:09 GMT
Etag: b3a92f49e7ae64acbf6b3e76f2040f5e
Connection: close
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also use &lt;code class=&quot;highlighter-rouge&quot;&gt;aws s3api get-object --bucket BucketName --key dir/ObjectNameLocation ObjectName&lt;/code&gt;. The name of the output file must be the last parameter in the command.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;GET Object ACL&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-GET-Object-ACL&quot; href=&quot;#-GET-Object-ACL&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This operation allows you to return the access control list (ACL) of an object.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;GET /myimage.png?acl HTTP/1.1

Host: bucket.s3.nl-ams.scw.cloud.com
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date: 20180910T191224Z
Authorization: authorization string
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;HTTP/1.1 200 OK

Date: Mon, 10 Sep 2018 19:12:24 GMT
x-amz-request-id: tx0000000000000027a42dc-005963d198-1268c-ams1
Content-Type: application/xml
Content-Length: 621
Connection: close

&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
  &amp;lt;AccessControlPolicy xmlns=&quot;http://s3.amazonaws.com/doc/2006-03-01/&quot;&amp;gt;
    &amp;lt;Owner&amp;gt;
      &amp;lt;ID&amp;gt;a6a05c73-fa53-46a4-9ea1-e53b4f625527:a6a05c73-fa53-46a4-9ea1-e53b4f625527&amp;lt;/ID&amp;gt;
      &amp;lt;DisplayName&amp;gt;a6a05c73-fa53-46a4-9ea1-e53b4f625527:a6a05c73-fa53-46a4-9ea1-e53b4f625527&amp;lt;/DisplayName&amp;gt;
    &amp;lt;/Owner&amp;gt;
    &amp;lt;AccessControlList&amp;gt;
      &amp;lt;Grant&amp;gt;
        &amp;lt;Grantee xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:type=&quot;Group&quot;&amp;gt;
          &amp;lt;URI&amp;gt;http://acs.amazonaws.com/groups/global/AllUsers&amp;lt;/URI&amp;gt;
        &amp;lt;/Grantee&amp;gt;
        &amp;lt;Permission&amp;gt;READ&amp;lt;/Permission&amp;gt;
      &amp;lt;/Grant&amp;gt;
      &amp;lt;Grant&amp;gt;
        &amp;lt;Grantee xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:type=&quot;CanonicalUser&quot;&amp;gt;
          &amp;lt;ID&amp;gt;a6a05c73-fa53-46a4-9ea1-e53b4f625527:a6a05c73-fa53-46a4-9ea1-e53b4f6255273&amp;lt;/ID&amp;gt;
          &amp;lt;DisplayName&amp;gt;a6a05c73-fa53-46a4-9ea1-e53b4f625527:a6a05c73-fa53-46a4-9ea1-e53b4f625527&amp;lt;/DisplayName&amp;gt;
        &amp;lt;/Grantee&amp;gt;
        &amp;lt;Permission&amp;gt;FULL_CONTROL&amp;lt;/Permission&amp;gt;
      &amp;lt;/Grant&amp;gt;
    &amp;lt;/AccessControlList&amp;gt;
  &amp;lt;/AccessControlPolicy&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also use &lt;code class=&quot;highlighter-rouge&quot;&gt;aws s3api get-object-acl --bucket BucketName --key ObjectName&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;HEAD Object&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-HEAD-Object&quot; href=&quot;#-HEAD-Object&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;The HEAD operation retrieves metadata from an object without returning the object itself. This operation is useful if you’re only interested in an object’s metadata. To use HEAD, you must have READ access to the object.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;HEAD /my-image.jpg HTTP/1.1
Host: bucket.s3.nl-ams.scw.cloud
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Date: Wed, 28 Oct 2009 22:32:00 GMT
Authorization: authorization string
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;HTTP/1.1 200 OK
x-amz-id-2: ef8yU9AS1ed4OpIszj7UDNEHGran
x-amz-request-id: 318BC8BC143432E5
x-amz-version-id: 3HL4kqtJlcpXroDTDmjVBH40Nrjfkd
Date: Wed, 28 Oct 2009 22:32:00 GMT
Last-Modified: Sun, 1 Jan 2006 12:00:00 GMT
ETag: fba9dede5f27731c9771645a39863328
Content-Length: 434234
Content-Type: text/plain
Connection: close
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also use &lt;code class=&quot;highlighter-rouge&quot;&gt;aws s3api head-object --bucket BucketName --key ObjectName&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;
&lt;h3 class=&quot;anchor-wrap&quot;&gt;POST Object&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-POST-Object&quot; href=&quot;#-POST-Object&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This operation allows you to add an object to a specified bucket using HTML forms. POST is an alternate form of PUT that enables browser-based uploads as a way of putting objects in buckets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;POST /Neo HTTP/1.1
Content-Length: 4
Host: bucket.s3.nl-ams.scw.cloud
x-amz-content-sha256: 003f0e5fe338b17be8be93fec537764ce199ac50f4e50f2685a753c4cc781747
Date: Wed, 01 Mar  2006 12:00:00 GMT
Authorization: authorization string
Content-Type: text/plain
Expect: the 100-continue HTTP status code

ObjectContent
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;HTTP/1.1 100 Continue
HTTP/1.1 200 OK
x-amz-id-2: LriYPLdmOdAiIfgSm/F1YsViT1LW94/xUQxMsF7xiEb1a0wiIOIxl+zbwZ163pt7
x-amz-request-id: 0A49CE4060975EAC
x-amz-version-id: default
Date: Wed, 12 Oct 2009 17:50:00 GMT
ETag: 1b2cf535f27731c974343645a3985328
Content-Length: 0
Connection: close
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;hr /&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;PUT Object&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-PUT-Object&quot; href=&quot;#-PUT-Object&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This operation allows you to add an object to a bucket.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;PUT /example.txt HTTP/1.1

Content-Length: 14
Content-Type: text/plain
Host: bucket.s3.nl-ams.scw.cloud
x-amz-content-sha256: 003f0e5fe338b17be8be93fec537764ce199ac50f4e50f2685a753c4cc781747
x-amz-date: 20170710T194605Z
x-amz-meta-s3cmd-attrs:uid:1000/gname:asb/uname:asb/gid:1000/mode:33204/mtime:1499727909/atime:1499727909/md5:fb08934ef619f205f272b0adfd6c018c/ctime:1499713540
x-amz-storage-class: STANDARD
Authorization: authorization string
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;HTTP/1.1 200 OK

Date: Mon, 10 Jul 2017 19:46:06 GMT
x-amz-request-id: tx0000000000000027bd57c-005963d97e-1268c-ams1
Content-Length: 0
Accept-Ranges: bytes
Last-Modified: Mon, 10 Jul 2017 19:05:09 GMT
Etag: fb08934ef619f205f272b0adfd6c018c
Connection: close
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also use &lt;code class=&quot;highlighter-rouge&quot;&gt;aws s3api put-object --bucket BucketName --key dir-1/ObjectName --body ObjectName&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;PUT Object Copy&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-PUT-Object-Copy&quot; href=&quot;#-PUT-Object-Copy&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This operation allows you to create a new object from an existing one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This example copies &lt;code class=&quot;highlighter-rouge&quot;&gt;my-image.jpg&lt;/code&gt; into the bucket &lt;code class=&quot;highlighter-rouge&quot;&gt;newbucket&lt;/code&gt;, with the key name &lt;code class=&quot;highlighter-rouge&quot;&gt;my-second-image.jpg&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;PUT /my-second-image.jpg HTTP/1.1
Host: oldbucket.s3.nl-ams.scw.cloud
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Date: Wed, 28 Oct 2018 22:18:00 GMT
x-amz-copy-source: /bucket/my-image.jpg
Authorization: authorization string
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;HTTP/1.1 200 OK
x-amz-id-2: eftixk72aD6Ap51TnqcoF8eFidJG9Z/2mkiDFu8yU9AS1ed4OpIszj7UDNEHGran
x-amz-request-id: 318BC8BC148832E5
x-amz-copy-source-version-id: 3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo
x-amz-version-id: QUpfdndhfd8438MNFDN93jdnJFkdmqnh893
Date: Wed, 28 Oct 2018 22:18:00 GMT
Connection: close

&amp;lt;CopyObjectResult&amp;gt;
   &amp;lt;LastModified&amp;gt;2018-10-28T22:18:00&amp;lt;/LastModified&amp;gt;
   &amp;lt;ETag&amp;gt;9b2cf535f27731c974343645a3985328&amp;lt;/ETag&amp;gt;
 &amp;lt;/CopyObjectResult&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also use &lt;code class=&quot;highlighter-rouge&quot;&gt;aws s3api copy-object --copy-source bucket-1/test.txt --key test.txt --bucket bucket-2&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;PUT Object ACL&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-PUT-Object-ACL&quot; href=&quot;#-PUT-Object-ACL&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This operation allows you to use the acl subressource to set the access control list (ACL) permissions for an object that already exists in a bucket. The &lt;code class=&quot;highlighter-rouge&quot;&gt;--acl&lt;/code&gt; subcommand possible values are:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;private&lt;/li&gt;
  &lt;li&gt;public-read&lt;/li&gt;
  &lt;li&gt;public-read-write&lt;/li&gt;
  &lt;li&gt;authenticated-read&lt;/li&gt;
  &lt;li&gt;bucket-owner-read&lt;/li&gt;
  &lt;li&gt;bucket-owner-full-control&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;PUT /sammy.png?acl HTTP/1.1

content-type:application/xml
Host: bucket.s3.nl-ams.scw.cloud
x-amz-content-sha256:c0bd9ba784be78d4f38bbc1e3b0da2de2e7a8f4ee259b3b840369cf00a78dad2
x-amz-date:20170710T192142Z
Authorization: authorization string

&amp;lt;AccessControlPolicy xmlns=&quot;http://s3.amazonaws.com/doc/2006-03-01/&quot;&amp;gt;
  &amp;lt;Owner&amp;gt;
    &amp;lt;ID&amp;gt;6174283&amp;lt;/ID&amp;gt;
  &amp;lt;/Owner&amp;gt;
  &amp;lt;AccessControlList&amp;gt;
    &amp;lt;Grant&amp;gt;
      &amp;lt;Grantee xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:type=&quot;CanonicalUser&quot;&amp;gt;
        &amp;lt;ID&amp;gt;6174283&amp;lt;/ID&amp;gt;
      &amp;lt;/Grantee&amp;gt;
      &amp;lt;Permission&amp;gt;FULL_CONTROL&amp;lt;/Permission&amp;gt;
    &amp;lt;/Grant&amp;gt;
  &amp;lt;/AccessControlList&amp;gt;
&amp;lt;/AccessControlPolicy&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;HTTP/1.1 200 OK

Date: Mon, 10 Jul 2017 19:21:42 GMT
x-amz-request-id: tx0000000000000027aafc9-005963d3c6-1268c-ams1
Content-Type: application/xml
Content-Length: 0
Connection: close
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also use &lt;code class=&quot;highlighter-rouge&quot;&gt;aws s3api put-object-acl --bucket BucjetName --key file.txt --acl private&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;Multipart&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Multipart&quot; href=&quot;#-Multipart&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Multipart upload allows you to upload a single object as a set of parts. Each part is a contiguous portion of the object’s data. You can upload these object parts independently and in any order. If transmission of any part fails, you can retransmit that part without affecting other parts. After all parts of your object are uploaded, Scaleway Object Storage assembles these parts and creates the object.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This operation initiates a multipart upload for the &lt;code class=&quot;highlighter-rouge&quot;&gt;example-object&lt;/code&gt; object.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;POST /example-object?uploads HTTP/1.1
Host: bucketname.s3.scw.cloud
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Date: Mon, 1 Nov 2018 12:34:56 GMT
Authorization: authorization string
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;HTTP/1.1 200 OK
x-amz-id-2: Uuag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg==
x-amz-request-id: 656c76696e6727732072657175657374
Date:  Mon, 1 Nov 2018 12:34:56 GMT
Content-Length: 197
Connection: keep-alive

&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
&amp;lt;InitiateMultipartUploadResult xmlns=&quot;http://s3.amazonaws.com/doc/2006-03-01/&quot;&amp;gt;
  &amp;lt;Bucket&amp;gt;example-bucket&amp;lt;/Bucket&amp;gt;
  &amp;lt;Key&amp;gt;example-object&amp;lt;/Key&amp;gt;
  &amp;lt;UploadId&amp;gt;VXBsb2FkIElEIGZvciA2aWWpbmcncyBteS1tb3ZpZS5tMnRzIHVwbG9hZA&amp;lt;/UploadId&amp;gt;
&amp;lt;/InitiateMultipartUploadResult&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also use &lt;code class=&quot;highlighter-rouge&quot;&gt;aws s3api create-multipart-upload --bucket my-bucket --key 'multipart/01'&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;Generating the Authorization String&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;--Generating-the-Authorization-String&quot; href=&quot;#--Generating-the-Authorization-String&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;You can generate the authorization string, following the &lt;a href=&quot;/docs/s3/generate-awsv4-signature/&quot;&gt;authorization string procedure.&lt;/a&gt;&lt;/p&gt;

&lt;hr /&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;../../s3-object-storage-api/&quot;&gt;Back to the S3 API overview&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><author><name>Scaleway</name><email>contact@scaleway.com</email><uri>https://scaleway.com</uri></author><category term="documentation-api-s3" /><category term="compute" /><category term="networking" /><category term="storage" /><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://scaleway.com/assets/images/og/scaleway.png" /></entry><entry><title type="html">S3 Object Storage - Bucket Operations</title><link href="https://scaleway.com/docs/s3/bucket-operations/" rel="alternate" type="text/html" title="S3 Object Storage - Bucket Operations" /><published>2018-09-14T00:00:00+00:00</published><updated>2018-09-14T00:00:00+00:00</updated><id>https://scaleway.com/docs/s3/bucket-operations</id><content type="html" xml:base="https://scaleway.com/docs/s3/bucket-operations/">&lt;h2 class=&quot;anchor-wrap&quot;&gt;Object Storage - Bucket Operations&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Object-Storage--Bucket-Operations&quot; href=&quot;#-Object-Storage--Bucket-Operations&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;hr /&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;DELETE Bucket&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-DELETE-Bucket&quot; href=&quot;#-DELETE-Bucket&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This operation allows you to delete the bucket mentioned in the command.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;DELETE / HTTP/1.1

Host: bucketname.s3.nl-ams.scw.cloud
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date: 20170710T181321Z
Authorization: authorization string
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This request will delete the bucket named &lt;code class=&quot;highlighter-rouge&quot;&gt;BucketName&lt;/code&gt;. Make sure the bucket is empty to avoid loss of data when you delete it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If the operation is successful no output will be returned.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;HTTP/1.1 204 No Content
Date: Mon, 10 Jul 2017 18:13:21 GMT
Connection: close
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also use &lt;code class=&quot;highlighter-rouge&quot;&gt;aws s3api delete-bucket --bucket my-bucket --region us-east-1&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;GET Bucket&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-GET-Bucket&quot; href=&quot;#-GET-Bucket&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This operation allows to return some or all (up to 1,000) of the objects in a bucket.&lt;/p&gt;

&lt;p&gt;You can use the Example parameters as selection criteria to return a subset of the objects in a bucket.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;GET / HTTP/1.1

Host: bucketname.s3.nl-ams.scw.cloud
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date: 20170711T183940Z
Authorization: authorization string
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;HTTP/1.1 200 OK

x-amz-request-id: tx000000000000002ba2427-0059651b6d-1268c-ams1
Date: Mon, 10 Jul 2017 17:31:43 GMT
Content-Length: 523
Content-Type: text/plain
Connection: close

&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
  &amp;lt;ListAllMyBucketsResult xmlns=&quot;http://s3.amazonaws.com/doc/2006-03-01/&quot;&amp;gt;
    &amp;lt;Owner&amp;gt;
      &amp;lt;ID&amp;gt;6174283&amp;lt;/ID&amp;gt;
      &amp;lt;DisplayName&amp;gt;6174283&amp;lt;/DisplayName&amp;gt;
    &amp;lt;/Owner&amp;gt;
    &amp;lt;Buckets&amp;gt;
      &amp;lt;Bucket&amp;gt;
        &amp;lt;Name&amp;gt;static-images&amp;lt;/Name&amp;gt;
        &amp;lt;CreationDate&amp;gt;2017-06-23T18:37:48.157Z&amp;lt;/CreationDate&amp;gt;
      &amp;lt;/Bucket&amp;gt;
    &amp;lt;Buckets&amp;gt;
      &amp;lt;Bucket&amp;gt;
        &amp;lt;Name&amp;gt;log-files&amp;lt;/Name&amp;gt;
        &amp;lt;CreationDate&amp;gt;2017-06-23T18:37:48.157Z&amp;lt;/CreationDate&amp;gt;
      &amp;lt;/Bucket&amp;gt;
    &amp;lt;/Buckets&amp;gt;
  &amp;lt;/ListAllMyBucketsResult&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also use &lt;code class=&quot;highlighter-rouge&quot;&gt;aws s3api get-bucket --bucket my-bucket&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;GET Bucket ACL&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-GET-Bucket-ACL&quot; href=&quot;#-GET-Bucket-ACL&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This operation allows you to get the ACL of a bucket.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This request triggers the display of the access control list of the bucket &lt;code class=&quot;highlighter-rouge&quot;&gt;BucketName&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;GET /?acl HTTP/1.1

Host: bucketname.s3.nl-ams.scw.cloud
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date: 20180910T174434Z
Authorization: authorization string
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;HTTP/1.1 200 OK

Date: Mon, 10 Sep 2018 17:44:35 GMT
x-amz-request-id: tx000000000000002764fa6-005963bd03-1268c-ams1
Content-Type: application/xml
Content-Length: 621
Connection: close

&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
  &amp;lt;AccessControlPolicy xmlns=&quot;http://s3.amazonaws.com/doc/2006-03-01/&quot;&amp;gt;
    &amp;lt;Owner&amp;gt;
      &amp;lt;ID&amp;gt;a6a05c73-fa53-46a4-9ea1-e53b4f625527:a6a05c73-fa53-46a4-9ea1-e53b4f625527&amp;lt;/ID&amp;gt;
      &amp;lt;DisplayName&amp;gt;a6a05c73-fa53-46a4-9ea1-e53b4f625527:a6a05c73-fa53-46a4-9ea1-e53b4f625527&amp;lt;/DisplayName&amp;gt;
    &amp;lt;/Owner&amp;gt;
    &amp;lt;AccessControlList&amp;gt;
      &amp;lt;Grant&amp;gt;
        &amp;lt;Grantee xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:type=&quot;Group&quot;&amp;gt;
          &amp;lt;URI&amp;gt;http://acs.amazonaws.com/groups/global/AllUsers&amp;lt;/URI&amp;gt;
        &amp;lt;/Grantee&amp;gt;
        &amp;lt;Permission&amp;gt;READ&amp;lt;/Permission&amp;gt;
      &amp;lt;/Grant&amp;gt;
      &amp;lt;Grant&amp;gt;
        &amp;lt;Grantee xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:type=&quot;CanonicalUser&quot;&amp;gt;
          &amp;lt;ID&amp;gt;a6a05c73-fa53-46a4-9ea1-e53b4f625527:a6a05c73-fa53-46a4-9ea1-e53b4f625527&amp;lt;/ID&amp;gt;
          &amp;lt;DisplayName&amp;gt;a6a05c73-fa53-46a4-9ea1-e53b4f625527:a6a05c73-fa53-46a4-9ea1-e53b4f625527&amp;lt;/DisplayName&amp;gt;
        &amp;lt;/Grantee&amp;gt;
        &amp;lt;Permission&amp;gt;FULL_CONTROL&amp;lt;/Permission&amp;gt;
      &amp;lt;/Grant&amp;gt;
    &amp;lt;/AccessControlList&amp;gt;
  &amp;lt;/AccessControlPolicy&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also use &lt;code class=&quot;highlighter-rouge&quot;&gt;aws s3api get-bucket-acl --bucket my-bucket&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;GET Bucket location&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-GET-Bucket-location&quot; href=&quot;#-GET-Bucket-location&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This operation allows you to display the location constraint of a bucket.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;GET /?location HTTP/1.1

Host: bucketname.s3.nl-ams.scw.cloud
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date: 20180908T171432Z
Authorization: authorization string
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No output is returned.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also use &lt;code class=&quot;highlighter-rouge&quot;&gt;aws s3api get-bucket-location --bucket my-bucket&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;HEAD Bucket&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-HEAD-Bucket&quot; href=&quot;#-HEAD-Bucket&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This operation can be used to determine if a bucket exists and you have permission to access it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;HEAD / HTTP/1.1     
Host: bucket.s3.nl-ams.scw.cloud
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Date: date
Authorization: authorization string
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If the bucket exists and you have access to it, no output is returned. Otherwise, an error message will be shown.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also use &lt;code class=&quot;highlighter-rouge&quot;&gt;aws s3api head-bucket --bucket BucketName&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;PUT Bucket&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-PUT-Bucket&quot; href=&quot;#-PUT-Bucket&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This operation allows you to create a new bucket.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;PUT / HTTP/1.1
Host: bucketname.s3.nl-ams.scw.cloud
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Content-Length: 621
x-amz-acl: private
Date: Wed, 19 Sep 2018 15:21:16 GMT
Authorization: authorization string
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMg95r/0zo3emzU4dzsD4rcKCHQUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A01
Date: Wed, 01 Mar  2006 12:00:00 GMT
Location: http://s3.nl-ams.scw.cloud/bucketname
Content-Length: 621
Connection: close
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also use &lt;code class=&quot;highlighter-rouge&quot;&gt;aws s3 mb s3://bucketname&lt;/code&gt; with the command line tools to create a new bucket.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;PUT Bucket ACL&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-PUT-Bucket-ACL&quot; href=&quot;#-PUT-Bucket-ACL&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;This operation allows you to configure the Access Control List of a Bucket.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;PUT /?acl HTTP/1.1

content-type:application/xml
Host: bucketname.s3.nl-ams.scw.cloud
x-amz-content-sha256: 724483e3830b19d6960345c484fb7904b26e8f2fb34a6c002fa779353b68c8d8
x-amz-date: 20180910T183709Z
Authorization: authorization string

&amp;lt;AccessControlPolicy xmlns=&quot;http://s3.amazonaws.com/doc/2006-03-01/&quot;&amp;gt;
  &amp;lt;Owner&amp;gt;
    &amp;lt;ID&amp;gt;6174283&amp;lt;/ID&amp;gt;
  &amp;lt;/Owner&amp;gt;
  &amp;lt;AccessControlList&amp;gt;
    &amp;lt;Grant&amp;gt;
      &amp;lt;Grantee xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:type=&quot;CanonicalUser&quot;&amp;gt;
        &amp;lt;ID&amp;gt;a6a05c73-fa53-46a4-9ea1-e53b4f625527:a6a05c73-fa53-46a4-9ea1-e53b4f625527&amp;lt;/ID&amp;gt;
      &amp;lt;/Grantee&amp;gt;
      &amp;lt;Permission&amp;gt;FULL_CONTROL&amp;lt;/Permission&amp;gt;
    &amp;lt;/Grant&amp;gt;
    &amp;lt;Grant&amp;gt;
      &amp;lt;Grantee xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:type=&quot;Group&quot;&amp;gt;
        &amp;lt;URI&amp;gt;http://acs.amazonaws.com/groups/global/AllUsers&amp;lt;/URI&amp;gt;
      &amp;lt;/Grantee&amp;gt;
      &amp;lt;Permission&amp;gt;READ&amp;lt;/Permission&amp;gt;
    &amp;lt;/Grant&amp;gt;
  &amp;lt;/AccessControlList&amp;gt;
&amp;lt;/AccessControlPolicy&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No output is returned.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also use &lt;code class=&quot;highlighter-rouge&quot;&gt;aws s3api put-bucket-acl --bucket BucketName --acl private&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;Generating the Authorization String&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Generating-the-Authorization-String&quot; href=&quot;#-Generating-the-Authorization-String&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;You can generate the authorization string, following the &lt;a href=&quot;/docs/s3/generate-awsv4-signature/&quot;&gt;authorization string procedure.&lt;/a&gt;&lt;/p&gt;

&lt;hr /&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;../../s3-object-storage-api/&quot;&gt;Back to the S3 API overview&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><author><name>Scaleway</name><email>contact@scaleway.com</email><uri>https://scaleway.com</uri></author><category term="documentation-api-s3" /><category term="compute" /><category term="networking" /><category term="storage" /><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://scaleway.com/assets/images/og/scaleway.png" /></entry><entry><title type="html">S3 Object Storage - Common Operations</title><link href="https://scaleway.com/docs/s3/common-operations/" rel="alternate" type="text/html" title="S3 Object Storage - Common Operations" /><published>2018-09-13T00:00:00+00:00</published><updated>2018-09-13T00:00:00+00:00</updated><id>https://scaleway.com/docs/s3/common-operations</id><content type="html" xml:base="https://scaleway.com/docs/s3/common-operations/">&lt;h2 class=&quot;anchor-wrap&quot;&gt;Object Storage - Common Operations&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Object-Storage--Common-Operations&quot; href=&quot;#-Object-Storage--Common-Operations&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;GET Service&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-GET-Service&quot; href=&quot;#-GET-Service&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;The &lt;code class=&quot;highlighter-rouge&quot;&gt;GET Service&lt;/code&gt; request returns a list of all buckets owned by the authenticated user that sent sent the request.&lt;/p&gt;

&lt;p&gt;The GET Service operation doesn’t list buckets created by other users. It also doesn’t list buckets for anonymous requests.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Request&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;GET / HTTP/1.1
Host: s3.nl-ams.scw.cloud
Date: Wed, 19 Sep 2018 15:00:42 GMT
Authorization: authorization string
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example Response&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?xml version='1.0' encoding='UTF-8'?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;ListAllMyBucketsResult&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://s3.amazonaws.com/doc/2006-03-01/&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;Owner&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;ID&amp;gt;&lt;/span&gt;a6a05c73-fa53-46a4-9ea1-e53b4f625527:a6a05c73-fa53-46a4-9ea1-e53b4f625527&lt;span class=&quot;nt&quot;&gt;&amp;lt;/ID&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;DisplayName&amp;gt;&lt;/span&gt;a6a05c73-fa53-46a4-9ea1-e53b4f625527:a6a05c73-fa53-46a4-9ea1-e53b4f625527&lt;span class=&quot;nt&quot;&gt;&amp;lt;/DisplayName&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/Owner&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;Buckets&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;Bucket&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;Name&amp;gt;&lt;/span&gt;Photos&lt;span class=&quot;nt&quot;&gt;&amp;lt;/Name&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;CreationDate&amp;gt;&lt;/span&gt;2018-09-13T13:13:29.000Z&lt;span class=&quot;nt&quot;&gt;&amp;lt;/CreationDate&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/Bucket&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;Bucket&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;Name&amp;gt;&lt;/span&gt;Documents&lt;span class=&quot;nt&quot;&gt;&amp;lt;/Name&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;CreationDate&amp;gt;&lt;/span&gt;2018-09-13T13:06:34.000Z&lt;span class=&quot;nt&quot;&gt;&amp;lt;/CreationDate&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/Bucket&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/Buckets&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/ListAllMyBucketsResult&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can also use &lt;code class=&quot;highlighter-rouge&quot;&gt;aws s3 ls&lt;/code&gt; with the command line tools to get a listing of your buckets.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;Generating the Authorization String&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Generating-the-Authorization-String&quot; href=&quot;#-Generating-the-Authorization-String&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;You can generate the authorization string, following the &lt;a href=&quot;/docs/s3/generate-awsv4-signature/&quot;&gt;authorization string procedure.&lt;/a&gt;&lt;/p&gt;

&lt;hr /&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;../../s3-object-storage-api/&quot;&gt;Back to the S3 API overview&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><author><name>Scaleway</name><email>contact@scaleway.com</email><uri>https://scaleway.com</uri></author><category term="documentation-api-s3" /><category term="compute" /><category term="networking" /><category term="storage" /><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://scaleway.com/assets/images/og/scaleway.png" /></entry><entry><title type="html">S3 Object Storage API</title><link href="https://scaleway.com/docs/s3-object-storage-api/" rel="alternate" type="text/html" title="S3 Object Storage API" /><published>2018-09-13T00:00:00+00:00</published><updated>2018-09-13T00:00:00+00:00</updated><id>https://scaleway.com/docs/SIS-API-calls</id><content type="html" xml:base="https://scaleway.com/docs/s3-object-storage-api/">&lt;h2 class=&quot;anchor-wrap&quot;&gt;S3 API Feature Availability&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-S3-API-Feature-Availability&quot; href=&quot;#-S3-API-Feature-Availability&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; When you use Object Storage directly with the API, you must generate an &lt;a href=&quot;https://www.scaleway.com/docs/s3/generate-awsv4-signature/&quot;&gt;Authentication Signature v4&lt;/a&gt; beforehand.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We support currently a subset of S3 and the following operations are available:&lt;/p&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;Common Operations&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Common-Operations&quot; href=&quot;#-Common-Operations&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;✔ = Feature available / ✘ = Feature not yet available&lt;/p&gt;

&lt;table class=&quot;doc-matrix-table matrix-table-no-color&quot;&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Feature&lt;/td&gt;
      &lt;td&gt;Status&lt;/td&gt;
      &lt;td&gt;Remark&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;../s3/common-operations/#-GET-Service&quot;&gt;GET Service&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;✔&lt;/td&gt;
      &lt;td&gt;Returns a list of all buckets&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;Bucket Operations&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Bucket-Operations&quot; href=&quot;#-Bucket-Operations&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;✔ = Feature available / ✘ = Feature not yet available&lt;/p&gt;

&lt;table class=&quot;doc-matrix-table matrix-table-no-color&quot;&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Feature&lt;/td&gt;
      &lt;td&gt;Status&lt;/td&gt;
      &lt;td&gt;Remark&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;../s3/bucket-operations/#-DELETE-Bucket&quot;&gt;DELETE Bucket&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;✔&lt;/td&gt;
      &lt;td&gt;Deletes bucket&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;DELETE Bucket analytics&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;DELETE Bucket cors&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;DELETE Bucket encryption&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;DELETE Bucket inventory&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;DELETE Bucket lifecycle&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;DELETE Bucket metrics&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;DELETE Bucket policy&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;DELETE Bucket replication&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;DELETE Bucket tagging&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;DELETE Bucket website&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;../s3/bucket-operations/#-GET-Bucket&quot;&gt;GET Bucket&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;✔&lt;/td&gt;
      &lt;td&gt;Lists objects&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;GET Bucket accelerate&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;../s3/bucket-operations/#-GET-Bucket-ACL&quot;&gt;GET Bucket ACL&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;✔&lt;/td&gt;
      &lt;td&gt;Returns the bucket ACL&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;GET Bucket analytics&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;GET Bucket cors&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;GET Bucket encryption&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;GET Bucket inventory&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;GET Bucket lifecycle&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;../s3/bucket-operations/#-GET-Bucket-location&quot;&gt;GET Bucket location&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;✔&lt;/td&gt;
      &lt;td&gt;Returns the region where the bucket is&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;GET Bucket logging&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;GET Bucket metrics&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;GET Bucket notification&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;GET Bucket Object versions&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;GET Bucket policy&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;GET Bucket replication&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;GET Bucket requestPayment&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;GET Bucket tagging&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;GET Bucket versioning&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;GET Bucket website&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;../s3/bucket-operations/#-HEAD-Bucket&quot;&gt;HEAD Bucket&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;✔&lt;/td&gt;
      &lt;td&gt;Checks if the bucket exists&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;List Bucket Analytics Configurations&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;List Bucket Inventory Configurations&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;List Bucket Metrics Configurations&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;../s3/bucket-operations/#-PUT-Bucket&quot;&gt;PUT Bucket&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;✔&lt;/td&gt;
      &lt;td&gt;Creates bucket&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;PUT Bucket accelerate&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;../s3/bucket-operations/#-PUT-Bucket-ACL&quot;&gt;PUT Bucket ACL&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;✔&lt;/td&gt;
      &lt;td&gt;Configures the Access Control List of a bucket&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;PUT Bucket analytics&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;PUT Bucket cors&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;PUT Bucket encryption&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;PUT Bucket inventory&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;PUT Bucket lifecycle&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;PUT Bucket inventory&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;PUT Bucket logging&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;PUT Bucket notification&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;PUT Bucket policy&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;PUT Bucket replication&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;PUT Bucket requestPayment&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;PUT Bucket tagging&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;PUT Bucket versioning&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;PUT Bucket website&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;Object Operations&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Object-Operations&quot; href=&quot;#-Object-Operations&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;✔ = Feature available / ✘ = Feature not yet available&lt;/p&gt;

&lt;table class=&quot;doc-matrix-table matrix-table-no-color&quot;&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;Feature&lt;/td&gt;
      &lt;td&gt;Status&lt;/td&gt;
      &lt;td&gt;Remark&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;DELETE Multiple Objects&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;../s3/object-operations/#-DELETE-Object&quot;&gt;DELETE Object&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;✔&lt;/td&gt;
      &lt;td&gt;Deletes an object&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;DELETE Object tagging&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;../s3/object-operations/#-GET-Object&quot;&gt;GET Object&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;✔&lt;/td&gt;
      &lt;td&gt;Retrieves an object&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;../s3/object-operations/#-GET-Object-ACL&quot;&gt;GET Object ACL&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;✔&lt;/td&gt;
      &lt;td&gt;Gets the ACL of an object&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;GET Object tagging&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;GET Object torrent&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;../s3/object-operations/#-HEAD-Object&quot;&gt;HEAD Object&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;✔&lt;/td&gt;
      &lt;td&gt;Gets object metadata&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;OPTIONS object&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;../s3/object-operations/#-POST-Object&quot;&gt;POST Object&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;✔&lt;/td&gt;
      &lt;td&gt;Adds an object to a bucket by using HTML forms&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;POST Object restore&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;../s3/object-operations/#-PUT-Object&quot;&gt;PUT Object&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;✔&lt;/td&gt;
      &lt;td&gt;Adds an object to a bucket&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;../s3/object-operations/#-PUT-Object-Copy&quot;&gt;PUT Object copy&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;✔&lt;/td&gt;
      &lt;td&gt;Copies an object&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;../s3/object-operations/#-PUT-Object-ACL&quot;&gt;PUT Object ACL&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;✔&lt;/td&gt;
      &lt;td&gt;Adds an ACL to an object&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;PUT Object tagging&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;SELECT Object Content (Preview)&lt;/td&gt;
      &lt;td&gt;✘&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;../s3/object-operations/#-Multipart&quot;&gt;Multipart&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;✔&lt;/td&gt;
      &lt;td&gt;Initiates, aborts, completes, lists, uploads, uploads copy&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;</content><author><name>Scaleway</name><email>contact@scaleway.com</email><uri>https://scaleway.com</uri></author><category term="advanced topics" /><category term="compute" /><category term="networking" /><category term="storage" /><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://scaleway.com/assets/images/og/scaleway.png" /></entry><entry><title type="html">Backup PostgreSQL databases with Barman</title><link href="https://scaleway.com/docs/postgresql-backup-with-barman/" rel="alternate" type="text/html" title="Backup PostgreSQL databases with Barman" /><published>2018-08-29T00:00:00+00:00</published><updated>2018-08-29T00:00:00+00:00</updated><id>https://scaleway.com/docs/install-configure-barman</id><content type="html" xml:base="https://scaleway.com/docs/postgresql-backup-with-barman/">&lt;h2 class=&quot;anchor-wrap&quot;&gt;Barman Overview&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Barman-Overview&quot; href=&quot;#-Barman-Overview&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://www.pgbarman.org/&quot;&gt;Barman&lt;/a&gt; is an open source administration tool for disaster recovery of PostgreSQL servers. It is written in Python and allows to perform remote backups of multiple servers in business critical environments.&lt;/p&gt;

&lt;p&gt;The tool creates backups based on the PostgreSQL logs and not by performing a simple SQL dump.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Requirements:&lt;/strong&gt;&lt;/p&gt;

  &lt;ul&gt;
    &lt;li&gt;You have an account and are logged into &lt;a href=&quot;https://cloud.scaleway.com&quot;&gt;cloud.scaleway.com&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;You have two servers running a &lt;a href=&quot;https://www.scaleway.com/docs/installation-of-postgresql/&quot;&gt;PostgreSQL database&lt;/a&gt; on Ubuntu Bionic or Xenial&lt;/li&gt;
    &lt;li&gt;You have &lt;a href=&quot;https://www.scaleway.com/docs/configure-new-ssh-key/&quot;&gt;configured your SSH Key&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;You have sudo privileges or access to the root user.&lt;/li&gt;
  &lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h2 class=&quot;anchor-wrap&quot;&gt;Installing Barman&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Installing-Barman&quot; href=&quot;#-Installing-Barman&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This tutorial requires that you have already set up two servers running a &lt;a href=&quot;https://www.scaleway.com/docs/installation-of-postgresql/&quot;&gt;PostgreSQL database&lt;/a&gt;. They will be called &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql-backup&lt;/code&gt; in this tutorial.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As you will backup your databases with Barman, it is recommended to host the application on a different instance than your databases. Ideally in a geographically distant data center. In this tutorial, we install Barman on a second server to migrate the database from one to the other server for backup and redundancy purposes.&lt;/p&gt;

&lt;p&gt;Barman is available in the official APT repositories of Ubuntu. Connect to the second server, called &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql-backup&lt;/code&gt; and install the tool:&lt;/p&gt;

&lt;p&gt;1 . Update the APT packet cache and upgrade the already installed packages to their latest version:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo apt-get update &amp;amp;&amp;amp; sudo apt-get upgrade -y
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;2 . Install Barman:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo apt-get install barman
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 class=&quot;anchor-wrap&quot;&gt;Configuring Barman&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Configuring-Barman&quot; href=&quot;#-Configuring-Barman&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;In order for Barman to copy data between the two servers, some pre-work is required:&lt;/p&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;Creating a dedicated PostgreSQL user on `pgsql`&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Creating-a-dedicated-PostgreSQL-user-on-pgsql&quot; href=&quot;#-Creating-a-dedicated-PostgreSQL-user-on-pgsql&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;As Barman has been installed on the second server (&lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql-backup&lt;/code&gt;), it is required to create a database user for the tool on the first server (&lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;1 . Connect on the server &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql&lt;/code&gt; and log into the &lt;code class=&quot;highlighter-rouge&quot;&gt;postgres&lt;/code&gt; account:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo -i -u postgres
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;2 . Create the user and enter twice the desired password. When asked if the account should have superuser privileges, type &lt;strong&gt;y&lt;/strong&gt; and press &lt;strong&gt;Enter&lt;/strong&gt;:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;createuser --interactive -P barman
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;3 . Enable the connection to the server from &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql-backup&lt;/code&gt; by editing the file &lt;strong&gt;/etc/postgresql/9.5/postgresql.conf&lt;/strong&gt;. Change the value of &lt;code class=&quot;highlighter-rouge&quot;&gt;listen_addresses&lt;/code&gt; to the new server, or use an asterisk to enable the connection from any IP.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;listen_addresses = 'localhost, pgsql-backup'
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;4 . Restart the service&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo service postgresql restart
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Test the connection from &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql-backup&lt;/code&gt; by running a SQL query:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;psql -c 'SELECT version()' -U barman -h pgsql postgres
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;Creating the .pgpass file on pgsql-backup&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Creating-the-pgpass-file-on-pgsqlbackup&quot; href=&quot;#-Creating-the-pgpass-file-on-pgsqlbackup&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;During the installation of Barman on the server &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql-backup&lt;/code&gt;, a system user account called &lt;strong&gt;barman&lt;/strong&gt; was created.&lt;/p&gt;

&lt;p&gt;1 . Set a password for the user:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo passwd barman
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;2 . Enter the user account:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo -i -u barman
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;3 . Create the &lt;strong&gt;.pgpass&lt;/strong&gt; file for the barman user:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;echo &quot;pgsql:5432:*:barman:password&quot; &amp;gt;&amp;gt; ~/.pgpass
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The data format for the .pgpass file is &lt;code class=&quot;highlighter-rouge&quot;&gt;hostname:port:database:username:password&lt;/code&gt;.&lt;br /&gt;
If an asterisk is used in any of the first four fields, it will correspond to everything. The username refers to the PostgreSQL user that was created previously, not to the linux user account. You may refer to the &lt;a href=&quot;https://www.postgresql.org/docs/current/static/libpq-pgpass.html&quot;&gt;official documentation&lt;/a&gt; for more information about this file.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The file .pgpass in a user’s home directory can contain passwords to be used if the connection requires a password (and no password has been specified otherwise).&lt;/p&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;Setting up key-based authentication&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Setting-up-keybased-authentication&quot; href=&quot;#-Setting-up-keybased-authentication&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;To perform backups without manual authentication, generate an SSH key that will be used for authentication:&lt;/p&gt;

&lt;p&gt;In order to perform backups without user intervention, we need to set up and copy SSH keys for passwordless authentication. Barman makes use of this method to copy data through rsync.&lt;/p&gt;

&lt;p&gt;1 . Connect to the server &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql-backup&lt;/code&gt;, switch to user &lt;strong&gt;barman&lt;/strong&gt; and generate the keys&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ssh-keygen -t rsa
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;2 . Copy the key to the user account &lt;strong&gt;postgres&lt;/strong&gt; on &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ssh-copy-id postgres@pgsql
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The following message will appear if the transfer of the key has been successful:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Number of key(s) added: 1

Now try logging into the machine, with:   &quot;ssh 'postgres@pgsql'&quot;
and check to make sure that only the key(s) you wanted were added.
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;3 . Barman also requires access to the postgres account on the server &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql-backup&lt;/code&gt;. Copy the key into the directory of the &lt;strong&gt;postgres&lt;/strong&gt; user and test the connection:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ssh-copy-id postgres@localhost
ssh postgres@localhost -C true
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;4 . Once this is done, log in as &lt;strong&gt;postgres&lt;/strong&gt; user on &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql&lt;/code&gt; and generate an SSH key:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ssh-keygen -t rsa
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;5 . Copy the generated key to the list of authorized keys of the user &lt;strong&gt;barman&lt;/strong&gt; on &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql-backup&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ssh-copy-id barman@pgsql-backup
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;6 . Test the connection to the server:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ssh barman@pgsql-backup -C true
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;Configuring Barman&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Configuring-Barman&quot; href=&quot;#-Configuring-Barman&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;The configuration of Barman is done on the server &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql-backup&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;1 . Create the directory &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/barman.d&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkdir /etc/barman.d
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;2 . Open the file &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/barman.conf&lt;/code&gt; and remove the leading semicolon (&lt;strong&gt;;&lt;/strong&gt;) from the following line:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;;configuration_files_directory = /etc/barman.d
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;3 . Enter the directory &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/barman.d&lt;/code&gt; and create a file &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql.conf&lt;/code&gt; with the following content:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[pgsql]
description =  &quot;Old PostgreSQL server&quot;
conninfo = host=10.55.66.77 user=barman dbname=Our_Database
ssh_command = ssh postgres@pgsql
retention_policy = RECOVERY WINDOW OF 2 WEEKS
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The information in this file are self-explanatory. The &lt;strong&gt;retention_policy&lt;/strong&gt; defines the time frame during which backups are kept. This can be set to your needs. For more information about this file you may refer to the &lt;a href=&quot;http://docs.pgbarman.org/release/2.4/#configuration&quot;&gt;official documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;Configuring PostgreSQL&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Configuring-PostgreSQL&quot; href=&quot;#-Configuring-PostgreSQL&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;1 . Connect to &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql&lt;/code&gt; and add this line to the file &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/postgresql/9.5/main/pg_hba.conf&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;host    all             all             10.55.66.88/32         trust
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Where &lt;em&gt;10.55.66.77&lt;/em&gt; should be replaced with the IP of &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql-backup&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;2 . Open the file &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/postgresql/9.5/main/postgresql.conf&lt;/code&gt; and edit the values as shown:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;wal_level = archive
archive_mode = on
archive_command = 'rsync -a %p barman@10.55.66.77:/var/lib/barman/pgsql/incoming/%f'
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;3 . Restart the postgresql service:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo systemctl restart postgresql
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;5 . Check if the connection to the server &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql&lt;/code&gt; works from Barman, by runnning the command &lt;code class=&quot;highlighter-rouge&quot;&gt;barman check pgsql&lt;/code&gt; after logging into the &lt;strong&gt;barman&lt;/strong&gt; user account on &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql-backup&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;barman@pgsql-backup:~$ barman check pgsql
Server pgsql:
    PostgreSQL: OK
    archive_mode: OK
    wal_level: OK
    archive_command: OK
    continuous archiving: OK
    directories: OK
    retention policy settings: OK
    backup maximum age: OK (no last_backup_maximum_age provided)
    compression settings: OK
    minimum redundancy requirements: OK (have 0 backups, expected at least 0)
    ssh: OK (PostgreSQL server)
    not in recovery: OK
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;If all values are &lt;strong&gt;OK&lt;/strong&gt;, you are ready to make your first backup.&lt;/p&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;Performing Backups&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Performing-Backups&quot; href=&quot;#-Performing-Backups&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;1 . Start a backup with the command &lt;code class=&quot;highlighter-rouge&quot;&gt;barman backup pgsql&lt;/code&gt;. You will see an output like the following:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;barman@pgsql-backup:~$ barman backup pgsql
Starting backup for server pgsql in /var/lib/barman/pgsql/base/20180911T115925
Backup start at xlog location: 0/2000028 (000000010000000000000002, 00000028)
Copying files.
Copy done.
Asking PostgreSQL server to finalize the backup.
Backup size: 20.7 MiB
Backup end at xlog location: 0/20000C0 (000000010000000000000002, 000000C0)
Backup completed
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;2 . To view a list of all backups available of &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql&lt;/code&gt;, use the command&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;barman list-backup pgsql
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;3 . To view the details about a backup, use the following command:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;barman show-backup pgsql backup_id
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The &lt;strong&gt;backup_id&lt;/strong&gt; is visible from the backup list and in the form like this example &lt;strong&gt;20180911T115925&lt;/strong&gt;.&lt;/p&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;Restoring Backups&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Restoring-Backups&quot; href=&quot;#-Restoring-Backups&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;It is possible to import the backup in the PostgreSQL server running on &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql-backup&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;1 . Stop the postgresql service:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo systemctl stop postgresql
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;2 . Load the backup into the database with the following command:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;barman recover --remote-ssh-command &quot;ssh postgres@localhost&quot; pgsql 20180911T115925 /var/lib/postgresql/9.5/main
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;You will see an output like the following:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Starting remote restore for server pgsql using backup 20180911T115925
Destination directory: /var/lib/postgresql/9.5/main
Copying the base backup.
Copying required WAL segments.
Generating archive status files
Your PostgreSQL server has been successfully prepared for recovery!
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;3 . Once the backup has been imported, restart the postgresql service:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo systemctl start postgresql
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Your database has now successfully migrated to your new database server.&lt;/p&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;Automatizing Backups&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Automatizing-Backups&quot; href=&quot;#-Automatizing-Backups&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;It is possible to run Barman automatically to backup the content of your database regularly. This can be done easily by setting up a cron job on &lt;code class=&quot;highlighter-rouge&quot;&gt;pgsql-backup&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;1 . Switch into the &lt;strong&gt;barman&lt;/strong&gt; user:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo -i -u barman
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;2 . Edit the crontab of the user:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;crontab -e
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;3 . To run a backup daily at 3:30, add the following line to the cron tab and save it:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;30 03 * * * /usr/bin/barman backup pgsql
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</content><author><name>Scaleway</name><email>contact@scaleway.com</email><uri>https://scaleway.com</uri></author><category term="advanced topics" /><category term="compute" /><category term="networking" /><category term="security" /><category term="backup" /><category term="barman" /><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://scaleway.com/assets/images/og/scaleway.png" /></entry><entry><title type="html">How to Configure Hadoop on Ubuntu Xenial</title><link href="https://scaleway.com/docs/how-to-install-hadoop-standalone-on-ubuntu/" rel="alternate" type="text/html" title="How to Configure Hadoop on Ubuntu Xenial" /><published>2018-08-29T00:00:00+00:00</published><updated>2018-08-29T00:00:00+00:00</updated><id>https://scaleway.com/docs/Hadoop</id><content type="html" xml:base="https://scaleway.com/docs/how-to-install-hadoop-standalone-on-ubuntu/">&lt;h2 id=&quot;hadoop-overview&quot;&gt;Hadoop Overview&lt;/h2&gt;

&lt;p&gt;Hadoop is an open source framework. It is provided by Apache to process and analyze very huge volume of data. It is written in Java and currently
used by Google, Facebook, LinkedIn, Yahoo, Twitter etc. Similar to data residing in a local file system of personal computer system, in Hadoop, data resides in a distributed file system which is called as a Hadoop Distributed File system. Hadoop is suitable for:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Big Data Analysis:&lt;/strong&gt; Big Data tends to be distributed and unstructured in nature. Hadoop processes the logic (not the actual data) that flows to the computing nodes, less network bandwidth is consumed. This concept is called as data locality concept which helps increase efficiency of Hadoop based applications.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Scalability:&lt;/strong&gt; Hadoop clusters can easily be scaled to any extent by adding additional cluster nodes&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Fault Tolerance:&lt;/strong&gt; Hadoop ecosystem has a provision to replicate the input data on to other cluster nodes. That way, in the event of a cluster node failure, data processing can still proceed by using data stored on another cluster node.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hadoop clusters are relatively complex to set up, so the project includes a stand-alone mode which is suitable for learning about Hadoop, performing simple operations, and debugging.&lt;/p&gt;

&lt;p&gt;Hadoop is comprised of four main layers:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Hadoop Common&lt;/strong&gt; is the collection of utilities and libraries that support other Hadoop modules.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;HDFS&lt;/strong&gt;, which stands for Hadoop Distributed File System, is responsible for persisting data to disk.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;YARN&lt;/strong&gt;, short for Yet Another Resource Negotiator, is the “operating system” for HDFS.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;MapReduce&lt;/strong&gt; is the original processing model for Hadoop clusters. It distributes work within the cluster or map, then organizes and reduces the results from the nodes into a response to a query. Many other processing models are available for the 3.x version of Hadoop.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For more information, refer to the &lt;a href=&quot;http://hadoop.apache.org/#What+Is+Apache+Hadoop%3F&quot;&gt;official Apache Hadoop documentation.&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Requirements:&lt;/strong&gt;&lt;/p&gt;

  &lt;ul&gt;
    &lt;li&gt;You have an account and are logged into &lt;a href=&quot;https://cloud.scaleway.com&quot;&gt;cloud.scaleway.com&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;You have &lt;a href=&quot;https://www.scaleway.com/docs/configure-new-ssh-key/&quot;&gt;configured your SSH Key&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;You have sudo privileges or access to the root user.&lt;/li&gt;
  &lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;installing-the-default-jrejdk&quot;&gt;Installing the Default JRE/JDK&lt;/h2&gt;

&lt;p&gt;1 . Update the package index&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;apt-get update
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;2 . Install Java. Specifically, this command will install the Java Runtime Environment (JRE).&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;apt-get install default-jre
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;There is another default Java installation called the JDK (Java Development Kit). The JDK is usually only needed if you are going to compile Java programs or if the software that will use Java specifically requires it.&lt;/p&gt;

&lt;p&gt;The JDK does contain the JRE, so there are no disadvantages if you install the JDK instead of the JRE, except for the larger file size. You can install the JDK with the following command:
&lt;code class=&quot;highlighter-rouge&quot;&gt;apt-get install default-jdk &lt;/code&gt;&lt;/p&gt;

&lt;p&gt;3 . Once the installation is complete, let’s check the version.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;java -version
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;which returns&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-0ubuntu0.16.04.1-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 id=&quot;installing-hadoop-in-standalone-mode&quot;&gt;Installing Hadoop in Standalone Mode&lt;/h2&gt;

&lt;p&gt;Visit the &lt;a href=&quot;http://hadoop.apache.org/releases.html&quot;&gt;Apache Hadoop Releases page&lt;/a&gt; to select the most recent stable release. We will install Hadoop version 3.1.1&lt;/p&gt;

&lt;p&gt;1 . Copy the link to the release binary.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/docs/apacheDL.png&quot; alt=&quot;apacheDL&quot; class=&quot;img-responsive&quot; /&gt;&lt;/p&gt;

&lt;p&gt;2 . Use &lt;code class=&quot;highlighter-rouge&quot;&gt;wget&lt;/code&gt; to fetch it:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;wget http://mirrors.standaloneinstaller.com/apache/hadoop/common/hadoop-3.1.1/hadoop-3.1.1.tar.gz
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;In order to make sure that the file we downloaded has not been altered, we’ll do a quick check using &lt;a href=&quot;https://en.wikipedia.org/wiki/SHA-2&quot;&gt;SHA-256&lt;/a&gt;. Return to the releases page, then click and copy the link to the checksum file for the release binary you downloaded:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/docs/checksumDL.png&quot; alt=&quot;checksumDL&quot; class=&quot;img-responsive&quot; /&gt;&lt;/p&gt;

&lt;p&gt;3 . Copy the link displayed in the browser and use &lt;code class=&quot;highlighter-rouge&quot;&gt;wget&lt;/code&gt; on our server to download the file&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;wget https://dist.apache.org/repos/dist/release/hadoop/common/hadoop-3.1.1/hadoop-3.1.1.tar.gz.mds
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;4 . Run the verification&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;shasum -a 256 hadoop-3.1.1.tar.gz
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;which returns&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;f837fe260587f71629aad1f4fb6719274e948111dc96ffc5a8e26f27deac5602  hadoop-3.1.1.tar.gz
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;5 . Compare this value with the SHA-256 value in the .mds file:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cat hadoop-3.1.1.tar.gz.mds
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The output of the command we ran against the file we downloaded from the mirror should match the value in the file we downloaded from &lt;code class=&quot;highlighter-rouge&quot;&gt;apache.org.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;6 . Use the tar command with the &lt;code class=&quot;highlighter-rouge&quot;&gt;-x&lt;/code&gt; flag to extract, &lt;code class=&quot;highlighter-rouge&quot;&gt;-z&lt;/code&gt; to uncompress, &lt;code class=&quot;highlighter-rouge&quot;&gt;-v&lt;/code&gt; for verbose output, and &lt;code class=&quot;highlighter-rouge&quot;&gt;-f&lt;/code&gt; to specify that we’re extracting from a file.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;tar -xzvf hadoop-3.1.1.tar.gz
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;7 . Move the extracted files into &lt;code class=&quot;highlighter-rouge&quot;&gt;/usr/local&lt;/code&gt;. Change the version number to match the version you downloaded.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mv hadoop-3.1.1 /usr/local/hadoop
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 id=&quot;configuring-hadoops-java-home&quot;&gt;Configuring Hadoop’s Java Home&lt;/h2&gt;

&lt;p&gt;Hadoop requires that you set the path to Java, either as an environment variable or in the Hadoop configuration file.&lt;/p&gt;

&lt;p&gt;The path to Java, &lt;code class=&quot;highlighter-rouge&quot;&gt;/usr/bin/java&lt;/code&gt; is a symbolic link to &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/alternatives/java&lt;/code&gt;, which is a symbolic link to the default Java binary.&lt;/p&gt;

&lt;p&gt;Use &lt;code class=&quot;highlighter-rouge&quot;&gt;readlink&lt;/code&gt; command with the &lt;code class=&quot;highlighter-rouge&quot;&gt;-f&lt;/code&gt; option to follow every symbolic link in every part of the path, recursively. Then, use &lt;code class=&quot;highlighter-rouge&quot;&gt;sed&lt;/code&gt; to trim &lt;code class=&quot;highlighter-rouge&quot;&gt;bin/java&lt;/code&gt; from the output to give us the correct value for &lt;code class=&quot;highlighter-rouge&quot;&gt;JAVA_HOME&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To find the default Java path, launch:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;readlink -f /usr/bin/java | sed &quot;s:bin/java::&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;which returns&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/usr/lib/jvm/java-8-openjdk-amd64/jre/
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;You can copy this output to set Hadoop’s Java home to this specific version, which ensures that if the default Java changes, this value will not. Or, you can use the &lt;code class=&quot;highlighter-rouge&quot;&gt;readlink&lt;/code&gt; command dynamically in the file so that Hadoop will automatically use whatever Java version is set as the system default.&lt;/p&gt;

&lt;p&gt;1 . Open &lt;code class=&quot;highlighter-rouge&quot;&gt;hadoop-env.sh&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo nano /usr/local/hadoop/etc/hadoop/hadoop-env.sh
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; With respect to Hadoop, the value of JAVA_HOME in hadoop-env.sh overrides any values that are set in the environment by /etc/profile or in a user’s profile.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;2 . Select one of the following options:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option 1: Static Value&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;. . .
#export JAVA_HOME=${JAVA_HOME}
export JAVA_HOME=//usr/lib/jvm/java-8-openjdk-amd64/jre/
. . .
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Option 2: Dynamic Value&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;. . .
#export JAVA_HOME=${JAVA_HOME}
export JAVA_HOME=$(readlink -f /usr/bin/java | sed &quot;s:bin/java::&quot;)
 . . .
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 id=&quot;running-hadoop&quot;&gt;Running Hadoop&lt;/h2&gt;

&lt;p&gt;Run Hadoop&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/usr/local/hadoop/bin/hadoop
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;which returns&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Usage: hadoop [OPTIONS] SUBCOMMAND [SUBCOMMAND OPTIONS]
 or    hadoop [OPTIONS] CLASSNAME [CLASSNAME OPTIONS]
  where CLASSNAME is a user-provided Java class

  OPTIONS is none or any of:

buildpaths                       attempt to add class files from build tree
--config dir                     Hadoop config directory
--debug                          turn on shell script debug mode
--help                           usage information
hostnames list[,of,host,names]   hosts to use in slave mode
hosts filename                   list of hosts to use in slave mode
loglevel level                   set the log4j level for this command
workers                          turn on worker mode
...

&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The help means we’ve successfully configured Hadoop to run in stand-alone mode.
To make sure Hadoop is running properly, we will use an example of a MapReduce program.&lt;/p&gt;

&lt;h2 id=&quot;mapreduce-example&quot;&gt;MapReduce Example&lt;/h2&gt;

&lt;p&gt;MapReduce is a programming framework that allows us to perform distributed and parallel processing on large data sets in a distributed environment.&lt;/p&gt;

&lt;p&gt;MapReduce consists of two distinct tasks – Map and Reduce. As the name MapReduce suggests, reducer phase takes place after mapper phase has been completed.&lt;/p&gt;

&lt;p&gt;1 . Create a directory called &lt;code class=&quot;highlighter-rouge&quot;&gt;input&lt;/code&gt; in our home directory&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkdir ~/input
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;2 . Copy Hadoop’s configuration files into it to use those files as our data.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cp /usr/local/hadoop/etc/hadoop/*.xml ~/input
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;3 . Download Hadoop example&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;wget  https://jar-download.com/cache_jars/org.apache.hadoop/hadoop-mapreduce-examples/3.0.3/jar_files.zip
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;4 . Unzip the file&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;unzip jar_files.zip
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;5 . Move the &lt;code class=&quot;highlighter-rouge&quot;&gt;jar_files&lt;/code&gt; to &lt;code class=&quot;highlighter-rouge&quot;&gt;/usr/local/hadoop/share/hadoop/mapreduce/hadoop/&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mv hadoop-mapreduce-examples-3.0.3.jar /usr/local/hadoop/share/hadoop/mapreduce/.
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt;
Verify that your /etc/hosts file is properly setup and contains at least the following: &lt;code class=&quot;highlighter-rouge&quot;&gt;127.0.0.1  localhost &amp;lt;your hostname&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;6 .  Use the following command to run the MapReduce &lt;code class=&quot;highlighter-rouge&quot;&gt;hadoop-mapreduce-examples&lt;/code&gt; program. We’ll invoke its grep program which counts the matches of a literal word or regular expression (e.g., &lt;code class=&quot;highlighter-rouge&quot;&gt;allowed&lt;/code&gt;).&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/usr/local/hadoop/bin/hadoop jar /usr/local/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.0.3.jar grep ~/input ~/grep_example 'allowed[.]*'
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Results are stored in the output directory and can be checked by running cat on the output directory:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cat ~/grep_example/*
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;which returns&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;19  allowed
1   allowed
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</content><author><name>Scaleway</name><email>contact@scaleway.com</email><uri>https://scaleway.com</uri></author><category term="getting started" /><category term="account" /><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://scaleway.com/assets/images/og/scaleway.png" /></entry><entry><title type="html">Installation of PostgreSQL</title><link href="https://scaleway.com/docs/installation-of-postgresql/" rel="alternate" type="text/html" title="Installation of PostgreSQL" /><published>2018-08-24T00:00:00+00:00</published><updated>2018-08-24T00:00:00+00:00</updated><id>https://scaleway.com/docs/setup-postgresql</id><content type="html" xml:base="https://scaleway.com/docs/installation-of-postgresql/">&lt;h2 class=&quot;anchor-wrap&quot;&gt;PostgreSQL Overview&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-PostgreSQL-Overview&quot; href=&quot;#-PostgreSQL-Overview&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://www.postgresql.org/&quot;&gt;PostgreSQL&lt;/a&gt; is a mature and advanced open source relational database system. With more than 30 years of active development, the software has earned a strong reputation for reliability, feature robustness, and performance.&lt;/p&gt;

&lt;p&gt;It runs on all major operating systems, including Linux, different Unix variants, MacOS X and Windows. This tutorial describes how to run it on an Ubuntu based server.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Requirements:&lt;/strong&gt;&lt;/p&gt;
  &lt;ul&gt;
    &lt;li&gt;You have an account and are logged into &lt;a href=&quot;https://cloud.scaleway.com&quot;&gt;cloud.scaleway.com&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;You have an Ubuntu Bionic (18.04) server&lt;/li&gt;
    &lt;li&gt;You have &lt;a href=&quot;https://www.scaleway.com/docs/configure-new-ssh-key/&quot;&gt;configured your SSH Key&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;You have sudo privileges or access to the root user.&lt;/li&gt;
  &lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h2 class=&quot;anchor-wrap&quot;&gt;Installing PostgreSQL&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Installing-PostgreSQL&quot; href=&quot;#-Installing-PostgreSQL&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;PostgreSQL provides an APT mirror with the latest builds of the software.&lt;/p&gt;

&lt;p&gt;1 . Add the Postgres mirror, update the APT packet cache and install the required packages:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo apt-get install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo &quot;deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main&quot; &amp;gt; /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install postgresql-10 postgresql-contrib
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 class=&quot;anchor-wrap&quot;&gt;Using PostgreSQL Roles and Databases&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Using-PostgreSQL-Roles-and-Databases&quot; href=&quot;#-Using-PostgreSQL-Roles-and-Databases&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Postgres uses a concept similar to regular Unix-style accounts, called &lt;strong&gt;roles&lt;/strong&gt;. However Postgres does not distinguish between users and groups and uses the more flexible term role.&lt;/p&gt;

&lt;p&gt;By default Postgres is configured to use ident authentication, which means matching a role with a Unix/Linux system account&lt;/p&gt;

&lt;p&gt;If a role exists in Postgres a system user with the same name is able to sign in as that role.&lt;/p&gt;

&lt;p&gt;During the installation a user called &lt;code class=&quot;highlighter-rouge&quot;&gt;postgres&lt;/code&gt; has been created and is used to log into that account having the default Postgres role.&lt;/p&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;Logging into PostgreSQL from the actual account&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Logging-into-PostgreSQL-from-the-actual-account&quot; href=&quot;#-Logging-into-PostgreSQL-from-the-actual-account&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;You can access the postgres account directly and the PostgreSQL prompt with sudo.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo -u postgres psql
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;To quit the prompt, type:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;\q
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h3 class=&quot;anchor-wrap&quot;&gt;Logging into PostgreSQL from the postgres Account&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Logging-into-PostgreSQL-from-the-postgres-Account&quot; href=&quot;#-Logging-into-PostgreSQL-from-the-postgres-Account&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;It is also possible to login from the postgres account by using an intermediate bash.&lt;/p&gt;

&lt;p&gt;Switch into the postgres account:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo -i -u postgres
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;To access the command prompt, type:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;psql
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;To exit the prompt tpye:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;\q
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 class=&quot;anchor-wrap&quot;&gt;Creating New Roles&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Creating-New-Roles&quot; href=&quot;#-Creating-New-Roles&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;By default, only the &lt;strong&gt;postgres&lt;/strong&gt; role is configured within the database. Adding of new roles can be done with the command &lt;code class=&quot;highlighter-rouge&quot;&gt;createrole&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You can either create the new role by using sudo from your regular account:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo -u postgres createuser --interactive
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;If you are logged as the &lt;strong&gt;postgres&lt;/strong&gt; user, launch the command as following:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;createuser --interactive
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;You will be asked to enter the name of the new role and some additional questions:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;root@pgsql:~# sudo -u postgres createuser --interactive
Enter name of role to add: bill
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;More information about the usage of the &lt;code class=&quot;highlighter-rouge&quot;&gt;createuser&lt;/code&gt; command is available in the &lt;a href=&quot;https://www.postgresql.org/docs/11/static/app-createuser.html&quot;&gt;official documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h2 class=&quot;anchor-wrap&quot;&gt;Creating New Databases&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Creating-New-Databases&quot; href=&quot;#-Creating-New-Databases&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;The authentication system of Postgres assumes by default that a database exists with the same name as the role .&lt;/p&gt;

&lt;p&gt;This means if you have created a role &lt;strong&gt;bill&lt;/strong&gt; in the previous step, Postgres will by attempt by default to connect to a database bill.&lt;/p&gt;

&lt;p&gt;From your regular user, you can launch the command with sudo:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo -u postgres createdb bill
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;If you are logged directly as the postgres user, run the following command:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;createdb bill
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;For more information, you may consult the &lt;a href=&quot;https://www.postgresql.org/docs/11/static/app-createdb.html&quot;&gt;official documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h2 class=&quot;anchor-wrap&quot;&gt;Connecting to a Postgres Prompt with the new Role&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Connecting-to-a-Postgres-Prompt-with-the-new-Role&quot; href=&quot;#-Connecting-to-a-Postgres-Prompt-with-the-new-Role&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;The &lt;code class=&quot;highlighter-rouge&quot;&gt;ident&lt;/code&gt; based authentication requires a matching Linux user with the same name as the Postgres role and database. If it does not exist yet, create the user with the following command:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo adduser bill
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;If the previous steps have been followed, login now into the database with the following command:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo -u bill psql
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 class=&quot;anchor-wrap&quot;&gt;Creating and Querying Databases&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Creating-and-Querying-Databases&quot; href=&quot;#-Creating-and-Querying-Databases&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;To understand the basic SQL syntax, we create a phonebook that contains a user personal details:&lt;/p&gt;

&lt;p&gt;1 . Connect to the Postgres prompt.&lt;/p&gt;

&lt;p&gt;2 . Create a new table called phonebook, that contains fields for the phone number, first and last name and the city:&lt;/p&gt;
&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;CREATE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;TABLE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;phonebook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;phone&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;firstname&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lastname&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;city&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;VARCHAR&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;3 . Insert data into the table. You may repeat this command if you want to add more than one set of data:&lt;/p&gt;
&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;INSERT&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;INTO&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;phonebook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;phone&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;firstname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lastname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;city&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;VALUES&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'+33 1 23 45 67 89'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Paul'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Smith'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Paris, FR'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;4 . Select data from the table. Run the following command to retrieve all data sets, sorted by the lastname&lt;/p&gt;
&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;phonebook&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lastname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;This will give you an result like the following:&lt;/p&gt;
&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;bill&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=#&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;phonebook&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lastname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
       &lt;span class=&quot;n&quot;&gt;phone&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;firstname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lastname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;     &lt;span class=&quot;n&quot;&gt;city&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;-------------------+-----------+----------+---------------&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;33&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;23&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;45&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;67&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;89&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Paul&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Smith&lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Paris&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FR&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;33&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;87&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;65&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;43&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;21&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Jessica&lt;/span&gt;   &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;White&lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Marseille&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FR&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;rows&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;To retrieve all entries in the phonebook where the family name is Smith, run:&lt;/p&gt;
&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;phonebook&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lastname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Smith'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;You will get an result as the following:&lt;/p&gt;
&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;bill&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=#&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;phonebook&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lastname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Smith'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
       &lt;span class=&quot;n&quot;&gt;phone&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;firstname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lastname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;   &lt;span class=&quot;n&quot;&gt;city&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;-------------------+-----------+----------+-----------&lt;/span&gt;
 &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;33&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;23&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;45&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;67&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;89&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Paul&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Smith&lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Paris&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FR&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;5 . Update the city of a user:&lt;/p&gt;
&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;UPDATE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;phonebook&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;city&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'London, UK'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;phone&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'+44 7123 456789'&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;firstname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Paul'&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lastname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Smith'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;6 . Delete the data of a user:&lt;/p&gt;
&lt;div class=&quot;language-sql highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;DELETE&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;phonebook&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;firstname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Paul'&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lastname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'Smith'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</content><author><name>Scaleway</name><email>contact@scaleway.com</email><uri>https://scaleway.com</uri></author><category term="getting started" /><category term="compute" /><category term="networking" /><category term="database" /><category term="sql" /><category term="postgresql" /><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://scaleway.com/assets/images/og/scaleway.png" /></entry><entry><title type="html">How to Configure Flask on Ubuntu Xenial</title><link href="https://scaleway.com/docs/how-to-install-flask-on-your-server/" rel="alternate" type="text/html" title="How to Configure Flask on Ubuntu Xenial" /><published>2018-08-23T00:00:00+00:00</published><updated>2018-08-23T00:00:00+00:00</updated><id>https://scaleway.com/docs/flask</id><content type="html" xml:base="https://scaleway.com/docs/how-to-install-flask-on-your-server/">&lt;h2 id=&quot;flask-overview&quot;&gt;Flask Overview&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;http://flask.pocoo.org/&quot;&gt;Flask&lt;/a&gt; is a web application framework written
in Python. Flask is easy to get started with as a beginner because
there is little boilerplate code for getting a simple app up and
running.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Requirements:&lt;/strong&gt;&lt;/p&gt;
  &lt;ul&gt;
    &lt;li&gt;You have an account and are logged into
&lt;a href=&quot;https://cloud.scaleway.com&quot;&gt;cloud.scaleway.com&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;You have an Ubuntu Xenial server&lt;/li&gt;
    &lt;li&gt;You have &lt;a href=&quot;https://www.scaleway.com/docs/configure-new-ssh-key/&quot;&gt;configured your SSH
Key&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;installing-python&quot;&gt;Installing Python&lt;/h2&gt;

&lt;p&gt;If you don’t have Python installed on your computer, download the
installer from the Python &lt;a href=&quot;https://www.python.org/downloads/&quot;&gt;official
website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To make sure your Python installation is functional, you can open a
terminal window and type python3, or if that does not work, just python.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;python3
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;which returns&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;To exit the interactive prompt, you can type exit() and press Enter. On
the Linux and Mac OS X versions of Python you can also exit the
interpreter by pressing Ctrl-D. On Windows, the exit shortcut is Ctrl-Z
followed by Enter.&lt;/p&gt;

&lt;h2 id=&quot;setting-up-flask&quot;&gt;Setting up Flask&lt;/h2&gt;

&lt;p&gt;In Python, packages such as Flask are available in a public repository,
from where anybody can download and install them. The official
Python package repository is called PyPI, which stands for Python
Package Index.&lt;/p&gt;

&lt;p&gt;1 . (Optional) If you do not have &lt;code class=&quot;highlighter-rouge&quot;&gt;pip&lt;/code&gt; installed, launch&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;apt install python-pip
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;2 . Install Flask&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pip install Flask
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;3 . Create a folder called &lt;code class=&quot;highlighter-rouge&quot;&gt;FlaskApp&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkdir FlaskApp
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;4 . Navigate to the FlaskApp folder and create a file called &lt;code class=&quot;highlighter-rouge&quot;&gt;app.py&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd FlaskApp
nano app.py
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;5 . Paste the following content to the &lt;code class=&quot;highlighter-rouge&quot;&gt;app.py&lt;/code&gt; file.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;from flask import Flask
app = Flask(__name__)
@app.route(&quot;/&quot;)
def main():
    return &quot;Welcome to the first Flask App!&quot;
if __name__ == &quot;__main__&quot;:
    app.run(host='0.0.0.0')
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;6 . Save the changes and execute &lt;code class=&quot;highlighter-rouge&quot;&gt;app.py&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;~/FlaskApp# python app.py
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;which returns&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;* Serving Flask app &quot;app&quot; (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production
   environment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;7 . Open you web browser and type the &lt;code class=&quot;highlighter-rouge&quot;&gt;server_ip:port&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;It should display&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/docs/FlaskApp.png&quot; alt=&quot;FlaskApp&quot; class=&quot;img-responsive&quot; /&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;
If you run the server you will notice that the server is only
accessible from your own computer, not from any other in the network.
This is the default because in debugging mode a user of the application
can execute arbitrary Python code on your computer.
If you have the debugger disabled or trust the users on your network,
you can make the server publicly available simply by adding
–host=0.0.0.0 to the command line or editting your &lt;code class=&quot;highlighter-rouge&quot;&gt;app.py&lt;/code&gt; to match
&lt;code class=&quot;highlighter-rouge&quot;&gt;app.run(host='0.0.0.0')&lt;/code&gt;`
This tells your operating system to listen on all public IPs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;creating-url-routes&quot;&gt;Creating URL routes&lt;/h2&gt;

&lt;p&gt;URL Routing makes URLs in your Web app easy to remember.&lt;/p&gt;

&lt;p&gt;We will create several URLs routes:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;/hello&lt;/li&gt;
  &lt;li&gt;/writers/&lt;/li&gt;
  &lt;li&gt;/writers/tutorials/&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;1 . Copy the code below and save it as &lt;code class=&quot;highlighter-rouge&quot;&gt;app.py&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;app = Flask(__name__)

@app.route(&quot;/&quot;)
def index():
    return &quot;Index!&quot;

@app.route(&quot;/hello&quot;)
def hello():
    return &quot;Hello Cloud Riders!&quot;

@app.route(&quot;/writers&quot;)
def writers():
    return &quot;Thanks to the Scaleway Tech Writers!&quot;

@app.route(&quot;/writers/&amp;lt;string:name&amp;gt;/&quot;)
def getWriters(name):
    return name

if __name__ == &quot;__main__&quot;:
    app.run(host='0.0.0.0')
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;2 . Restart the application using&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;python app.py
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Try the URLs in your browser:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;http://server_ip:5000/&lt;/li&gt;
  &lt;li&gt;http://server_ip:5000/hello&lt;/li&gt;
  &lt;li&gt;http://server_ip:5000/writers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each route should display what is defined in the &lt;code class=&quot;highlighter-rouge&quot;&gt;app.py&lt;/code&gt; above, for
instance http://server_ip:5000/hello displays:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/docs/FlaskHello.png&quot; alt=&quot;FlaskHello&quot; class=&quot;img-responsive&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;styling-flask-pages&quot;&gt;Styling Flask Pages&lt;/h2&gt;

&lt;p&gt;In Flask, templates are written as separate files, stored in a
templates folder that is inside the application package. So after
making sure that you are in the &lt;code class=&quot;highlighter-rouge&quot;&gt;FlaskApp&lt;/code&gt; directory, create the
directory where templates will be stored.&lt;/p&gt;

&lt;p&gt;As explained above, we created a new application called &lt;code class=&quot;highlighter-rouge&quot;&gt;hello.py&lt;/code&gt;
running on port 80, with the following configuration:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;from flask import Flask, flash, redirect, render_template, request,
session, abort

app = Flask(__name__)

@app.route(&quot;/&quot;)
def index():
    return &quot;Flask App!&quot;

@app.route(&quot;/hello/&amp;lt;string:name&amp;gt;/&quot;)
def hello(name):
    return render_template(
        'test.html',name=name)

if __name__ == &quot;__main__&quot;:
    app.run(host='0.0.0.0', port=80)
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;1 . Create a directory called templates&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkdir templates
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;2 . Open a &lt;code class=&quot;highlighter-rouge&quot;&gt;test.html&lt;/code&gt; file and paste the following&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;nano test.html
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;3 . Paste the following&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;layout.html&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;%}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;block&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;

&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;div&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;block1&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;h&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;Hello&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;{name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;}!&amp;lt;/h&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;h&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;Discover&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;New&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;Cloud&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;Experience&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;/h&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;The Disruptive Cloud Computing Platform: Deploy SSD Cloud Servers in
seconds!!&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;img&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://www.universfreebox.com/UserFiles/image/Capture%20d%E2%0%9e%CC%81cran%202017-12-01%20a%CC%80%2012_17_02.png&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;endblock&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;4 . Open a &lt;code class=&quot;highlighter-rouge&quot;&gt;layout.html&lt;/code&gt; file and paste the following&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Website&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;style&amp;gt;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;@import&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;url(http://fonts.googleapis.com/css?family=Amatic+SC:700)&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;text-align&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;center&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;h1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;font-family&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;'Amatic SC'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;cursive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;font-weight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;normal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;#FD6C9E&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;2.5em&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;

 {% block body %}{% endblock %}
 
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;5 . Launch the application&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;python hello.py
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;the application should display&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/docs/FlaskHome.png&quot; alt=&quot;FlaskHome&quot; class=&quot;img-responsive&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;passing-variables&quot;&gt;Passing Variables&lt;/h2&gt;

&lt;p&gt;Let’s try and display random Scaleway catch phrase instead of always the same one. We will need to pass both the &lt;em&gt;name variable&lt;/em&gt; and the &lt;em&gt;quote variable&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;1 . In the &lt;code class=&quot;highlighter-rouge&quot;&gt;templates&lt;/code&gt; directory, edit the &lt;code class=&quot;highlighter-rouge&quot;&gt;test.html&lt;/code&gt; to match the following&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;layout.html&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;%}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;block&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;

&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;div&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;block1&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;h&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;Hello&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;{name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;}!&amp;lt;/h&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;h&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;Discover&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;New&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;Cloud&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;Experience&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;/h&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;{quote&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;img&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://www.universfreebox.com/UserFiles/image/Capture%20d%E2%0%9e%CC%81cran%202017-12-01%20a%CC%80%2012_17_02.png&quot;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;endblock&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;2 . Save and exit&lt;/p&gt;

&lt;p&gt;3 . In the application called &lt;code class=&quot;highlighter-rouge&quot;&gt;hello.py&lt;/code&gt; update the configuration to look like this:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;from flask import Flask, flash, redirect, render_template, request, session, abort
from random import randint

app = Flask(__name__)

@app.route(&quot;/&quot;)
def index():
    return &quot;Flask App!&quot;

#@app.route(&quot;/hello/&amp;lt;string:name&amp;gt;&quot;)
@app.route(&quot;/hello/&amp;lt;string:name&amp;gt;/&quot;)
def hello(name):
#    return name
  quotes = [    &quot;Pay as You Go - Enjoy a new cloud experience starting at 0.004euros per hour.&quot;,
               &quot;Multiple Datacenters - Maximize your services reliability by running your infrastructure through autonomous facilities spread across multiple regions.&quot;,
               &quot;Over 5 Tb/s of internet bandwidth - Deliver your content anywhere thanks to our multiple high-end transit providers and the best peerings.&quot;,
               &quot;Limitless Infrastructure Combinations - Additional volumes, movable IPs, security groups and hot snapshots are available on all our servers.&quot;,
               &quot;Developer Tools - Interact with Scaleway and take control of the cloud in minutes with our many tools, resources and third-party applications.&quot;,
               &quot;Hourly Billing - All our cloud resources are billed per hour with monthly capping. Scaleway pricing is predictable and transparent, with no hidden costs.&quot;$
  randomNumber = randint(0,len(quotes)-1)
  quote = quotes[randomNumber]

  return render_template(
        'test.html',**locals())

if __name__ == &quot;__main__&quot;:
    app.run(host='0.0.0.0', port=80)
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;As you can notice, we updated the &lt;code class=&quot;highlighter-rouge&quot;&gt;quotes&lt;/code&gt; variable with an array of multiples quotes. These can be accessed as quote[0], quote[1], quote[2] and so on. The function &lt;strong&gt;randint()&lt;/strong&gt; returns a random number between 0 and the total number of quotes, one is subtracted because we start counting from zero.&lt;/p&gt;

&lt;p&gt;We also added a &lt;strong&gt;locals()&lt;/strong&gt; function which always returns a dictionary of the current namespace.&lt;/p&gt;

&lt;p&gt;4 . Save and exit
5 . Run the application &lt;code class=&quot;highlighter-rouge&quot;&gt;hello.py&lt;/code&gt;. It will return one of these quotes at random.&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;python hello.py
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/docs/FlaskQuote.png&quot; alt=&quot;FlaskQuote&quot; class=&quot;img-responsive&quot; /&gt;&lt;/p&gt;</content><author><name>Scaleway</name><email>contact@scaleway.com</email><uri>https://scaleway.com</uri></author><category term="getting started" /><category term="account" /><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://scaleway.com/assets/images/docs/account_settings.png" /></entry><entry><title type="html">Protect a server with Fail2Ban</title><link href="https://scaleway.com/docs/protect-server-fail2ban/" rel="alternate" type="text/html" title="Protect a server with Fail2Ban" /><published>2018-08-22T00:00:00+00:00</published><updated>2018-08-22T00:00:00+00:00</updated><id>https://scaleway.com/docs/secure-server-fail2ban</id><content type="html" xml:base="https://scaleway.com/docs/protect-server-fail2ban/">&lt;h2 class=&quot;anchor-wrap&quot;&gt;Fail2Ban Overview&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Fail2Ban-Overview&quot; href=&quot;#-Fail2Ban-Overview&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://www.fail2ban.org/&quot;&gt;Fail2Ban&lt;/a&gt; is a useful tool that analyses server log files for recurring patterns of failures. This allows to block IP’s trying to run bruteforce attacks against a server.&lt;/p&gt;

&lt;p&gt;In this Tutorial you will learn how to configure the service on an Ubuntu Bionic server to protect the SSH service. Fail2Ban can be used with all services generating log files.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Requirements:&lt;/strong&gt;&lt;/p&gt;

  &lt;ul&gt;
    &lt;li&gt;You have an account and are logged into &lt;a href=&quot;https://cloud.scaleway.com&quot;&gt;cloud.scaleway.com&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;You have an Ubuntu Bionic server&lt;/li&gt;
    &lt;li&gt;You have &lt;a href=&quot;https://www.scaleway.com/docs/configure-new-ssh-key/&quot;&gt;configured your SSH Key&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;You have sudo privileges or access to the root user.&lt;/li&gt;
  &lt;/ul&gt;
&lt;/blockquote&gt;

&lt;h2 class=&quot;anchor-wrap&quot;&gt;Installing Fail2Ban&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Installing-Fail2Ban&quot; href=&quot;#-Installing-Fail2Ban&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;1 . The required packages are available in the repositories of Ubuntu and can be installed with &lt;code class=&quot;highlighter-rouge&quot;&gt;apt&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo apt-get install fail2ban postfix
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;2 . Choose &lt;code class=&quot;highlighter-rouge&quot;&gt;Internet Site&lt;/code&gt; when asked for the configuration:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/docs/postfix-install.png&quot; alt=&quot;Postfix installation&quot; /&gt;&lt;/p&gt;

&lt;p&gt;3 . Once the installation has completed, open the file &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/aliases&lt;/code&gt; and add the following line:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;root: me@mydomain.tld
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Make sure to replace &lt;code class=&quot;highlighter-rouge&quot;&gt;me@mydomain.tld&lt;/code&gt; with your actual email address.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; To receive notifications by email, it is required that the &lt;a href=&quot;https://www.scaleway.com/faq/servers/network/#-I-cannot-send-any-email&quot;&gt;email ports are unlocked&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 class=&quot;anchor-wrap&quot;&gt;Configuring Fail2Ban&lt;a style=&quot;margin-left: 10px;&quot; name=&quot;-Configuring-Fail2Ban&quot; href=&quot;#-Configuring-Fail2Ban&quot;&gt;&lt;span style=&quot;font-size: 16px&quot;&gt;&lt;i class=&quot;glyphicon glyphicon-link&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;1 . Start by copying the configuration file:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd /etc/fail2ban &amp;amp;&amp;amp; sudo cp jail.conf jail.local
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The file &lt;code class=&quot;highlighter-rouge&quot;&gt;jail.conf&lt;/code&gt; contains the default parameters. If a file &lt;code class=&quot;highlighter-rouge&quot;&gt;jail.local&lt;/code&gt; is available, it will have priority over &lt;code class=&quot;highlighter-rouge&quot;&gt;jail.conf&lt;/code&gt; if parameters are modified.&lt;/p&gt;

&lt;p&gt;2 . Edit the file &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/fail2ban/jail.local&lt;/code&gt; with your preferred editor.&lt;/p&gt;

&lt;p&gt;Following the parameters which should be modified:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;ignoreip = 127.0.0.1/8&lt;/code&gt; By default the IPs of localhost are ignored, self-banning would not be very useful. It is possible to exclude other IPs from being banned.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;bantime = 600&lt;/code&gt; The duration of an ban. By default it is set to 10 Minutes. The value has to be specified in seconds and it is recommended to set it at least to one hour, or one day.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;findtime = 600&lt;/code&gt; The timespan which will be considered for maxretry. If you want for example to ban somebody who made more than 3 malicious attempts during the last hour or, as here, in the last 10 minutes.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;maxretry = 3&lt;/code&gt; Amount of attempts before being banned.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;destemail = root@localhost&lt;/code&gt; The recipient of the mail. As an alias for root has been set during the installation, this value can be left as it is.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;sendername = Fail2Ban&lt;/code&gt; The name of the sender of the mail.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;action = %(action_)s&lt;/code&gt; This defines the action to execute when a limit is reached.
By default it will only block the user.&lt;/p&gt;

&lt;p&gt;To receive an email at each ban, set it to:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;action = %(action_mw)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To receive the logs with the mail, set it to:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;action = %(action_mwl)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Further down in the configuration file it comes to the “Jails”. These are configurable blocks per service to filter logs and ban in cases where patterns are matched.&lt;/p&gt;

&lt;p&gt;As minimum it is recommend to activate the jail ssh as follows:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[ssh]

enabled  = true
port     = ssh
filter   = sshd
logpath  = /var/log/auth.log
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If your SSH daemon is listening on multiple ports or on a different port, you have to modify the line port with the correct parameters:
Here an example:
&lt;code class=&quot;highlighter-rouge&quot;&gt;port    = ssh,1234&lt;/code&gt;
Fail2Ban analyses the logs and will ban the users who made several intrusion attempts on ports 22 (SSH by default) &amp;amp; 1234.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;3 . Save the file once you have edited it.&lt;/p&gt;

&lt;p&gt;Fail2Ban uses filters, pre-made configuration files indicating what to parse in a log.&lt;/p&gt;

&lt;p&gt;They can be found in &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/fail2ban/filter.d&lt;/code&gt;.
You can create your own filters in case you have need to.&lt;/p&gt;

&lt;p&gt;4 . Restart the  service to take the actions into effect:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;sudo service fail2ban restart
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;The service will now analyze the connetions made to the SSH service. The logs of Fail2Ban are located in the file &lt;code class=&quot;highlighter-rouge&quot;&gt;var/log/fail2ban.log&lt;/code&gt;.&lt;/p&gt;</content><author><name>Scaleway</name><email>contact@scaleway.com</email><uri>https://scaleway.com</uri></author><category term="getting started" /><category term="compute" /><category term="networking" /><category term="security" /><category term="fail2ban" /><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://scaleway.com/assets/images/og/scaleway.png" /></entry></feed>
