标签: aws-cli

为什么从 cli 运行 aws update-service 会导致弹出类似 vim 的窗口,需要一些输入?

运行 aws ecs update-service --cluster cluster-name --service service-name --force-new-deployment --region ap-southeast-2打开:

{
    "service": {
        "serviceArn": "arn:aws:ecs:ap-southeast-2:000000000000:service/service-name",
        "serviceName": "service-name",
        "clusterArn": "arn:aws:ecs:ap-southeast-2:000000000000:cluster/clustername",
        "loadBalancers": [
            {
                "targetGroupArn": "arn:aws:elasticloadbalancing:ap-southeast-2:000000000000:targetgroup/targetgroupname",
                "containerName": "containername",
                "containerPort": 5000
            }
        ],
        "serviceRegistries": [],
        "status": "ACTIVE",
        "desiredCount": 1,
        "runningCount": 1,
        "pendingCount": 1,
        "launchType": "FARGATE",
        "platformVersion": "LATEST",
        "taskDefinition": "arn:aws:ecs:ap-southeast-2:000000000000:task-definition/service-name:43",
:
Run Code Online (Sandbox Code Playgroud)

并阻止我的外壳直到我按下q。这曾经工作得很好。我想我更新了我的 AWSCLI,导致了这个问题。为什么会发生这种情况?如何避免在 CI 脚本中更新我的服务?

bash amazon-ecs aws-cli

4
推荐指数
1
解决办法
1504
查看次数

AWS CLI 与控制台 - Cost Explorer

我发现 AWS Cost Explorer 控制台和 AWS CLI Cost Explorer 给出了两个不同的数字。有什么原因导致这种情况发生吗?

例如:从我的控制台,您可以看到我的 Cloudtrail 总额为 72.66 美元

在此输入图像描述

然而,当我将这些相同的精确指标用于 CLI 时,我的总计为 72.04 美元

在此输入图像描述

我知道这看起来没什么大区别,我只是以 Cloudtrail 为例,但我的一些价格较高的服务有更大的差异。出现这种情况是否有原因/是否可以采取措施使控制台和 CLI 具有匹配的每月成本?

amazon-web-services aws-cli boto3 aws-billing

4
推荐指数
1
解决办法
1964
查看次数

如果我使用 AWS CLI S3“mv”命令,其背后的请求类型是什么?

我在任何地方都找不到那个。如果我使用类似 的命令aws s3 mv s3://bucket/ <local_pc>,那么它后面的 HTTP 请求是什么类型?是获取还是复制?

amazon-web-services aws-cli

4
推荐指数
1
解决办法
6586
查看次数

使用 AWS CLI 测试 Amazon SageMaker 模型终端节点时,base64 无效:“{"instances": [{"in0":[863],"in1":[882]}]}"

我是 Amazon SageMaker 的新手,我正在密切关注本教程https://aws.amazon.com/blogs/machine-learning/creating-a-machine-learning-powered-rest-api-with-amazon-api-gateway -mapping-templates-and-amazon-sagemaker/使用 Amazon API Gateway 映射模板和 Amazon SageMaker 创建机器学习驱动的 REST API

当我在终端上运行以下命令时(教程的步骤 2)

aws sagemaker-runtime invoke-endpoint \
  --endpoint-name <endpoint-name> \
  --body '{"instances": [{"in0":[863],"in1":[882]}]}' \
  --content-type application/json \
  --accept application/json \
  results
Run Code Online (Sandbox Code Playgroud)

我收到以下错误: Invalid base64: "{"instances": [{"in0":[863],"in1":[882]}]}" 我的端点位于InServiceSageMaker 控制台上,并且示例 Jupyter 笔记本成功运行。(我也<endpoint-name>用实际名称替换 - 在名称周围有/没有引号时收到相同的错误)

这里使用的zsh是 aws cli 版本:

aws --version
aws-cli/2.0.15 Python/3.7.4 Darwin/19.4.0 botocore/2.0.0dev19
Run Code Online (Sandbox Code Playgroud)

想知道可能是什么问题。任何帮助表示赞赏

amazon-web-services aws-cli amazon-sagemaker

4
推荐指数
1
解决办法
3008
查看次数

将文件从s3复制到本地?

我的 s3 存储桶中有很多文件,那么是否有任何 aws cli 命令可以用来查找 s3 中具有前缀名称的最新文件?如何将该文件从 s3 复制到我的本地文件夹?我可以使用 Boto3 或 python 库来执行此操作吗?

amazon-s3 boto amazon-web-services aws-cli

4
推荐指数
1
解决办法
1万
查看次数

如何替换已弃用的 aws ecr get-login --registry-ids

我正在尝试按照此示例提取 Amazon SageMaker Pytorch 公共映像之一。在示例中,他们使用 shell 脚本和 Dockerfile 来拉取扩展构建容器并将其推送到 ECR。这是 shell 脚本:

# The name of our algorithm
algorithm_name=pytorch-extending-our-containers-cifar10-example

cd container

account=$(aws sts get-caller-identity --query Account --output text)

# Get the region defined in the current configuration (default to us-west-2 if none defined)
region=$(aws configure get region)
region=${region:-us-west-2}

fullname="${account}.dkr.ecr.${region}.amazonaws.com/${algorithm_name}:latest"

# If the repository doesn't exist in ECR, create it.

aws ecr describe-repositories --repository-names "${algorithm_name}" > /dev/null 2>&1

if [ $? -ne 0 ]
then
    aws ecr create-repository --repository-name …
Run Code Online (Sandbox Code Playgroud)

docker aws-cli amazon-ecr

4
推荐指数
1
解决办法
4294
查看次数

安装后 Linux 中的 aws-cli 2 权限被拒绝错误

在运行时使用官方 AWS 指南permission denied error安装 aws-cli 版本后获取aws --version

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
Run Code Online (Sandbox Code Playgroud)

amazon-web-services aws-cli

4
推荐指数
1
解决办法
8551
查看次数

使用 AWS CLI 时如何在 JMESPath 查询中设置空值的默认值?

我正在尝试使用带查询的 AWS CLI 运行命令。该命令可能很简单,例如aws s3api list-buckets --query 'sum(Versions[*].Size)'

但是,有时某些值可能会返回 null。在上面的示例中,当没有任何内容时,size 可以为 null,命令将返回以下错误:

In function sum(), invalid type for value: None, expected one of: ['array-number'], received: "null"

我怎样才能给它一个默认值?如果实际值为空,我想将其设置为,0以便结果中有一些值而不是错误。

command-line-interface amazon-web-services aws-cli jmespath

4
推荐指数
1
解决办法
3571
查看次数

如何静默运行 aws cli 命令来创建 dynamodb 表

我正在创建一个 shell 脚本,它将在本地创建几个 dynamodb 表等。这是我正在使用的创建表 AWS CLI 命令:

aws dynamodb create-table --cli-input-json file://table-user.json --endpoint-url http://localhost:8000
Run Code Online (Sandbox Code Playgroud)

table-user.json 包含用于创建的所有表相关信息。

此命令的问题是我需要单击“q”键才能继续执行下一行,因为它提供表详细信息作为输出。前任:

{
    "TableDescription": {
        "AttributeDefinitions": [
            {
                "AttributeName": "id",
                "AttributeType": "S"
            },
            {
                "AttributeName": "externalId",
                "AttributeType": "S"
            },
.
.
.
Run Code Online (Sandbox Code Playgroud)

如何静默运行创建表命令?

amazon-dynamodb aws-cli amazon-dynamodb-local

4
推荐指数
1
解决办法
1465
查看次数

如何禁用 AWS CLI 帮助输出的分页?

我想显示一些帮助文本,并用 grep 搜索它。

aws ec2 help | grep instance

AWS CLI 用于more对帮助进行分页。

要禁用它我已经尝试过:

aws --no-cli-pager ec2 help | grep instance

export AWS_PAGER=''; aws ec2 help | grep instance

并更改cli_pager配置文件:

[default]
cli_pager=
Run Code Online (Sandbox Code Playgroud)

它仍然使用寻呼机。

我在 Cygwin 上使用 AWS CLIv2 Windows 版本。

如何禁用它?

amazon-web-services aws-cli

4
推荐指数
1
解决办法
1520
查看次数