[英]How to authenticate in AWS SDK from segment?
I'm trying to call some AWS services from my segment function.我正在尝试从我的分段函数调用一些 AWS 服务。 To do that, I need to set the credentials for AWS, but I cannot find the way.
为此,我需要为 AWS 设置凭证,但我找不到方法。
As you can see in the segment documentation , AWS
is available.正如您在细分文档中所见,
AWS
可用。 The problems are:问题是:
I have also tried the following:我还尝试了以下方法:
AWS.config.credentials.accessKeyId = "-";
AWS.config.credentials.secretAccessKey = "-";
That works locally with version 2.949.0
but not with v2.488.0
(the one provided by segment).这适用于版本
2.949.0
但不适用于v2.488.0
(由段提供的版本)。
Any idea how can I authenticate?知道如何进行身份验证吗? I have not found a way to authenticate using javascript code.
我还没有找到使用 javascript 代码进行身份验证的方法。
Actually, I'm configuring my AWS credentials using实际上,我正在使用配置我的 AWS 凭证
AWS.config.update({
region: 'us-east-1',
accessKeyId: 'ACCESS_KEY',
secretAccessKey: 'SECRET_KEY',
});
For example, to use S3 bucket例如,使用 S3 存储桶
import * as AWS from 'aws-sdk';
AWS.config.update({
region: 'us-east-1',
accessKeyId: 'ACCESS_KEY',
secretAccessKey: 'SECRET_KEY',
});
const s3 = new AWS.S3();
// and do some manipulations with s3
I'm not used the segment, but I guess it should work.我没有使用该段,但我想它应该可以工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.