which ec2 boto module are available to upload the file to EC2 Instance

0

Hello Friends,

I want to configure the system as Once the file is received to S3 Bucket it should automatically get uploaded to EC2 Instance using Lambda Function. also uses SQS for monitor queue.

I have created a Lambda function till the last part of file to be uploaded to ec2 instance module, but can't able to find any upload module to use in my lambda function.

Getting as "put_file module not found" or "upload_file module on found"

Please help me which boto module can be use to upload the downloaded file from S3 to EC2 Instance using Lambda function.

  • Please tag the answer as accepted answer if you found it provided the response to your query.

Alok
질문됨 일 년 전256회 조회
4개 답변
2

The easiest way to achieve this is to use AWS System Manager(SSM) to manage the EC2 instance (it is free of charge) and use SSM SDK to run a command through Lamda function through sendcommand() call. You can run arbitrary shell or Powershell commands through SSM agent on EC2 instance.

So the design will look like this : S3->Event->Lambda->Call to SSM sendcommand->EC2 Instance command execution->Access to S3 from EC2.

Of course you need to make sure that security-wise these services have the proper IAM policies to achieve this.

The drawback of this solution is the lack of queue : If for whatever reason your instance cannot fetch the file, you cannot retry the scenario. If you need to ensure the delivery at all times, then the suggestion proposed above to make EC2 instance pull from a SQS queue is a better choice.

AWS
전문가
답변함 일 년 전
0

I think you will need to use SFTP from the Lambda function to the EC2 instance.

profile pictureAWS
전문가
kentrad
답변함 일 년 전
0

There is no service that is used to upload a file to EC2. Instead of triggering a Lambda function, send the S3 event to SQS and let the EC2 instance poll the queue. Once there is a message, the code in the instance will download the file from S3.

profile pictureAWS
전문가
Uri
답변함 일 년 전
0

It might be easier if you used the aws s3 cp command on the EC2 instance to download from S3, rather than using a Lambda function. If you wanted to know when to run that command, you could have S3 publish a notification to SNS or SQS, and some process on the EC2 that gets initiated from SNS/SQS that runs that then downloads the file from S3.

profile picture
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠