Lambda in VPC Can't PutObject Despite S3 Endpoint

0

I have a Lambda Node function in a VPC because it has to communicate over a peering connection. That part works fine. Once I get my data, I am trying to use .putObject to push it to S3. This putObject call hangs indefinitely. Code:

const s3 = new aws.S3({
region: 'us-west-1'
});

s3.putObject(
{
Body: fs.createReadStream(tmpDirDoc),
Bucket: s3bucket,
Key: ${s3prefix}/index_doc_${i + 1}.json,
},
(error, data) => {
if (error) {
console.log('Error putting object to s3!');
console.log(error);
reject(error.message);
} else {
accept(data);
}
},
);

It hangs forever at this .putObject call. So I went into the VPC console, Endpoints, Create Endpoint, selected the S3 Interface, assigned it to my VPC. Shouldn't that enable it to work now? This is what fixed timeout hangs when trying to talk to Secrets Manager. Yet, it continues to hang for S3. VPC is so incredibly confusing to get working. Any advice is appreciated. Thank you!

Edited by: johnteamcoco on Apr 30, 2021 11:42 AM

Edited by: johnteamcoco on Apr 30, 2021 11:43 AM
trying to indent properly

질문됨 3년 전310회 조회
1개 답변
0

Wanted to follow up in case any other lost souls find their way here. The problem was that I created an S3 "Interface" endpoint. Apparently, I should have created a "Gateway" endpoint. No idea what the difference is, but "Interface" S3 endpoints don't work within a VPC apparently. No idea what their purpose is. I also coded the endpoint into my S3 sdk constructor call.

답변함 3년 전

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

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

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

관련 콘텐츠