我想在amazon aws sqs中添加消息到队列
所以我试过这个
root~# aws sqs send-message --queue-url "queue/url" --message-body "message with attribute" --message-attributes '{"Name": "somename", "Type":"String", "Value":"somevalue"}'
Run Code Online (Sandbox Code Playgroud)
它给了我这个错误
'unicode' object has no attribute 'keys'
Run Code Online (Sandbox Code Playgroud)
但如果我--message-attributes从命令中删除该部分
root~# aws sqs send-message --queue-url "queue/url" --message-body "message with attribute"
Run Code Online (Sandbox Code Playgroud)
然后它完美无缺
http://docs.aws.amazon.com/cli/latest/reference/sqs/send-message.html
我猜它是地图类型如何以地图格式发送此参数
--message-attributes (map)
我正在尝试通过 amazon CLI 启动一个 amazon 集群,但我有点困惑我应该如何指定多个文件。我目前的电话如下:
aws emr create-cluster --steps Type=STREAMING,Name='Intra country development',ActionOnFailure=CONTINUE,Args=[-files,s3://betaestimationtest/mapper.py,-
files,s3://betaestimationtest/reducer.py,-mapper,mapper.py,-reducer,reducer.py,-
input,s3://betaestimationtest/output_0_inter,-output,s3://betaestimationtest/output_1_intra]
--ami-version 3.1.0
--instance-groupsInstanceGroupType=MASTER,InstanceCount=1,InstanceType=m3.xlarge
InstanceGroupType=CORE,InstanceCount=2,InstanceType=m3.xlarge --auto-terminate
--log-uri s3://betaestimationtest/logs
Run Code Online (Sandbox Code Playgroud)
但是,Hadoop 现在抱怨它找不到减速器文件:
Caused by: java.io.IOException: Cannot run program "reducer.py": error=2, No such file or directory
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?该文件确实存在于我指定的文件夹中
将SSL证书上传到AWS IAM以进行cloundfront时,我遇到了问题.我认为该命令没问题且文件正常但仍然出错.
我们使用以下命令上传SSL证书:
aws iam upload-server-certificate --server-certificate-name SSL-CloudFront --certificate-body Public.cer --private-key keyStore.pem --certificate-chain STAR_xxxxxx_com.ca-bundle --path /cloudfront/ICE_SSL/
Run Code Online (Sandbox Code Playgroud)
错误:
调用UploadServerCertificate操作时发生客户端错误(MalformedCertificate):无法解析证书.请确保证书是PEM格式.
我该如何解决这个问题?
我知道这个链接与我的问题几乎相同,但我已经按照那里的答案,但这并没有产生我需要的东西.
我在终端输入以下内容:
aws ec2 describe-instances --instance-ids i-17xxxxxx5 | awk '/PrivateIpAddress/{print $2}'
Run Code Online (Sandbox Code Playgroud)
我得到这个输出:
"10.96.2.194",
[
"10.96.2.194"
"10.96.2.194"
Run Code Online (Sandbox Code Playgroud)
我怎么才能得到10.96.2.194?
我正在编写一个 shell 脚本来从 dynamoDB 表中查询一个属性。我正在使用 AWS CLI 编写脚本。
我想从 MY_TABLE_NAME 中为 ReferenceId gfsdgrhfsh 找到 AccountId。当我在 AttributeValueList 中提供属性的确切值时,查询操作成功并获得正确的属性值。
aws dynamodb query --table-name MY_TABLE_NAME \
--select SPECIFIC_ATTRIBUTES --attributes-to-get "AccountId" \
--key-conditions '{"ReferenceId": {"AttributeValueList": [ {"S": "gfsdgrhfsh" } ], "ComparisonOperator": "EQ"} }' \
--limit 1 | jq '.Items[0].AccountId.S'
Run Code Online (Sandbox Code Playgroud)
上面的命令给了我正确的帐户 ID。
但是,当我将 ReferenceId gfsdgrhfsh 分配给一个变量,然后将该变量放入命令中时,我没有得到响应。
referenceId=gfsdgrhfsh
aws dynamodb query --table-name MY_TABLE_NAME \
--select SPECIFIC_ATTRIBUTES --attributes-to-get "AccountId" \
--key-conditions '{"ReferenceId": {"AttributeValueList": [ {"S": "$referenceId" } ], "ComparisonOperator": "EQ"} }' \
--limit 1 | jq '.Items[0].AccountId.S' …Run Code Online (Sandbox Code Playgroud) 我只想列出我拥有或可以使用的AMI
但是,我找不到一个简单的方法来做到这一点 aws cli
当我输入 aws ec2 describe-images --filters Name=image-type,Values=kernel


有谁知道如何使用名称和特定标签导出 AWS 账户中的所有实例?我拥有的标签名为 Billing by Role。尝试使用 aws ec2 describe-instances 来实现这一点。
我尝试使用这个:
aws ec2 describe-instances --query 'Reservations[].Instances[].[Tags[?Key==`Name`].Value[] | [0], [Tags[?Key==`Billing by Role`].Value[]]' --output text
Run Code Online (Sandbox Code Playgroud)
但我收到一个错误:
ValueError: --query Reservations[].Instances[].[Tags[?Key== Name] .Value[] 的错误值| [0], [Tags[?Key== Billing by Role].Value[]]: Invalid token.: 在靠近 token "" (EOF) 的第 101 列解析错误表达:“Reservations[].Instances[].[Tags[? Key== Name].Value[] | [0], [Tags[?Key== Billing by Role].Value[]]"
谢谢。
我可以使用以下命令从 AWS S3 中获取最后五个更新的文件
aws s3 ls s3://somebucket/ --recursive | sort | tail -n 5 | awk '{print $4}'
Run Code Online (Sandbox Code Playgroud)
现在我需要删除 AWS S3 中的所有文件,除了从 AWS 中的上述命令获取的最后 5 个文件。
说命令 fetches 1.txt,2.txt,3.txt,4.txt,5.txt。我需要从 AWS S3 中删除除1.txt,2.txt,3.txt,4.txt,and 5.txt.
我正在尝试获取在/ dev / sdf挂载到特定实例的设备的卷ID。
命令:aws ec2 describe-volumes --filters Name = attachment.instance-id,Values = $ instance_id_main --region us-west-2 --output json
输出:
{
"Volumes": [
{
"AvailabilityZone": "us-west-2a",
"Attachments": [
{
"AttachTime": "2017-06-15T12:59:18.000Z",
"InstanceId": "i-073cfdf5832e5a7ab",
"VolumeId": "vol-096ca253d37b3e42b",
"State": "attached",
"DeleteOnTermination": false,
"Device": "/dev/sdf"
}
],
"Tags": [
{
"Value": "NewVolume",
"Key": "Name"
}
],
"Encrypted": false,
"VolumeType": "gp2",
"VolumeId": "vol-096ca253d37b3e42b",
"State": "in-use",
"Iops": 100,
"SnapshotId": "",
"CreateTime": "2017-06-15T12:39:06.687Z",
"Size": 5
},
{
"AvailabilityZone": "us-west-2a",
"Attachments": [
{
"AttachTime": "2017-06-15T12:57:46.000Z",
"InstanceId": "i-073cfdf5832e5a7ab",
"VolumeId": "vol-0189e6a20392bb709", …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用CLI将一些数据写入AWS Kinesis,但这是行不通的:
aws kinesis put-record --stream-name my-stream-name --data Data=jose|12
Run Code Online (Sandbox Code Playgroud)
我收到“ bash:12:找不到命令”错误。
aws kinesis put-record help 有效,所以我不明白错误。
我正在关注本文档。
aws-cli ×10
amazon-ec2 ×2
shell ×2
amazon-emr ×1
amazon-s3 ×1
amazon-sqs ×1
hadoop ×1
linux ×1
ssl ×1
terminal ×1