. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . AnonSec Shell
AnonSec Shell
Server IP : 52.223.31.75  /  Your IP : 172.31.6.220   [ Reverse IP ]
Web Server : Apache/2.4.66 () OpenSSL/1.0.2k-fips PHP/7.4.33
System : Linux ip-172-31-14-81.eu-central-1.compute.internal 4.14.281-212.502.amzn2.x86_64 #1 SMP Thu May 26 09:52:17 UTC 2022 x86_64
User : apache ( 48)
PHP Version : 7.4.33
Disable Function : NONE
Domains : 4 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python2.7/site-packages/awscli/examples/dynamodb/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python2.7/site-packages/awscli/examples/dynamodb/delete-item.rst
**Example 1: To delete an item**

The following ``delete-item`` example deletes an item from the ``MusicCollection`` table and requests details about the item that was deleted and the capacity used by the request. ::

    aws dynamodb delete-item \
        --table-name MusicCollection \
        --key file://key.json \
        --return-values ALL_OLD \
        --return-consumed-capacity TOTAL \
        --return-item-collection-metrics SIZE

Contents of ``key.json``::

    {
        "Artist": {"S": "No One You Know"},
        "SongTitle": {"S": "Scared of My Shadow"}
    }

Output::

    {
        "Attributes": {
            "AlbumTitle": {
                "S": "Blue Sky Blues"
            },
            "Artist": {
                "S": "No One You Know"
            },
            "SongTitle": {
                "S": "Scared of My Shadow"
            }
        },
        "ConsumedCapacity": {
            "TableName": "MusicCollection",
            "CapacityUnits": 2.0
        },
        "ItemCollectionMetrics": {
            "ItemCollectionKey": {
                "Artist": {
                    "S": "No One You Know"
                }
            },
            "SizeEstimateRangeGB": [
                0.0,
                1.0
            ]
        }
    }

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*.

**Example 2: To delete an item conditionally**

The following example deletes an item from the ``ProductCatalog`` table only if its ``ProductCategory`` is either ``Sporting Goods`` or ``Gardening Supplies`` and its price is between 500 and 600. It returns details about the item that was deleted. ::

    aws dynamodb delete-item \
        --table-name ProductCatalog \
        --key '{"Id":{"N":"456"}}' \
        --condition-expression "(ProductCategory IN (:cat1, :cat2)) and (#P between :lo and :hi)" \
        --expression-attribute-names file://names.json \
        --expression-attribute-values file://values.json \
        --return-values ALL_OLD

Contents of ``names.json``::

    {
        "#P": "Price"
    }

Contents of ``values.json``::

    {
        ":cat1": {"S": "Sporting Goods"},
        ":cat2": {"S": "Gardening Supplies"},
        ":lo": {"N": "500"},
        ":hi": {"N": "600"}
    }

Output::

    {
        "Attributes": {
            "Id": {
                "N": "456"
            },
            "Price": {
                "N": "550"
            },
            "ProductCategory": {
                "S": "Sporting Goods"
            }
        }
    }

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*.

Anon7 - 2022
AnonSec Team