欢迎访问 SJsir 圣杰博客

A Linux operation and maintenance engineer's Blogs

AWS命令行工具(三)

AWSCLI常用命令:

    1.AutoScaling:

            列出AS组:aws autoscaling describe-auto-scaling-groups
            列出AS实例:aws autoscaling describe-auto-scaling-instances –instance-ids [instance-id-1 instance-id-2 …]
            从组中分离实例:aws autoscaling detach-instances –auto-scaling-group-name myasgroup –instance-ids instanceid1 instanceid2 [–should-decrement-desired-capacity|–no-should-decrement-desired-capacity]
            附加实例到组:aws autoscaling attach-instances –auto-scaling-group-name myasgroup –instance-ids instanceid1 instanceid2
            挂起AS流程:aws autoscaling suspend-process –auto-scaling-group-name myasgroup –scaling-processes AZRebalance|AlarmNotification|…
            删除AS组:aws autoscaling delete-auto-scaling-group –auto-scaling-group-name myasgroup

    2.S3:

        (1)查看
            aws s3 ls
            aws s3 ls s3://bucket
            aws s3 ls s3://bucket/prefix
        (2)拷贝
            aws s3 cp /to/local/path s3://bucket/prefix
            aws s3 cp s3://bucket/prefix /to/local/path
            aws s3 cp s3://bucket1/prefix1 s3://bucket2/prefix2
        (3)同步
            aws sync [–delete] /to/local/dir s3://bucket/prefixdir
            aws sync [–delete] s3://bucket/prefixdir /to/local/dir
            aws sync [–delete] s3://bucket1/prefixdir1 s3://bucket2/prefixdir2

    3.IAM:

        Role 操作:
            aws iam create-role MY-ROLE-NAME –assum-role-policy-document file://path/to/trustpolicy.json
            aws iam put-role-policy –role-name MY-ROLE-NAME –policy-name MY-PERM-POLICY –policy-document file://path/to/permissionpolicy.json
            aws iam create-instance-profile –instance-profile-name MY-INSTANCE-PROFILE
            aws iam add-role-to-instance-profile –instance-profile-name MY-INSTANCE-PROFILE –role-name MY-ROLE-NAME

    4.AUTO-SCALING:

        查看信息:
            aws autoscaling describe-auto-scaling-groups
            aws autoscaling describe-auto-scaling-instances

    5.kinesis:

            创建流:aws kinesis create-stream –stream-name mystream –shard-count
            列出流:aws kinesis list-streams
            获取指定流的分片迭代器:aws kinesis get-shard-iterator –stream-name mystream –shard-id shard-1 –shard-iterator-type TRIM_HORIZON
            发送数据到流:aws kinesis put-record –stream-name mystream –partition-key mykey –data test
            获取流数据:aws kinesis get-records –shard-iterator myiterator
点赞