aws dynamodb put-item: Write to DynamoDB in CI
Insert or replace a single item in a DynamoDB table.
aws dynamodb put-item writes one item, replacing any existing item with the same key. Attributes use DynamoDB's typed JSON ({"S":"..."}). In CI it seeds test data, writes deploy markers, or feeds integration test fixtures.
Common flags
--table-name- the target table (required)--item- the typed-JSON item to write (required)--condition-expression- only write if a condition holds (e.g. avoid overwrite)--cli-input-json file://item.json- supply the whole request from a file
Example in CI
Seed a fixture row, refusing to overwrite an existing key.
shell
aws dynamodb put-item --table-name fixtures --item '{"id":{"S":"seed-1"},"name":{"S":"demo"}}' --condition-expression "attribute_not_exists(id)"Common errors in CI
- An error occurred (ConditionalCheckFailedException) - the condition-expression was not met
- An error occurred (ResourceNotFoundException) - table name wrong or in another region
- An error occurred (ValidationException) - missing key attribute or wrong typed-JSON shape
- An error occurred (AccessDeniedException) - role lacks dynamodb:PutItem
Key takeaways
- Items use typed JSON like {"S":"text"} or {"N":"1"}.
- put-item replaces the whole item; use --condition-expression to guard overwrites.
- ConditionalCheckFailedException is expected behavior when a guard blocks a write.
Related guides
aws sqs send-message: Send to an SQS Queue in CIaws sqs send-message enqueues a message to an SQS queue. Learn the queue-url, message-body, and FIFO group fl…
aws lambda invoke: Invoke a Lambda Function in CIaws lambda invoke runs a Lambda function and captures its response. Learn the payload, log-type, and cli-bina…
aws ssm get-parameter: Read Config from SSM in CIaws ssm get-parameter reads a value from SSM Parameter Store, decrypting SecureStrings. Learn the with-decryp…