Skip to main content

How to set up AWS CLI to Upload/Download Files - CENTOS 7

We used the AWS SDK to upload files using Java in the previous post and everything worked perfectly, but I needed to upload a database backup in .gz format with a size of 18GB,  and using the AWS SDK did not allow me to do it so that it just allows upload in a maximum put of 5GB,

so using AWS CLI allows us to upload until 160GB in just one put, and now let's see how we can use set it up in Centos 7 and use it:

Note: get ready yourself going to Identity and Access Management (IAM), creating a new user or using an existing one which has got access to the group AmazonS3FullAccess,
so once you've got an AWS Access Key ID with the AWS Access Key ID keep doing the process.


There a lot of ways to install it, let's do it like so:

curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
cd awscli-bundle/
sudo ./install -i /usr/local/aws -b /usr/local/bin/aws

Check it with:

aws --version

aws-cli/1.16.283 Python/2.7.5 Linux/3.10.0-957.1.3.el7.x86_64 botocore/1.13.19

Now let's set aws-cli up to use your AWS credentials:


this is a list of some regions:


RegionName
ap-northeast-1Asia Pacific (Tokyo)
ap-northeast-2Asia Pacific (Seoul)
ap-south-1Asia Pacific (Mumbai)
ap-southeast-1Asia Pacific (Singapore)
ap-southeast-2Asia Pacific (Sydney)
ca-central-1Canada (Central)
eu-central-1EU Central (Frankfurt)
eu-west-1EU West (Ireland)
eu-west-2EU West (London)
sa-east-1South America (Sao Paulo)
us-east-1US East (Virginia)
us-east-2US East (Ohio)
us-west-1US West (N. California)
us-west-2US West (Oregon)

aws configure

AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Access Key ID [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-east-1
Default output format [None]: json

Now let's check if it was set ip properly with:

aws sts get-caller-identity


{
    "Account": "903503371367",
    "UserId": "AKIAIOSFODNN7EXAMPLE",
    "Arn": "arn:aws:iam::903503371367:user/bucketname"
}



so after you run the command aws sts get-caller-identity and you get back the details which belong to your
account then you can use the aws cli like so

to copy from your EC2 instance to the S3 Bucket:
/usr/local/bin/aws s3 cp yourFilename s3://yourbucketname

to copy from your S3 Bucket instance to your instance:
/usr/local/bin/aws s3 cp s3://yourbucketname/fileName.txt /path/tofile



Comments

Popular posts from this blog

How to deploy a VueJS App using Nginx on Ubuntu

There are thousands of blogs and websites out there explaining how to do a hello world and how to start with VueJS, but in this little post, I’m just going to be explaining how to do deploy a VueJs app after you have run the command through the CLI npm run build . So when you run the command npm run build a dist folder is created and that folder’s got the essential .js files to run our app, when we want to run our app on an Nginx server by default the vue-router is not going to work well so that Nginx does not come ready to work by default with a VueJs app This is basically for a Linux Ubuntu distribution if you’ve got any other Linux distribution just pay attention where is going to be set the www/html folder and the Nginx settings so that this is useful for any Linux distribution  Install and configure nginx sudo apt install nginx Double check to make sure the nginx service is running with command service nginx status, then open your browser and enter ...

Nginx reverse proxy for ReactJS, Vuejs,Laravel and Django with or without Docker

Nginx is an important piece on the working chain apps so that it works as bridge between the end user and the application servers, to do that we will be using nginx as a reverse proxy to know more in deep about nginx reverse proxy go to https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/ let's suppose you have a domain name called yourdomainame.com Nginx - ReactJS/Vuejs each time you need to create a new domain name, set it on the path /etc/nginx/conf.d/ create a file with vim or nano or whatever you want, and give it the domain name .conf and set the settings on it, this is really useful when you start handling several domain names under the same server vim /etc/nginx/conf.d/ yourdomainame.com.conf server {         server_name   yourdomainame.com wwww.yourdomainame.com;         # Load configuration files for the default server block.         include /etc/nginx/default.d/ *.conf ;   ...

How to use an SSL certificate for both the API using SpringBoot and for the FontEnd using VueJS or ReactJS

In the previous post  https://springboot-vuejs-reactjs.blogspot.com/2019/07/how-to-secure-springboot-with-ssl-and.html , we were doing the steps to get and install a certificate SSL for an apache tomcat embedded using SpringBoot , and we learned we can have as many SpringBoot applications secured with SSL as we want on the same server using the same   .p12  /  PKCS #12 file, so now we are going to be reviewing about how we can use the same certificate for apache tomcat and for an Nginx server at the same time. we were working on the folder /root/SSL the last generated file was the  apitester.p12 a  PKCS #12  file to work with Nginx with need two files a .crt and .key file and as we started the process securing apache tomcat we do not have those files but we get them using a converter through this webpage: https://decoder.link/converter let's chose the option PKCS#12 TO PEM an let's download the  apitester.p12 from the remote serv...