until [ $(aws ssm get-automation-execution --automation-execution-id "$id" --query 'AutomationExecution.AutomationExecutionStatus' --output text) = *"InProgress"* ];
do
echo "Automation is running......"
sleep 1m
done
status=$(aws ssm get-automation-execution --automation-execution-id "$id" --query 'AutomationExecution.AutomationExecutionStatus' --output text)
if [ "$status" == "Success" ]; then
echo "Automation $status"
elif [ "$status" == "Failed" -o "$status" == "Cancelled" -o "$status" == "Timed Out" ]; then
echo "Automation $status"
fi
Run Code Online (Sandbox Code Playgroud)
这里循环永远不会退出,它继续打印“自动化正在运行......”即使在自动化已经执行并且状态不是进行中我想要做的是等到状态为“进行中”,打印“自动化是运行......”在屏幕上。完成后,如果失败或成功,我想在屏幕上打印自动化的状态。
我创建了 SES 模板并从 aws-cli 呈现它,如您所见,非英语文本被替换为“?”,无论是纯文本版本还是 HTML 版本。如何解决这个问题?PS:我也通过发送电子邮件进行了检查。
以下是我的 TestMainTemplate.json 文件
{
"Template": {
"TemplateName": "TestTemplate01",
"SubjectPart": "????? {{name}}!",
"HtmlPart": "<h1>????? {{name}}??</h1><p>???????AWS?????{{favoriteservice}}????</p>",
"TextPart": "?? {{name}}??\r\n???????AWS?????{{favoriteservice}}????\r\n??"
}
}
Run Code Online (Sandbox Code Playgroud)
命令从 cli 将模板上传到 aws SES:
aws ses create-template --cli-input-json file://TestMainTemplate.json --region us-east-1
渲染模板的命令:
aws ses test-render-template --template-name TestTemplate01 --template-data '{ "name": "??" , "favoriteservice": "SES" }' --region us-east-1
输出:
Date: 2018-09-14T03:27:46.913Z
Message-ID: <5990...........ec2-user@ip-......ec2.internal>
Subject: ????? ??!
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_106793_202759574.1536895666913"
Content-Transfer-Encoding: quoted-printable
------=_Part_106793_202759574.1536895666913
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
?? ????
???????AWS?????SES????
??
------=_Part_106793_202759574.1536895666913 …Run Code Online (Sandbox Code Playgroud) 我找不到列出具有以下信息的 IAM 用户的方法:
我试过了,aws iam list-users但这并没有告诉我太多。
这可以使用 AWS CLI 吗?如果是这样,如何?
我有一个 AWS SSM CLI 命令的字符串参数,由于以/. /path/to/my/param.
当我在 git bash 上运行命令时,它会尝试查找文件,无论我如何尝试转义它:
aws ssm get-parameter --name "/path/to/my/param"
aws ssm get-parameter --name '/path/to/my/param'
aws ssm get-parameter --name '\/path\/to\/my\/param'
An error occurred (ValidationException) when calling the GetParameter operation: Invalid label format /Program Files/Git/path/to/my/param. A label name can't be prefixed with numbers, "ssm", or "aws" (case-insensitive). You can specify letters, numbers, and the following symbols: period (.), dash (-), or underscore (_).
甚至尝试反引号,然后我收到一个 bash 错误
aws ssm get-parameter --name `/path/to/my/param`
Run Code Online (Sandbox Code Playgroud)
错误: bash: …
你好吗。我正在使用 aws s3 存储桶同步 react.js Web 应用程序构建目录。当我通过输入亚马逊控制台(https://s3.console.aws.amazon.com/)手动将构建目录中的文件上传到 s3 时,所有上传的文件都是公开的,因此当我访问端点时,它显示网站很好(我正在使用s3 用于静态网站托管)
但是如果我将它与 aws cli 同步
aws s3 sync build/ s3://mybucketnamehere --delete
Run Code Online (Sandbox Code Playgroud)
我可以在存储桶中看到所有上传的新文件,但这些都被拒绝访问,所以当我进入网站时它给了我 403 错误。
这是政策
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:DeleteObject",
"s3:DeleteObjectTagging",
"s3:DeleteObjectVersion",
"s3:DeleteObjectVersionTagging",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:PutObject",
"s3:PutObjectAcl"
],
"Resource": [
"arn:aws:s3:::mybucketnamehere",
"arn:aws:s3:::mybucketnamehere/*"
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
谢谢
我正在使用 AWS SNS 服务并完成了作为 AWS 文档的初始设置。我只需要使用 aws-cli 对其进行测试。因此,我使用以下命令从本地 PC 向 SNS 主题发布测试消息。
aws sns publish --topic-arn "arn:aws:sns:us-east-1:xxxxxxxxxxx:test-notification-service" --message "Hello, from SNS"
Run Code Online (Sandbox Code Playgroud)
但是,我遇到了以下一般错误。它只是说无效参数。我已经根据需要配置了 ~/.aws/credentials。
An error occurred (InvalidParameter) when calling the Publish operation: Invalid parameter: TopicArn
Run Code Online (Sandbox Code Playgroud) 我在 circle ci 上使用 Maven liquibase 插件运行数据库作业。我需要从 AWS Parameter store 读取用户名、密码、dburl 等参数。但是当我尝试将 aws cli 返回的值设置为自定义变量时,它始终为空白/空。我知道该值存在是因为 mac 终端上的相同命令返回一个值。
我正在使用 Bash 脚本通过 circle ci 作业安装 AWS CLI。当我在 .sh 文件中回显密码时,我看到了该值,但是当我在 config.yml 上回显时,我看到了空白的空值。我还尝试使用 aws ssm 和 config.yml 文件来获取值,但即使在那里该值也是空的。
我的配置文件
version: 2
references:
defaults: &defaults
working_directory: ~/tmp
environment:
PROJECT_NAME: DB Job
build-filters: &filters
filters:
tags:
only: /^v[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}-(dev)/
branches:
ignore: /.*/
jobs:
checkout-code:
<<: *defaults
docker:
- image: circleci/openjdk:8-jdk-node
steps:
- attach_workspace:
at: ~/tmp
- checkout
- restore_cache:
key: cache-{{ checksum "pom.xml" }}
- save_cache:
paths: …Run Code Online (Sandbox Code Playgroud) 我正在从 aws-cli 开始部署:
"C:\Program Files\Amazon\AWSCLI\bin\aws.exe" deploy create-deployment --application-name App.Web --deployment-config-name CodeDeployDefault.OneAtATime --deployment-group-name Development-Staging-UAT --region us-west-2 --description "App.Web" --s3-location bucket=app-artifacts/development,bundleType=zip,key=Publish.zip
Run Code Online (Sandbox Code Playgroud)
这确实启动了部署,但在 DownloadBundle 部分以错误结束:
:bucket option must not contain a forward-slash (/)
Run Code Online (Sandbox Code Playgroud)
修订位置 s3://app-artifacts/development/Publish.zip
我究竟做错了什么?
创建 VPC 后,我如何通过 aws ec2 describe-vpcs 从特定 VPC 中仅 grep 1 个 VPC-ID,以便 VPC ID 可以在下一步的脚本中传递,我知道我可以从该命令手动查看它或从 AWS 控制台,
例如:
aws ec2 describe-vpcs --vpc-ids |grep VpcId
"VpcId": "vpc-00a0338c2f671a77c",
"VpcId": "vpc-0b3697513d5987516",
"VpcId": "vpc-061e25f5f78877798",
Run Code Online (Sandbox Code Playgroud)
它给了我所有这些,或者:
aws ec2 describe-vpcs --vpc-ids |grep -i ansible
"Value": "ANSIBLE_VPC",
Run Code Online (Sandbox Code Playgroud)
但我只需要从命令中获取该特定 VPC 的 VPC-ID。
我知道可以从 EC2 控制台上的 EBS 快照创建 AMI。
我不想在 AWS 控制台上而是使用 AWS CLI 命令来操作此 AMI 创建。
该aws ec2 copy-image命令没有任何要指定的 EBS 快照选项。有没有办法用 CLI 或调用 API 来做到这一点?
aws-cli ×10
shell ×2
amazon-ec2 ×1
amazon-s3 ×1
amazon-ses ×1
amazon-sns ×1
amazon-vpc ×1
aws-ssm ×1
bash ×1
circleci ×1
circleci-2.0 ×1
git-bash ×1
reactjs ×1
ssm ×1
windows ×1