%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
**Example1: To add an item to a table** The following ``put-item`` example adds a new item to the *MusicCollection* table. :: aws dynamodb put-item \ --table-name MusicCollection \ --item file://item.json \ --return-consumed-capacity TOTAL Contents of ``item.json``:: { "Artist": {"S": "No One You Know"}, "SongTitle": {"S": "Call Me Today"}, "AlbumTitle": {"S": "Somewhat Famous"} } Output:: { "ConsumedCapacity": { "CapacityUnits": 1.0, "TableName": "MusicCollection" } } For more information, see `Writing an Item <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html#WorkingWithItems.WritingData>`__ in the *Amazon DynamoDB Developer Guide*. **Example2: To add an item to a table conditionally** The following ``put-item`` example adds a new item to the ``MusicCollection`` table only if the artist "Obscure Indie Band" does not already exist in the table. :: aws dynamodb put-item \ --table-name MusicCollection \ --item '{"Artist": {"S": "Obscure Indie Band"}}' \ --condition-expression "attribute_not_exists(Artist)" If the key already exists, you should see the following output:: A client error (ConditionalCheckFailedException) occurred when calling the PutItem operation: The conditional request failed. For more information, see `Condition Expressions <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.ConditionExpressions.html>`__ in the *Amazon DynamoDB Developer Guide*.