我想尝试运行以下的terraform代码
provisioner "remote-exec" {
inline = [
"cd /home/ec2-user",
"curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py",
"sudo python get-pip.py",
"pip install --upgrade --user awscli",
"echo mokul",
"aws --version",
"echo mymsp",
"eval $(aws ecr get-login --no-include-email --region us-east-1)"
]
}
terraform可以安装pip和aws但无法找到aws命令 成功安装了PyYAML-3.12 awscli-1.11.107 botocore-1.5.70 colorama-0.3.7 docutils-0.13.1 futures-3.1.1 jmespath-0.9.3 pyasn1-0.2.3 python-dateutil-2.6.0 rsa-3.4 .2 s3transfer-0.1.10 six-1.10.0
/tmp/terraform_760494262.sh: line 6: aws: command not found
答案 0 :(得分:0)
在运行pip install --upgrade --user awscli
export PATH=~/.local/bin:$PATH
source ~/.bash_profile
aws --version