【发布时间】:2019-03-11 08:31:17
【问题描述】:
我的 cloudformation 模板的用户数据中有以下命令:
MOUNT_TARGET_IP=$(aws efs describe-mount-targets --file-system-id fs-xxxxxxx --query 'MountTargets[*].IpAddress' --output text)
在我的模板中,我还有以下政策:
MyPolicy:
Type: "AWS::IAM::Policy"
Properties:
PolicyName: !Sub "${AWS::StackName}_bucket_and_mount_targets_policy"
PolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: "Allow"
Action: "s3:GetObject"
Resource: !Sub "arn:aws:s3:::${AuthorizedKeyBucketName}/authorized_keys"
-
Effect: "Allow"
Action: "s3:ListBucket"
Resource: !Sub "arn:aws:s3:::${AuthorizedKeyBucketName}"
-
Effect: "Allow"
Action: "elasticfilesystem:DescribeMountTargets"
Resource: "arn:aws:elasticfilesystem:us-east-1:xxxxxxxxxx:file-system/fs-xxxxxxx"
Roles:
-
!Ref MyRole
我不确定为什么我仍然收到以下错误:
You must specify a region. You can also configure your region by running "aws configure".
当我ssh进入实例,然后手动配置区域和访问密钥,然后尝试执行上述语句,似乎工作正常。
有什么想法吗?
【问题讨论】:
-
您使用的是amazon linux AMI,还是其他的?
标签: amazon-web-services amazon-cloudformation amazon-iam amazon-efs