Skip to content

Guidance on using aws-sdk v3? New user #234

Answered by tywalch
ktwbc asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @ktwbc 👋

Here is an example of how you you can use Electro with the v3 client:

import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
import { Entity } from 'electrodb';

const table = 'my-table';

const client = new DynamoDBClient({
    region: "us-east-1",
    endpoint: 'http://localhost:8000',
});

const thing = new Entity({
  model: {
    entity: 'thing',
    service: 'database',
    version: '01'
  },
  attributes: {
    id: {
      type: 'string',
    },
    name: {
      type: 'string',
    },
    description: {
      type: 'string',
    }
  },
  indexes: {
    record: {
      pk: {
        field: 'pk',
        composite: ['id'],
      },
      sk: {
        field: 'sk',

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by ktwbc
Comment options

You must be logged in to vote
2 replies
@tywalch
Comment options

@tywalch
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants