首页 > 解决方案 > AWS CLI:找不到配置文件

问题描述

目前正在将 yml 文件部署到 CloudFormation,我已经创建了这个名为 awsbootsrap 的配置文件,但是当我的脚本运行时出现错误。我的脚本:

#!/bin/bash
STACK_NAME=awsbootstrap
REGION=us-east-2c
CLI_PROFILE=awsbootstrap
EC2_INSTANCE_TYPE=t2.micro

# Deploy the CloudFormation template
echo $CLI_PROFILE
echo -e "\n\n=========== Deploying main.yml ==========="
aws cloudformation deploy --region $REGION --profile $CLI_PROFILE --stack-name $STACK_NAME --template-file main.yml --no-fail-on-empty-changeset --capabilities CAPABILITY_NAMED_IAM --parameter-overrides EC2InstanceType=$EC2_INSTANCE_TYPE


# If the deploy succeeded, show the DNS name of the created instance
if [ $? -eq 0 ]; then
    aws cloudformation list-exports --profile awsbootstrap --query "Exports[?Name=='InstanceEndpoint'].Value"
fi

其中 $CLI_PROFILE=awsbootstrap

我得到找不到配置文件(awsbootstrap)

运行aws configure list-profile显示我的个人资料 -> awsbootstrap

跑步aws configure list节目

      Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile                <not set>             None    None
access_key                <not set>             None    None
secret_key                <not set>             None    None
    region                <not set>             None    None

我的~/.aws/config样子是这样的(也尝试过 us-east-1 / us-east-2):

[profile awsbootstrap]
region = us-east-2c
output = json

我的~/.aws/credentials样子是这样的:

[awsbootstrap]
aws_access_key_id = redacted
aws_secret_access_key = redacted

我没有产生问题的环境变量......

标签: amazon-web-servicesamazon-cloudformationaws-cli

解决方案


推荐阅读