【问题标题】:bash: ./create.sh: Permission denied, when try to build a stackbash:./create.sh:权限被拒绝,尝试构建堆栈时
【发布时间】:2021-01-25 03:33:19
【问题描述】:

我已经创建了一个具有 AdministratorAccess 策略的用户,我可以运行 aws s3 ls 并且它运行良好,但是当我尝试在 bash 中使用模板来使用 Cloudformation 构建堆栈时

aws cloudformation create-stack \
--stack-name $1 \
--template-body file://$2 \
--region=us-west-2 \
--capabilities CAPABILITY_IAM

如果我尝试在包含./create.sh test testVPC.yml 的所有文件的目录中构建一个堆栈,但我收到错误:bash: ./create.sh: Permission denied

我正在尝试部署一个简单的 VPC:

Description: >
  This template deploys a VCP.
Resources:
  VPC:
  Type: AWS::EC2::VPC
  Properties:
  CidrBlock: 10.0.0.0/24
  EnableDnsHostnames: true

你能帮帮我吗?

【问题讨论】:

  • chmod 755 create.sh

标签: bash amazon-web-services amazon-cloudformation


【解决方案1】:

您的错误似乎是 bash 错误,而不是 CloudFormation 错误。 为了运行./create.sh,你所在的linux/unix系统必须相信create.sh是一个可执行程序。

chmod 755 create.sh

此外,通常 create.sh 的第一行应指示使用哪种语言解释器,在您的情况下为 bash:

#!/bin/bash

虽然这可能看起来是可选的,因为在某些系统上,如果第一行 #! 被省略,它仍然使用 sh(或 bash)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-15
    • 2011-08-20
    • 2014-06-21
    • 1970-01-01
    相关资源
    最近更新 更多