Avatar of Sathish David  Kumar N
Sathish David Kumar NFlag for India

asked on 

How to read s3 files from DOcker container

how we can read s3 bucket files form docker container
what are the package needed and what is the command

how we can put data to maria DB form docker container
what are the package needed and what is the command
JavaDockerAWSLinux

Avatar of undefined
Last Comment
CEHJ
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Prabhin MP
Prabhin MP
Flag of India image

step1: make sure that aws cli installed in docker container.
if not installed include aws cli in docker file. and Create Environment variables for Access and secret key or move manually from the host machine to Docker container.

aws s3 cp s3://my-bucket/tt.txt . to read the file.
 use pipe to pass the output to mariadb or mysql


Hope these info is enough
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

aws s3 cp s3://my-bucket/tt.txt . to read the file.
 use pipe to pass the output to mariadb or mysql
Again please don't repeat information already stated
Avatar of Prabhin MP
Prabhin MP
Flag of India image

I didn't find an alternative for AWS cp command. I also stated the installation of AWS cli . Then you also make sure that  while providing answer all those info are added
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

I also stated the installation of AWS cli .
Not necessary really - it's obvious that those are command line commands
Avatar of Sathish David  Kumar N

ASKER

Thank you both .

But my  docker script will be automatically execute every day
is this possible ?
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Yes. You could use a cron job
any ref link ?
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Hang on - from your new question, i see you're using Lambda. I suggest you confine this issue to that question
I have different idea. But my target is I need to read file content from s3 and put it in Maria DB

I need to know which one is best
Lambda or directly run cron Job .

For All this i have only Idea .. I dont know how to do .

If any link related to this is very helpful
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

I need to know which one is best
Lambda or directly run cron Job .
That's really a quite different question and should be addressed within the new question you just posted. The current one has been answered
 aws s3 cp s3://my-bucket/tt.txt . to read the file.  use pipe to pass the output to mariadb

any sample reference for  this ?
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

You don't need one ;) I've given you the actual code (naturally you'll have to change the names) that was just described by someone else
yes its direct one . But my script will call private s3 bucket ,  So I need to pass  key  to access that

So How to do that ?
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Not sure i'm afraid - you might need to check the documentation on that issue
Hi CEHJ... i needto read the file..

cp will copy the file not content!!
is there any cmd available or any docker image for  reading the csv file??
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

The aws s3 command set is extremely limited. The following will show you the contents if the rest of the sql supports it

aws s3 cp s3://my-bucket/test.csv  >(cat) 

Open in new window

aws s3 cp s3://my-bucket/tt.txt . to read the file.  use pipe to pass the output to mariadb

Can you give me sample code for pipe to pass mariaDB
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

My very first comment gave you sample code
Avatar of David Favor
David Favor
Flag of United States of America image

Looks like this question is bouncing back + forth between multiple questions.

CEHJ looks to have answered your original question in his first comment.

Please close this question as answered by CEHJ + then open other questions... one question/post for your other questions.

Likely this will provide more useful info for you.
Thanks
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

:)
Java
Java

Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.

102K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo