AWS CLI 参数范例

目录

简单参数示范

时间戳

列表

Bool

整数

Blob

Map

文件作为参数范例

输出骨架到 stdout

输出骨架到文件

裁剪骨架,编写参数

验证文件

执行命令

列表与MAP两种类型的等价写法

MAP 类型

列表

列表与 MAP 混合


简单参数示范

时间戳

aws ec2 describe-spot-price-history \
--start-time 2014-10-13T19:00:00Z
  • ​YYYY​​​-​​MM​​​-​​DD​​​T​​hh​​​:​​mm​​​:​​ss.sss​​​​TZD (UTC)​​,例如,2014-10-01T20:30:00.000Z
  • ​YYYY​​​-​​MM​​​-​​DD​​​T​​hh​​​:​​mm​​​:​​ss.sss​​​​TZD(带偏移量)​​,例如,2014-10-01T12:30:00.000-08:00
  • ​YYYY​​​-​​MM​​​-​​DD​​,例如,2014-10-01
  • 以秒为单位的 Unix 时间,如 1412195400。这有时称为 ​​Unix 纪元时间​​,表示自 1970 年 1 月 1 日午夜 (UTC) 以来经历的秒数。

默认 ISO 8601,你可以使用 ​​cli_timestamp_format​​ 文件设置来设置时间戳格式。

列表

aws ec2 describe-spot-price-history 、
--instance-types m1.xlarge m1.medium

Bool

aws ec2 describe-spot-price-history --dry-run

整数

aws ec2 describe-spot-price-history --max-items 5

Blob

aws kms encrypt \
    --key-id 1234abcd-12ab-34cd-56ef-1234567890ab \
    --plaintext fileb://ExamplePlaintextFile \
    --output text \
    --query CiphertextBlob | base64 \
    --decode > ExampleEncryptedFile
dd if=/dev/urandom bs=1 count=32 > sse.key
aws s3api put-object \
    --bucket my-bucket \
    --key test.txt \
    --body test.txt \
    --sse-customer-key fileb://sse.key \
    --sse-customer-algorithm AES256

Map

aws dynamodb get-item --table-name my-table \
--key '{"id": {"N":"1"}}'

{
    "Item": {
        "name": {
            "S": "John"
        },
        "id": {
            "N": "1"
        }
    }
}

Map 内字段示范

--- 字符串
--option '"value"'

--- 数字
--option 123
--option 123.456

--- 布尔值
--option true

--- Null
--option null

--- 数组
--option '["value1", "value2", "value3"]'
--option '["value", 1, true, null, ["key1", 2.34], {"key2": "value2"}]'

--- 对象
--option '{"key": "value"}'
--option '{"key1": "value1", "key2": 123, "key3": true, "key4": null, "key5": ["value3", "value4"], "key6": {"value5": "value6"}'

文件作为参数范例

输出骨架到 stdout

输出 json 骨架

aws ec2 run-instances --generate-cli-skeleton

输出 Yaml 骨架

aws ec2 run-instances --generate-cli-skeleton yaml-input
BlockDeviceMappings:  # The block device mapping entries.
- DeviceName: ''  # The device name (for example, /dev/sdh or xvdh).
  VirtualName: '' # The virtual device name (ephemeralN).
  Ebs: # Parameters used to automatically set up Amazon EBS volumes when the instance is launched.
    DeleteOnTermination: true  # Indicates whether the EBS volume is deleted on instance termination.
    Iops: 0 # The number of I/O operations per second (IOPS) that the volume supports.
    SnapshotId: '' # The ID of the snapshot.
    VolumeSize: 0 # The size of the volume, in GiB.
    VolumeType: st1 # The volume type. Valid values are: standard, io1, gp2, sc1, st1.
    Encrypted: true # Indicates whether the encryption state of an EBS volume is changed while being restored from a backing snapshot.
    KmsKeyId: '' # Identifier (key ID, key alias, ID ARN, or alias ARN) for a customer managed KMS key under which the EBS volume is encrypted.
  NoDevice: '' # Suppresses the sp
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值