Golang DynamoDB PutItem Resource not found

I’ve been trying to write a Golang function to put a new item into DynamoDB.

There isn’t much information on using Golang, DynamoDB, and Serverless, but I managed to put something together.

My problem is I get this error when I try to start the DynamoDB service: ResourceNotFoundException: Requested resource not found

My code is very basic:

	sess := session.Must(session.NewSession(&aws.Config{
		Region: aws.String("us-east-1")},
	))

	// Create DynamoDB client
	svc := dynamodb.New(sess)

	body.SlackWebHook = ""
	body.ID = u2
	av, err := dynamodbattribute.MarshalMap(body)
	if err != nil {
		return err
	}

	input := &dynamodb.PutItemInput{
		Item:      av,
		TableName: aws.String("Leads"),
	}

	_, err = svc.PutItem(input)
	if err != nil {
		return err
	}

	return nil

Thanks for any help!

HI, sorry for the delay on getting back to you here. If you’re still having the issue can you please post the full output from a run? Is that a panic or is that an error value you’ve seen?

Though this example reads from dynamodb instead of writing, it may help guide you with the connection portion (check the seed-dynamodb folder):