Cyberithub

Best Steps for s3cmd Configuration in Linux(CentOS/RedHat 7)

Advertisements

In this article, I will take you through s3cmd Configuration Steps in Linux(RedHat/CentOS 7). s3cmd is a command line tool used for managing S3 Bucket Objects. This tool can be very useful if you are looking to access s3 Objects using scripts and commands. Here, We will go through all the s3cmd configuration parameters that needs to be set to make s3cmd command working.

Best Steps for s3cmd Configuration in Linux(CentOS/RedHat 7)

s3cmd Configuration in Linux

Also Read: 10 Best s3cmd Examples in Linux

You can configure s3cmd using s3cmd --configure command. But before you need to configure IAM User in your AWS Account and generate Secret Key and Access Key. You can check How to Create an IAM User and attach Policy in AWS to know more about creating an IAM User in AWS. Below are the information that needs to be given to configure s3cmd command in your local system.

Access Key: You need to provide access key to access AWS resources programmatically. This can be generated from IAM Console.

Secret Key: This is another key that gets generated along with Access Key from IAM Console to access AWS Resources.

Default Region: You can select your region here. By default, it will be US Region.

Endpoint:  You can set AWS Endpoint URL here to access the resources through API. By default it will be set to s3.amazonaws.com.

Template: This is the template used for S3 Bucket Access.

Encryption Password: You can provide encryption password as well which will provide protection and any unauthorized access to the files transferred to and from S3 Bucket.

GPG Path: You can set GPG tool path here. By default it will set at /bin/gpg.

HTTPS Protocol: This is to enable HTTPS Protocol if you want. By default it will be set to Yes.

HTTPS Proxy Server: If you want to connect AWS using https proxy server, then you can provide this information here.

HTTPS Proxy Port: You can provide https proxy port details here if you are connecting through HTTPS Proxy Server during s3cmd configuration.

After providing above information, by default, all the s3cmd configurations will be saved in .s3cfg file under your home directory. You can also change the s3cmd configuration path to some other path. Since here I am running all the commands through root user so our s3cmd configurations will be saved in /root/.s3cfg file.

[root@localhost ~]# s3cmd --configure

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: BKIAREPXPS32I3OIO908
Secret Key: LebE5w4Gjo3aSZ6ExAL/iJKU841/HIrT6JMlkoGHYW6
Default Region [US]:

Use "s3.amazonaws.com" for S3 Endpoint and not modify it to the target Amazon S3.
S3 Endpoint [s3.amazonaws.com]:

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.s3.amazonaws.com]:

Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password: Test@123$
Path to GPG program [/bin/gpg]:

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]:

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:

New settings:
Access Key: BKIAREPXPS32I3OIO908
Secret Key: LebE5w4Gjo3aSZ6ExAL/iJKU841/HIrT6JMlkoGHYW6
Default Region: US
S3 Endpoint: s3.amazonaws.com
DNS-style bucket+hostname:port template for accessing a bucket: %(bucket)s.s3.amazonaws.com
Encryption password: Test@123$
Path to GPG program: /bin/gpg
Use HTTPS protocol: True
HTTP Proxy server name:
HTTP Proxy server port: 0

Test access with supplied credentials? [Y/n] Y
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
Configuration saved to '/root/.s3cfg'

 

Also Read: s3cmd Configuration

Leave a Comment