Closed2

TypeScript のプロジェクトを作成して AWS SDK for JavaScript v3 を動かすまでの手順

noid11noid11

TypeScript プロジェクト作成

mkdir my-proj && cd my-proj
npm init -y
npm i typescript @types/node ts-node
npx tsc --init
npm i @aws-sdk/client-sts
touch app.ts

app.ts を実装

import { GetCallerIdentityCommand, STSClient } from "@aws-sdk/client-sts"

(async () => {
    const client = new STSClient({ region: "ap-northeast-1" })
    try {
        const data = await client.send(new GetCallerIdentityCommand({}))
        console.log(data)
    } catch (e) {
        console.log(e)
    }
})()

app.ts を実行

npx ts-node app.ts
このスクラップは2022/09/06にクローズされました