Shell script to Upload files from AWS EC2 to S3 - shell

I am executing jmeter on AWS EC2, result of which is returned in the form csv file.
I need to upload this csv file to AWS S3 bucket.
Since I am creating number of EC2 instances dynamically and executing jmeter on those instances, it's better to automate this process .
So for this I want to write shell script (as a user data) to execute jmeter and upload result CSV file to S3 bucket from each EC2 instance.
How i can write script for this ?

Consider using command line s3 clients.
S3 command line tools
Also go through some of these sites :
Shell Script To Transfer Files From Amazon S3 Bucket.
aws command line tools
python script to upload file to s3

You can use this library for managing objects on AWS S3 using shell scripts.
Universal Docs Manager is Pure shell script based objects manager which currently supports Local Disk, MySQL and AWS S3

Related

Is there any way to transfer windows files by automatically convert in zip format and then to aws s3 bucket in an automate way daily

Looking an automate process so that files will compress automatically and then transfered to aws s3 bucket from local system.
Just create a script that will:
Zip the files
Use the AWS Command-Line Interface (CLI) aws s3 cp command to copy the file to Amazon S3

How to write a binary file from AWS RDS Oracle database directory to local file system

How to write a binary file from AWS RDS Oracle database directory to local file system on EC2. I tried using Perl script with UTL_FILE, but it can't find read the file. Getting the permissions error.
In AWS RDS Oracle, you do not have access to the file system.
If you need access to the file system then you need to use instance EC2 and install the ORACLE RDBMS.
AWS has an option to integrate with S3: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/oracle-s3-integration.html
You could upload your files there and then download to your local machine. Here are steps to use it with Datapump: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Oracle.Procedural.Importing.html#Oracle.Procedural.Importing.DataPumpS3.Step1

How to move the files from Amazon s3 to sftp using shell scripts

We have a requirement to automate the process of moving the CSV files from Amazon s3 to sftp server using shell scripts(BASH). Can we achieve this requirement using shell scripting? If yes, can someone help me in sharing the sample code?
An SFTP server simply makes local files accessible via the SFTP protocol. Therefore, all you need to do is to copy the files from Amazon S3 to the local disk.
This can be done via the AWS Command-Line Interface (CLI) aws s3 cp command or, better yet, aws s3 sync. This can be called from shell scripts.

Laravel advice on unzipping files on s3

I have a form where users upload a zip file. I am using the filesystem.
is it possible to upload the file to S3 and then unzip the file there?
OR
should i unzip the files first and then upload them to S3.
The zipped folder has lots of files in it (around 500-600 small files), so how does laravel work with such large amount of files? Will the system hault for the time the files are being uploaded or does it carry on in the background? like a queue
No, AWS S3 will not provide you such functionality to unzip files on S3.
If you have EC2 instance within the same region, then Upload your zip files to EC2 and then move it S3 Unzipped.
Theres no charges between ec2 and s3 so ec2 can handle the unzipping and then write it out into your s3 bucket without additional transfer charges.
S3 will provide you just storage.
EDIT- To transfer files from EC2 to S3
You can use following command in AWS CLI. on you EC2
aws s3 cp myfolder s3://mybucket/myfolder --recursive
Here is the reference for it.
http://aws.amazon.com/cli/
For copying the files form the EC2 to S3 without interrupting the execution
Create a script to transfer the files form the ec2 to s3. and after uploading files to the ec2. Use laravel queue to execute the script. so that User don't have to wait until files are being transfer.
https://laravel.com/docs/5.1/queues

Amazon: setup credentials to S3 when using elastic-mapreduce with pig-interactive

I've started ec2 cluster with elastic-mapreduce, then logged in via ssh hadoop#ec2... and started working with grunt by pig -x local.
All is good but to access s3 storage from here I need to specify credentials in the command, like:
grunt> ls s3n:///ABRACADABRA:CADABRAABRA#domain/path/...
It is not convenient especially because it prints results with full names including these lengthy credentials.
Can I setup them somewhere to be used automatically?
If you have a EC2 instance fired up, you don't want to be running in local mode. Simply type pig in the shell. If you have an s3 bucket tied to your account, then you can cd to your bucket and access the files in it.
Once there, you could load a file like
grunt> data = load 's3://[name_of_bucket]/prod.txt' USING PigStorage(',');

Resources