我试着按照这个教程.
这就是我在控制台中所做的:
pip3 install --user --upgrade awscli
Run Code Online (Sandbox Code Playgroud)
在那之后,当我写:
pip3 --version
Run Code Online (Sandbox Code Playgroud)
我越来越:
pip 9.0.1 from /Users/user/Library/Python/3.4/lib/python/site-packages (python 3.4)
Run Code Online (Sandbox Code Playgroud)
然后我写道:
pip3 install --user --upgrade awscli
Run Code Online (Sandbox Code Playgroud)
此命令已下载awscli并自动添加:
# Setting PATH for Python 3.4
# The orginal version is saved in .profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH
Run Code Online (Sandbox Code Playgroud)
对我的 .profile
后来,为了确定,我写道:
source ~/.profile
Run Code Online (Sandbox Code Playgroud)
然后当我输入:
user$ aws
-bash: aws: command not found
Run Code Online (Sandbox Code Playgroud)
我也没有运气重新启动终端.
这有什么问题?
每次我想用AWS配置时我都会收到以下错误:
"The config profile (myname) could not be found"
Run Code Online (Sandbox Code Playgroud)
喜欢:aws configure
我正在使用Python 3.4,我想使用AWS CLI Keyring来加密我的凭据.
我正在尝试使用aws容器服务,根据http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_GetStarted.html中的文档
运行命令时抛出以下错误:
aws ecs list-container-instances --cluster default
You must specify a region. You can also configure your region by running "aws configure".
Run Code Online (Sandbox Code Playgroud)
该文档未提及有关指定默认区域的任何信息.我们如何在控制台中执行此操作?
是否可以通过AWS命令行获取S3存储桶的ARN?
我已经通过了文档看起来aws s3api ...和aws s3 ...和还没有找到一种方法来做到这一点.
我可以使用以下命令查看日志.
aws logs get-log-events --log-group-name groupName --log-stream-name streamName --limit 100
Run Code Online (Sandbox Code Playgroud)
什么是获取功能的命令,tail -f以便我可以实时查看日志
我创建了一个新的Access Key,并在AWS CLI中对其进行了配置aws configure.它创建了.ini文件~/.aws/config.当我运行aws s3 ls它时给出:
调用ListBuckets操作时发生客户端错误(InvalidAccessKeyId):您提供的AWS Access Key ID在我们的记录中不存在.
AmazonS3FullAccess策略也附加到用户.如何解决这个问题?
我正在尝试设置Amazon Linux AMI(ami-f0091d91)并且有一个脚本运行复制命令以从S3存储桶复制.
aws --debug s3 cp s3://aws-codedeploy-us-west-2/latest/codedeploy-agent.noarch.rpm .
Run Code Online (Sandbox Code Playgroud)
此脚本在我的本地计算机上运行良好,但在Amazon Image上出现以下错误失败:
2016-03-22 01:07:47,110 - MainThread - botocore.auth - DEBUG - StringToSign:
HEAD
Tue, 22 Mar 2016 01:07:47 GMT
x-amz-security-token:AQoDYXdzEPr//////////wEa4ANtcDKVDItVq8Z5OKms8wpQ3MS4dxLtxVq6Om1aWDhLmZhL2zdqiasNBV4nQtVqwyPsRVyxl1Urq1BBCnZzDdl4blSklm6dvu+3efjwjhudk7AKaCEHWlTd/VR3cksSNMFTcI9aIUUwzGW8lD9y8MVpKzDkpxzNB7ZJbr9HQNu8uF/st0f45+ABLm8X4FsBPCl2I3wKqvwV/s2VioP/tJf7RGQK3FC079oxw3mOid5sEi28o0Qp4h/Vy9xEHQ28YQNHXOBafHi0vt7vZpOtOfCJBzXvKbk4zRXbLMamnWVe3V0dArncbNEgL1aAi1ooSQ8+Xps8ufFnqDp7HsquAj50p459XnPedv90uFFd6YnwiVkng9nNTAF+2Jo73+eKTt955Us25Chxvk72nAQsAZlt6NpfR+fF/Qs7jjMGSF6ucjkKbm0x5aCqCw6YknsoE1Rtn8Qz9tFxTmUzyCTNd7uRaxbswm7oHOdsM/Q69otjzqSIztlwgUh2M53LzgChQYx5RjYlrjcyAolRguJjpSq3LwZ5NEacm/W17bDOdaZL3y1977rSJrCxb7lmnHCOER5W0tsF9+XUGW1LMX69EWgFYdn5QNqFk6mcJsZWrR9dkehaQwjLPcv/29QcM+b5u/0goazCtwU=
/aws-codedeploy-us-west-2/latest/codedeploy-agent.noarch.rpm
2016-03-22 01:07:47,111 - MainThread - botocore.endpoint - DEBUG - Sending http request: <PreparedRequest [HEAD]>
2016-03-22 01:07:47,111 - MainThread - botocore.vendored.requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): aws-codedeploy-us-west-2.s3.amazonaws.com
2016-03-22 01:07:47,151 - MainThread - botocore.vendored.requests.packages.urllib3.connectionpool - DEBUG - "HEAD /latest/codedeploy-agent.noarch.rpm HTTP/1.1" 403 0
2016-03-22 01:07:47,151 - MainThread - botocore.parsers - …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用AWS文档建议的一个简单示例,使用策略json文件创建角色 http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-service.html 我收到错误
A client error (MalformedPolicyDocument) occurred when calling the CreateRole operation: Has prohibited field Resource
Run Code Online (Sandbox Code Playgroud)
这是命令,
>> aws iam create-role --role-name test-service-role --assume-role-policy-document file:///home/ec2-user/policy.json
A client error (MalformedPolicyDocument) occurred when calling the CreateRole operation: Has prohibited field Resource
Run Code Online (Sandbox Code Playgroud)
该策略与示例中提到的策略完全相同
>> cat policy.json
{
"Version": "2012-10-17",
"Statement": {
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::example_bucket"
}
}
Run Code Online (Sandbox Code Playgroud)
我的版本似乎是最新的
>> aws --version
aws-cli/1.9.9 Python/2.7.10 Linux/4.1.10-17.31.amzn1.x86_64 botocore/1.3.9
Run Code Online (Sandbox Code Playgroud) 我使用aws cli使用以下命令(文档)列出s3存储桶中的文件:
aws s3 ls s3://mybucket --recursive --human-readable --summarize
Run Code Online (Sandbox Code Playgroud)
这个命令给我以下输出:
2013-09-02 21:37:53 10 Bytes a.txt
2013-09-02 21:37:53 2.9 MiB foo.zip
2013-09-02 21:32:57 23 Bytes foo/bar/.baz/a
2013-09-02 21:32:58 41 Bytes foo/bar/.baz/b
2013-09-02 21:32:57 281 Bytes foo/bar/.baz/c
2013-09-02 21:32:57 73 Bytes foo/bar/.baz/d
2013-09-02 21:32:57 452 Bytes foo/bar/.baz/e
2013-09-02 21:32:57 896 Bytes foo/bar/.baz/hooks/bar
2013-09-02 21:32:57 189 Bytes foo/bar/.baz/hooks/foo
2013-09-02 21:32:57 398 Bytes z.txt
Total Objects: 10
Total Size: 2.9 MiB
Run Code Online (Sandbox Code Playgroud)
但是,这是我想要的输出:
a.txt
foo.zip
foo/bar/.baz/a
foo/bar/.baz/b
foo/bar/.baz/c
foo/bar/.baz/d
foo/bar/.baz/e
foo/bar/.baz/hooks/bar …Run Code Online (Sandbox Code Playgroud) 我试过了两个s3cmd:
$ s3cmd -r -f -v del s3://my-versioned-bucket/
Run Code Online (Sandbox Code Playgroud)
和AWS CLI:
$ aws s3 rm s3://my-versioned-bucket/ --recursive
Run Code Online (Sandbox Code Playgroud)
但是这两个命令都只是DELETE向S3 添加标记.删除存储桶的命令也不起作用(来自AWS CLI):
$ aws s3 rb s3://my-versioned-bucket/ --force
Cleaning up. Please wait...
Completed 1 part(s) with ... file(s) remaining
remove_bucket failed: s3://my-versioned-bucket/ A client error (BucketNotEmpty) occurred when calling the DeleteBucket operation: The bucket you tried to delete is not empty. You must delete all versions in the bucket.
Run Code Online (Sandbox Code Playgroud)
好吧怎么办?他们的文档中没有关于此的信息.S3Cmd说它是一个"全功能"的S3命令行工具,但它没有引用除自己以外的版本.有没有办法在不使用网络界面的情况下做到这一点,这将永远需要我保持我的笔记本电脑?
command-line-interface amazon-s3 amazon-web-services s3cmd aws-cli
aws-cli ×10
amazon-s3 ×6
amazon-ec2 ×1
amazon-iam ×1
credentials ×1
linux ×1
ls ×1
macos ×1
pip ×1
python ×1
s3cmd ×1
terminal ×1