3

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?

jayant
  • 366
  • 4
  • 14

2 Answers2

4

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
  • This works for me. Thanks, Chris. In fact I used the export command to set this in the start of script to avoid multiple entry. export AWS_PAGER="" – jayant Mar 28 '21 at 21:32
0

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.

desoss
  • 572
  • 4
  • 26
  • 1
    I tried this solution but does not seems to be working. Still have to click on q when prompted. I am using zsh terminal. – jayant Nov 19 '20 at 20:15