aws cli の generate-cli-skeleton オプションが便利!
aws コマンドパラメータを json形式で手で書くのしんどいですが、
--generate-cli-skeleton というオプションつけて実行すると、
パラメータのひな形を生成してくれます。
例)
$ aws dynamodb create-table --generate-cli-skeleton
{
"AttributeDefinitions": [
{
"AttributeName": "",
"AttributeType": ""
}
],
"TableName": "",
"KeySchema": [
{
"AttributeName": "",
"KeyType": ""
}
],
"LocalSecondaryIndexes": [
{
"IndexName": "",
"KeySchema": [
{
"AttributeName": "",
"KeyType": ""
}
],
"Projection": {
"ProjectionType": "",
"NonKeyAttributes": [
""
]
}
}
],
"GlobalSecondaryIndexes": [
{
"IndexName": "",
"KeySchema": [
{
"AttributeName": "",
"KeyType": ""
}
],
"Projection": {
"ProjectionType": "",
"NonKeyAttributes": [
""
]
},
"ProvisionedThroughput": {
"ReadCapacityUnits": 0,
"WriteCapacityUnits": 0
}
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 0,
"WriteCapacityUnits": 0
}
}
こいつをファイルとかに書き出して、編集し、それを--cli-input-json で食わせるとよい。
$ aws dynamodb create-table --generate-cli-skeleton > table.json
$ vi table.json
{
"AttributeDefinitions": [
{
"AttributeName": "user_id",
"AttributeType": "S"
},
{
"AttributeName": "timestamp",
"AttributeType": "N"
}
],
"TableName": "user_log",
"KeySchema": [
{
"AttributeName": "user_id",
"KeyType": "HASH"
},
{
"AttributeName": "timestamp",
"KeyType": "RANGE"
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
}
$ aws dynamodb create-table --cli-input-json file://table.json \
--endpoint-url http://localhost:8000
この file:// というのを 付けないと、下記のようなイミフなエラーが出てしまいます。
JSONが正しくないのか、何度も見なおしてしまったよ…
Error parsing parameter 'cli-input-json': Invalid JSON: No JSON object could be decoded
JSON received: skel.json
で、ぐぐったら↓ にたどり着きました。
というか、書こうとしてたこと全部書いてあるじゃんね。
ちゃんちゃん。
Author And Source
この問題について(aws cli の generate-cli-skeleton オプションが便利!), 我々は、より多くの情報をここで見つけました https://qiita.com/inouet/items/6f1c44343d1a53b108cd著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .