简体   繁体   中英

how to run aws cli command silently to create a dynamodb table

I am creating a shell script that will create a couple of dynamodb tables locally among other things. This is the create table AWS CLI command I am using:

aws dynamodb create-table --cli-input-json file://table-user.json --endpoint-url http://localhost:8000

with table-user.json having all table related information for creation.

The problem with this command is I need to click on key 'q' to proceed to the next line for execution as it gives table details as output. ex:

{
    "TableDescription": {
        "AttributeDefinitions": [
            {
                "AttributeName": "id",
                "AttributeType": "S"
            },
            {
                "AttributeName": "externalId",
                "AttributeType": "S"
            },
.
.
.

How can I silently run the create table command?

Set AWS_PAGER="" .

So your command would be:

AWS_PAGER="" aws dynamodb create-table --cli-input-json file://table-user.json --endpoint-url http://localhost:8000

If you haven't found any solution in the cli documentation take a look at the unix yes command .

You can do something like:

yes q | aws dynamodb create-table --cli-input-json file://table-user.json --endpoint-url http://localhost:8000

This command will keep on entering the specified string ( q in this case) until the program finishes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM