简体   繁体   English

使用访问密钥和秘密将文件上传到 Amazon S3,而不使用 SDK

[英]Upload file to Amazon S3 with access key and secret, without using SDK

Is there an S3 endpoint which will take the access key, secret, and the file in the body, and then accept the file upload?是否有一个 S3 端点将获取访问密钥、秘密和正文中的文件,然后接受文件上传? I would rather not import the entire AWS SDK for just minimal operations.我宁愿不导入整个 AWS SDK 以进行最少的操作。

My use case: I have an AWS lambda function which uploads files to S3.我的用例:我有一个 AWS lambda function 将文件上传到 S3。 At the moment, I use the AWS SDK for the file upload, but this makes the lambda function package size larger than actually required, since I need to upload aws-sdk npm package along with my code.目前,我使用 AWS SDK 进行文件上传,但这使得 lambda function package 的大小比实际需要的大,因为我需要上传 aws-sdk npm package

Is there an S3 endpoint which will take the access key, secret, and the file in the body, and then accept the file upload?是否有一个 S3 端点将获取访问密钥、秘密和正文中的文件,然后接受文件上传? I would rather not import the entire AWS SDK for just minimal operations.我宁愿不导入整个 AWS SDK 以进行最少的操作。

You never pass the access key and secret directly to the AWS API. You have to sign your requests with the key and secret.您永远不会将访问密钥和秘密直接传递给 AWS API。您必须使用密钥和秘密签署您的请求 It is much easier to use the SDK than write custom request signing code.使用 SDK 比编写自定义请求签名代码要容易得多。

However, the AWS SDK is included in the AWS Lambda runtime environment .但是,AWS SDK 包含在 AWS Lambda 运行时环境中 You don't need to upload the SDK as part of your Lambda function deployment unless you need a different version of the SDK than the one provided in the runtime environment.您不需要将 SDK 作为 Lambda function 部署的一部分上传,除非您需要与运行时环境中提供的版本不同的 SDK 版本。

Yes!是的! here is the AWS S3 official RestAPI documentation AWS s3 restAPI docs这是 AWS S3 官方 RestAPI 文档AWS s3 restAPI 文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 IAM 角色而不是访问密钥和秘密密钥将 Amazon S3 存储桶访问到 Kube.netes pod? - How to access Amazon S3 bucket to the Kubernetes pods using IAM roles instead of Access key & secret keys? 使用 nodejs SDK v3 将 stream 上传到 Amazon s3 - Upload stream to Amazon s3 using nodejs SDK v3 如何使用密钥和秘密访问 s3 存储桶? - How to access s3 bucket with key and secret? 使用 Ruby SDK 上传文件到 Amazon S3 - Uploading a file using the Ruby SDK to Amazon S3 在 Github 上的开源项目的 travis.yml 文件中公开 s3 秘密访问密钥是否存在安全风险? - Is exposing a s3 secret access key in travis.yml file on an opensource project on Github a security risk? 在 Amazon Athena 中访问 S3 CSV 文件 - Access S3 CSV file in Amazon Athena 如何使用 postdata preSigned Url 调用 Amazon S3 存储桶以使用空手道上传文件 - How to call Amazon S3 bucket using postdata preSigned Url to upload a file using Karate 如何使用预签名 url 在同一订单中为 Amazon S3 上传文件使用表单字段 - How to use form fields in the same order for Amazon S3 upload file using presigned url 如何使用签名的 URL 和 JavaScript 将二进制字符串文件上传到 Amazon S3? - How can I upload a file that is a binary string to Amazon S3 using a signed URL and JavaScript? 使用 Go 获取 Amazon S3 中文件夹的大小 SDK 2 - Get the size of a folder in Amazon S3 using Go SDK 2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM