admin管理员组文章数量:1406060
I'd need to get a secret from AWS Secrets Manager in a Nextjs (Nextjs here is irrelevant, it could be Nodejs). Specifically, I want it to work locally too (as well as on AWS).
The problem I guess it is I'd like to avoid the hassle of starting an SSO session locally every time, to get the aws_session_token
(that is my understanding). Obviously this code per se won't work, because I don't provide the token.
import { SecretsManagerClient, GetSecretValueCommand } from "@aws-sdk/client-secrets-manager";
const client = new SecretsManagerClient({
region: "region",
});
let response;
try {
response = await client.send(
new GetSecretValueCommand({
SecretId: "secret_name"
})
);
console.log(response)
} catch (error) {
throw error;
}
I have a task Role already set up to to have read access to the secret, I think I have to assume that role via STS, but for running an AssumeRole
command I still need a session token.
本文标签: javascriptGet a secret from AWS Secrets Manager in Nextjs (serverside)Stack Overflow
版权声明:本文标题:javascript - Get a secret from AWS Secrets Manager in Nextjs (serverside) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744959113a2634543.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论