If we configure s3cmd we can store and serve large amounts of data.
Here, at Bobcares, we assist our customers with several AWS queries as part of our AWS Support Services.
Today, let us see how our techs configure the same.
Spaces CDN minimizes page load times, improves performance, and reduces bandwidth and infrastructure costs.
Moving ahead, let us see the steps our Support Techs employ for its configuration.
Initialize the Configuration File
By default, when a user runs the configuration command, s3cmd stores its configuration file, .s3cfg, in the home directory of that user.
In case we only have a single provider and don’t want to specify its configuration file every time we use s3cmd, we configure the default ~/.s3cfg file:
On the other hand, if we use s3cmd with another service, we can create an alternate configuration file.
To do so, we need to add the -c flag and supply a filename.
Enter Access Keys
When we run the script, it asks for an Access Key and Secret Key.
If we don’t have them, we can generate a set for s3cmd from the control panel’s API page.
Once we enter the keys, we have to accept the US for the Default Region.
We can also use the environment variables AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY to store a set of keys.
Enter new values or accept defaults in brackets with Enter. Refer to user manual for detailed description of all options. Access key and Secret key are your identifiers for Amazon S3. Leave them empty for using the env variables. Access Key : EXAMPLE7UQOTHDTF3GK4 Secret Key : exampleb8e1ec97b97bff326955375c5
Enter the Endpoint
Next, we need to enter the endpoint. We use the endpoint for the region the Spaces are in.
Use "s3.amazonaws.com" for S3 Endpoint and not modify it to the target Amazon S3. S3 Endpoint [s3.amazonaws.com]: nyc3.bobspaces.com
Then, we will get a prompt that asks for a URL template to access the bucket.
Since Spaces supports DNS-based endpoint URLs, we can use the variable %(bucket)s to stand in for the name of the space.
Eventually, we enter the following template format. However, make note that we change this if the Space is in a different region.
Use "%(bucket)s.s3.amazonaws.com" to the target Amazon S3. "%(bucket)s" and "%(location)s" vars can be used if the target S3 system supports dns based buckets. DNS-style bucket+hostname:port template for accessing a bucket : %(bucket)s.nyc3.bobspaces.com
Set an Encryption Password
If necessary, we can opt for an encryption password.
A password won’t cause objects to automatically encrypt; it just makes encryption available later.
Encryption password is used to protect your files from reading by unauthorized persons while in transfer to S3 Encryption password:
Connect via HTTPS
Our next prompt will ask to use the HTTPS protocol. HTTPS protects data from being read while it’s in transit.
We just need to press ENTER to accept the default.
When using secure HTTPS protocol all communication with Amazon S3 servers is protected from 3rd party eavesdropping. This method is slower than plain HTTP, and can only be proxied with Python 2.7 or newer Use HTTPS protocol [Yes]: Yes
Set a Proxy Server
The final prompt is for an HTTP proxy server. This is optional.
If necessary, we enter the network’s IP address or domain name without the protocol.
Otherwise, we can press ENTER to leave it blank.
On some networks all internet access must go through a HTTP proxy. Try setting it here if you can't connect to S3 directly HTTP Proxy server name:
Confirm, Test, and Save Settings
Once complete, the configuration script will provide a summary of the values it will use, followed by an opportunity to test them:
New settings: Access Key: EXAMPLES7UQOTHDTF3GK4 Secret Key: b8e1ec97b97bff326955375c5example Default Region: US S3 Endpoint: nyc3.digitaloceanspaces.com DNS-style bucket+hostname:port template for accessing a bucket: %(bucket)s.n yc3.digitaloceanspaces.com Encryption password: secure_password Path to GPG program: /usr/bin/gpg Use HTTPS protocol: True HTTP Proxy server name: HTTP Proxy server port: 0 Test access with supplied credentials? [Y/n] Y
As soon as the test completes successfully, we can enter Y to save the settings:
Please wait, attempting to list all buckets... Success. Your access key and secret key worked fine :-) Now verifying that encryption works... Success. Encryption and decryption worked fine :-) Save settings? [y/N] Y
If the test fails or if we choose N, we have the opportunity to retry the configuration.
Once we save the configuration, we’ll receive confirmation of its location:
Configuration saved to '/home/sammy/nyc3'
[Need help with the procedure? We’d be glad to assist you]
In short, we saw how our Support Techs go about the configuration of s3cmd.