Every one interested to keep our data backup in the safe location. Digital ocean providing one such feature where you can keep your backup data. The service name is “Spaces” which is similar to S3 bucket service provided by Amazon Web Service. Space is available for $5 per month that includes 250GB of storage and 1 TB of outbound bandwidth. In below article we shall see how to copy your data to digital ocean spaces.
What are DigitalOcean spaces?
If you have used S3 in AWS, you remember how convenient for you to store large amount of data in a bucket and use it anywhere you want to access. DigitalOcean has launched Spaces that allows you to store any amount of data online and use it. Each space create will have unique URL, that can be used for accessing it.
Step 1: Login to DigitalOcean
The first step is to login to DigitalOcean console page and navigate to spaces and click on create new spaces as shown in the screenshot.
Step 2: Create New Key
The next step is to navigate to API in the console and click on the Generate new key under spaces. The access key is shown in the below figure.
Now you will get secret key and access key. Note it down to safe place which will be used in later stage to access your space in CLI.
Step 3: Install S3 Command
To access or connecting to the space that you have created in the earlier stage we need to install s3 command. You can install s3 command using below command
sudo yum –enablerepo=epel install s3cmd |
you can check the installed version of s3 command using the below-mentioned command
s3cmd –version |
Step 4: Configure S3 Command
Now you have to configure s3 command to access your space as follows:
s3cmd –configure |
Which will prompt for following details to be entered.
- Access Key : <enter your access key generated in above>
- Secret Key : <enter your secret key generated in above>
- Default Region : <chose the region nearer to your location>
Note: Digital ocean is currently providing 8 regions. You can find the Region code for your region using below screenshot
- S3 Endpoint : <End point of your space>
Note : to find the endpoint of your space just click on your space then go to setting where you can find your space endpoint.
- DNS-style bucket+hostname:port template for accessing a bucket: <spacename>.endpoint of your space
Just follow the above format where your space name is followed by endpoint of your space.
- Encryption password: <Default enter >
Setting a password now won’t cause objects to be automatically encrypted; it just makes encryption available later.
- Path to GPG program[/usr/bin/gpg] : <Default enter>
- Use HTTPS protocol: <yes>
Note : HTTPS protects data from being read while it is in transit. DigitalOcean Spaces do not support unencrypted transfer, so press ENTER to accept the default, YES
- HTTP Proxy server name: <yes>
Note : If your network requires you to use an HTTP Proxy server, enter its IP address or domain name without the protocol, e.g. 203.0.113.1 or proxy.example.com. Because we aren’t using an HTTP Proxy server, we’ll leave this question blank and press ENTER
- HTTP Proxy server port: <Default enter >
- Test access with supplied credentials? [Y/n] : <Enter yes>
Once you enter yes it will display the details that you have entered as shown below where you can verify
Once you enter all the above details you can confirm by entering and you will get the output as success and can now copy the files to spaces in CLI using the following command
s3cmd put <file to copy > s3://<space name>/location |
Step 5: Configure LifeCycle Policy
The final step is to configure lifecycle policy. For example, how many copies of data to be retained in your space using following command
s3cmd expire s3://<your bucket name>/ –expiry-days=10<number of days to be retained> |
Summary: In this article we have successfully configured backup to DigitalOcean space. Now create your own space and move all your data to DigitalOcean spaces to make it safe and secure using above procedure.
References: