Eu posso usar com sucesso o awscli ao especificar as variáveis de ambiente: AWS_ACCESS_KEY_ID
e AWS_SECRET_ACCESS_KEY
, porém em instalações anteriores do awscli:
~/.aws/config
- que não está funcionando atualmente para mimAlém disso, especificar o AWS_CONFIG_FILE
também não funciona
Foi capaz de reproduzir em uma instância AWS EC2 e localmente na caixa Vagrant
~$ aws --version
aws-cli/1.4.4 Python/2.7.6 Linux/3.13.0-29-generic
~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04 LTS
Release: 14.04
Codename: trusty
Exemplos de falha:
aws s3 cp test.txt s3://my-bucket/
# => upload failed: ./test.txt to s3://my-bucket/test.txt Unable to locate credentials
AWS_CONFIG_FILE=/home/ubuntu/.aws/config aws s3 cp test.txt s3://my-bucket/
# => upload failed: ./test.txt to s3://my-bucket/test.txt Unable to locate credentials
Exemplos de sucesso:
AWS_ACCESS_KEY_ID=xxxx AWS_SECRET_ACCESS_KEY=xxxx aws s3 cp test.txt s3://my-bucket/
# ^ this works
Sinalizador de depuração em:
aws --debug s3 cp test.txt s3://my-bucket/
2014-09-19 18:29:08,076 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/1.4.4 Python/2.7.6 Linux/3.13.0-29-generic, botocore version: 0.63.0
2014-09-19 18:29:08,076 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.s3.anonymous: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,078 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.cp.paths: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,078 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.cp.cache-control: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,078 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.cp.dryrun: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,079 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.cp.website-redirect: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,079 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.cp.grants: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,079 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.cp.expires: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,079 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.cp.quiet: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,079 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.cp.anonymous: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,079 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.cp.acl: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,079 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.cp.source-region: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,079 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.cp.anonymous: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,080 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.cp.content-type: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,080 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.cp.content-encoding: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,080 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.cp.anonymous: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,080 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.cp.storage-class: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,080 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.cp.sse: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,080 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.cp.content-language: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,080 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.cp.content-disposition: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,080 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.cp.follow-symlinks: calling handler <function uri_param at 0x7f12296d7aa0>
2014-09-19 18:29:08,080 - MainThread - botocore.service - DEBUG - Creating service object for: s3
2014-09-19 18:29:08,105 - MainThread - botocore.hooks - DEBUG - Event service-data-loaded.s3: calling handler <function signature_overrides at 0x7f1229924de8>
2014-09-19 18:29:08,105 - MainThread - botocore.hooks - DEBUG - Event service-created: calling handler <function register_retries_for_service at 0x7f1229924c08>
2014-09-19 18:29:08,106 - MainThread - botocore.handlers - DEBUG - Registering retry handlers for service: Service(s3)
2014-09-19 18:29:08,107 - MainThread - botocore.hooks - DEBUG - Event creating-endpoint.s3: calling handler <function maybe_switch_to_s3sigv4 at 0x7f1229924cf8>
2014-09-19 18:29:08,107 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: env
2014-09-19 18:29:08,107 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: shared-credentials-file
2014-09-19 18:29:08,107 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: config-file
2014-09-19 18:29:08,107 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: ec2-credentials-file
2014-09-19 18:29:08,108 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: boto-config
2014-09-19 18:29:08,108 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: iam-role
2014-09-19 18:29:08,114 - MainThread - botocore.vendored.requests.packages.urllib3.connectionpool - INFO - Starting new HTTP connection (1): 169.254.169.254
2014-09-19 18:29:08,115 - MainThread - botocore.vendored.requests.packages.urllib3.connectionpool - DEBUG - "GET /latest/meta-data/iam/security-credentials/ HTTP/1.1" 404 345
2014-09-19 18:29:08,115 - MainThread - botocore.utils - DEBUG - Max number of attempts exceeded (1) when attempting to retrieve data from metadata service.
2014-09-19 18:29:08,115 - MainThread - botocore.service - DEBUG - Creating service object for: s3
2014-09-19 18:29:08,115 - MainThread - botocore.hooks - DEBUG - Event service-data-loaded.s3: calling handler <function signature_overrides at 0x7f1229924de8>
2014-09-19 18:29:08,116 - MainThread - botocore.hooks - DEBUG - Event service-created: calling handler <function register_retries_for_service at 0x7f1229924c08>
2014-09-19 18:29:08,116 - MainThread - botocore.handlers - DEBUG - Registering retry handlers for service: Service(s3)
2014-09-19 18:29:08,116 - MainThread - botocore.hooks - DEBUG - Event creating-endpoint.s3: calling handler <function maybe_switch_to_s3sigv4 at 0x7f1229924cf8>
2014-09-19 18:29:08,116 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: env
2014-09-19 18:29:08,116 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: shared-credentials-file
2014-09-19 18:29:08,116 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: config-file
2014-09-19 18:29:08,117 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: ec2-credentials-file
2014-09-19 18:29:08,117 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: boto-config
2014-09-19 18:29:08,117 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: iam-role
2014-09-19 18:29:08,118 - MainThread - botocore.vendored.requests.packages.urllib3.connectionpool - INFO - Starting new HTTP connection (1): 169.254.169.254
2014-09-19 18:29:08,118 - MainThread - botocore.vendored.requests.packages.urllib3.connectionpool - DEBUG - "GET /latest/meta-data/iam/security-credentials/ HTTP/1.1" 404 345
2014-09-19 18:29:08,119 - MainThread - botocore.utils - DEBUG - Max number of attempts exceeded (1) when attempting to retrieve data from metadata service.
2014-09-19 18:29:08,122 - MainThread - botocore.service - DEBUG - Creating service object for: s3
2014-09-19 18:29:08,122 - MainThread - botocore.hooks - DEBUG - Event service-data-loaded.s3: calling handler <function signature_overrides at 0x7f1229924de8>
2014-09-19 18:29:08,122 - MainThread - botocore.hooks - DEBUG - Event service-created: calling handler <function register_retries_for_service at 0x7f1229924c08>
2014-09-19 18:29:08,123 - MainThread - botocore.handlers - DEBUG - Registering retry handlers for service: Service(s3)
2014-09-19 18:29:08,123 - MainThread - awscli.customizations.s3.executor - DEBUG - Submitting task: <awscli.customizations.s3.tasks.BasicTask object at 0x7f122808a210>
2014-09-19 18:29:08,123 - MainThread - awscli.customizations.s3.executor - DEBUG - Queueing end sentinel for worker thread (priority: 11)
2014-09-19 18:29:08,123 - Thread-3 - awscli.customizations.s3.executor - DEBUG - Worker thread invoking task: <awscli.customizations.s3.tasks.BasicTask object at 0x7f122808a210>
2014-09-19 18:29:08,123 - MainThread - awscli.customizations.s3.executor - DEBUG - Queueing end sentinel for worker thread (priority: 11)
2014-09-19 18:29:08,123 - Thread-4 - awscli.customizations.s3.executor - DEBUG - Shutdown request received in worker thread, shutting down worker thread.
2014-09-19 18:29:08,124 - MainThread - awscli.customizations.s3.executor - DEBUG - Queueing end sentinel for worker thread (priority: 11)
2014-09-19 18:29:08,124 - Thread-5 - awscli.customizations.s3.executor - DEBUG - Shutdown request received in worker thread, shutting down worker thread.
2014-09-19 18:29:08,126 - MainThread - awscli.customizations.s3.executor - DEBUG - Queueing end sentinel for worker thread (priority: 11)
2014-09-19 18:29:08,126 - Thread-6 - awscli.customizations.s3.executor - DEBUG - Shutdown request received in worker thread, shutting down worker thread.
2014-09-19 18:29:08,126 - MainThread - awscli.customizations.s3.executor - DEBUG - Queueing end sentinel for worker thread (priority: 11)
2014-09-19 18:29:08,126 - Thread-7 - awscli.customizations.s3.executor - DEBUG - Shutdown request received in worker thread, shutting down worker thread.
2014-09-19 18:29:08,129 - Thread-3 - botocore.service - DEBUG - Creating operation objects for: Service(s3)
2014-09-19 18:29:08,127 - MainThread - awscli.customizations.s3.executor - DEBUG - Queueing end sentinel for worker thread (priority: 11)
2014-09-19 18:29:08,134 - Thread-3 - botocore.operation - DEBUG - Operation:PutObject called with kwargs: {'body': <open file u'/home/ubuntu/test.txt', mode 'rb' at 0x7f12290d5270>, 'bucket': u'my-bucket', 'key': u'test.txt', 'content_type': 'text/plain'}
2014-09-19 18:29:08,127 - Thread-8 - awscli.customizations.s3.executor - DEBUG - Shutdown request received in worker thread, shutting down worker thread.
2014-09-19 18:29:08,135 - Thread-3 - botocore.operation - DEBUG - Creating parameter objects for: Operation:PutObject
2014-09-19 18:29:08,138 - Thread-3 - botocore.hooks - DEBUG - Event before-call.s3.PutObject: calling handler <function sse_md5 at 0x7f1229924a28>
2014-09-19 18:29:08,138 - Thread-3 - botocore.hooks - DEBUG - Event before-call.s3.PutObject: calling handler <function add_expect_header at 0x7f1229924e60>
2014-09-19 18:29:08,138 - Thread-3 - botocore.handlers - DEBUG - Adding expect 100 continue header to request.
2014-09-19 18:29:08,138 - Thread-3 - botocore.endpoint - DEBUG - Making request for Operation:PutObject (verify_ssl=True) with params: {'headers': {u'Content-Type': 'text/plain', 'Expect': '100-continue'}, 'uri_params': {u'Bucket': u'my-bucket', u'Key': u'test.txt'}, 'payload': <botocore.payload.Payload object at 0x7f12280ad0d0>}
2014-09-19 18:29:08,139 - Thread-3 - botocore.endpoint - DEBUG - Building URI for rest endpoint.
2014-09-19 18:29:08,139 - Thread-3 - botocore.endpoint - DEBUG - Templated URI path: /{Bucket}/{Key}
2014-09-19 18:29:08,139 - Thread-3 - botocore.endpoint - DEBUG - Templated URI query_params:
2014-09-19 18:29:08,135 - MainThread - awscli.customizations.s3.executor - DEBUG - Queueing end sentinel for worker thread (priority: 11)
2014-09-19 18:29:08,139 - Thread-3 - botocore.endpoint - DEBUG - Rendered path: /my-bucket/test.txt
2014-09-19 18:29:08,139 - Thread-3 - botocore.endpoint - DEBUG - Rendered query_params:
2014-09-19 18:29:08,140 - Thread-3 - botocore.hooks - DEBUG - Event before-auth.s3: calling handler <function fix_s3_host at 0x7f1229924b18>
2014-09-19 18:29:08,140 - Thread-3 - botocore.handlers - DEBUG - Checking for DNS compatible bucket for: https://s3.amazonaws.com/my-bucket/test.txt
2014-09-19 18:29:08,140 - Thread-3 - botocore.handlers - DEBUG - URI updated to: https://my-bucket.s3.amazonaws.com/test.txt
2014-09-19 18:29:08,135 - Thread-9 - awscli.customizations.s3.executor - DEBUG - Shutdown request received in worker thread, shutting down worker thread.
2014-09-19 18:29:08,140 - Thread-3 - awscli.customizations.s3.tasks - DEBUG - Unable to locate credentials
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/awscli/customizations/s3/tasks.py", line 89, in _execute_task
getattr(filename, filename.operation_name)()
File "/usr/local/lib/python2.7/dist-packages/awscli/customizations/s3/fileinfo.py", line 221, in upload
response_data, http = operate(self.service, 'PutObject', params)
File "/usr/local/lib/python2.7/dist-packages/awscli/customizations/s3/utils.py", line 193, in operate
http_response, response_data = operation.call(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/botocore/operation.py", line 68, in call
response = endpoint.make_request(self, params)
File "/usr/local/lib/python2.7/dist-packages/botocore/endpoint.py", line 68, in make_request
prepared_request = self.create_request(operation, params)
File "/usr/local/lib/python2.7/dist-packages/botocore/endpoint.py", line 92, in create_request
prepared_request = self.prepare_request(request, signer)
File "/usr/local/lib/python2.7/dist-packages/botocore/endpoint.py", line 108, in prepare_request
signer.add_auth(request=request)
File "/usr/local/lib/python2.7/dist-packages/botocore/auth.py", line 545, in add_auth
raise NoCredentialsError
NoCredentialsError: Unable to locate credentials
2014-09-19 18:29:08,140 - MainThread - awscli.customizations.s3.executor - DEBUG - Queueing end sentinel for worker thread (priority: 11)
2014-09-19 18:29:08,140 - Thread-10 - awscli.customizations.s3.executor - DEBUG - Shutdown request received in worker thread, shutting down worker thread.
2014-09-19 18:29:08,141 - Thread-1 - awscli.customizations.s3.executor - DEBUG - Received print task: PrintTask(message=u'upload failed: ./test.txt to s3://my-bucket/test.txt Unable to locate credentials', error=True, total_parts=None, warning=None)
upload failed: ./test.txt to s3://my-bucket/test.txt Unable to locate credentials
2014-09-19 18:29:08,142 - Thread-11 - awscli.customizations.s3.executor - DEBUG - Shutdown request received in worker thread, shutting down worker thread.
2014-09-19 18:29:08,142 - MainThread - awscli.customizations.s3.executor - DEBUG - Queueing end sentinel for worker thread (priority: 11)
2014-09-19 18:29:08,142 - MainThread - awscli.customizations.s3.executor - DEBUG - Queueing end sentinel for worker thread (priority: 11)
2014-09-19 18:29:08,143 - Thread-12 - awscli.customizations.s3.executor - DEBUG - Shutdown request received in worker thread, shutting down worker thread.
2014-09-19 18:29:08,143 - MainThread - awscli.customizations.s3.executor - DEBUG - Waiting for thread to shutdown: <Worker(Thread-3, started daemon 139715890116352)>
2014-09-19 18:29:08,143 - Thread-3 - awscli.customizations.s3.executor - DEBUG - Shutdown request received in worker thread, shutting down worker thread.
2014-09-19 18:29:08,144 - MainThread - awscli.customizations.s3.executor - DEBUG - Thread has been shutdown: <Worker(Thread-3, stopped daemon 139715890116352)>
2014-09-19 18:29:08,144 - MainThread - awscli.customizations.s3.executor - DEBUG - Waiting for thread to shutdown: <Worker(Thread-4, stopped daemon 139715881723648)>
2014-09-19 18:29:08,144 - MainThread - awscli.customizations.s3.executor - DEBUG - Thread has been shutdown: <Worker(Thread-4, stopped daemon 139715881723648)>
2014-09-19 18:29:08,144 - MainThread - awscli.customizations.s3.executor - DEBUG - Waiting for thread to shutdown: <Worker(Thread-5, stopped daemon 139715873330944)>
2014-09-19 18:29:08,145 - MainThread - awscli.customizations.s3.executor - DEBUG - Thread has been shutdown: <Worker(Thread-5, stopped daemon 139715873330944)>
2014-09-19 18:29:08,145 - MainThread - awscli.customizations.s3.executor - DEBUG - Waiting for thread to shutdown: <Worker(Thread-6, stopped daemon 139715864938240)>
2014-09-19 18:29:08,145 - MainThread - awscli.customizations.s3.executor - DEBUG - Thread has been shutdown: <Worker(Thread-6, stopped daemon 139715864938240)>
2014-09-19 18:29:08,145 - MainThread - awscli.customizations.s3.executor - DEBUG - Waiting for thread to shutdown: <Worker(Thread-7, stopped daemon 139715856545536)>
2014-09-19 18:29:08,145 - MainThread - awscli.customizations.s3.executor - DEBUG - Thread has been shutdown: <Worker(Thread-7, stopped daemon 139715856545536)>
2014-09-19 18:29:08,145 - MainThread - awscli.customizations.s3.executor - DEBUG - Waiting for thread to shutdown: <Worker(Thread-8, stopped daemon 139715848152832)>
2014-09-19 18:29:08,145 - MainThread - awscli.customizations.s3.executor - DEBUG - Thread has been shutdown: <Worker(Thread-8, stopped daemon 139715848152832)>
2014-09-19 18:29:08,145 - MainThread - awscli.customizations.s3.executor - DEBUG - Waiting for thread to shutdown: <Worker(Thread-9, stopped daemon 139715839760128)>
2014-09-19 18:29:08,145 - MainThread - awscli.customizations.s3.executor - DEBUG - Thread has been shutdown: <Worker(Thread-9, stopped daemon 139715839760128)>
2014-09-19 18:29:08,145 - MainThread - awscli.customizations.s3.executor - DEBUG - Waiting for thread to shutdown: <Worker(Thread-10, stopped daemon 139715286136576)>
2014-09-19 18:29:08,145 - MainThread - awscli.customizations.s3.executor - DEBUG - Thread has been shutdown: <Worker(Thread-10, stopped daemon 139715286136576)>
2014-09-19 18:29:08,146 - MainThread - awscli.customizations.s3.executor - DEBUG - Waiting for thread to shutdown: <Worker(Thread-11, stopped daemon 139715277743872)>
2014-09-19 18:29:08,146 - MainThread - awscli.customizations.s3.executor - DEBUG - Thread has been shutdown: <Worker(Thread-11, stopped daemon 139715277743872)>
2014-09-19 18:29:08,146 - MainThread - awscli.customizations.s3.executor - DEBUG - Waiting for thread to shutdown: <Worker(Thread-12, stopped daemon 139715269351168)>
2014-09-19 18:29:08,146 - MainThread - awscli.customizations.s3.executor - DEBUG - Thread has been shutdown: <Worker(Thread-12, stopped daemon 139715269351168)>
2014-09-19 18:29:08,146 - MainThread - awscli.customizations.s3.executor - DEBUG - Queueing end sentinel for result thread.
2014-09-19 18:29:08,146 - MainThread - awscli.customizations.s3.executor - DEBUG - Queueing end sentinel for IO thread.
2014-09-19 18:29:08,146 - Thread-1 - awscli.customizations.s3.executor - DEBUG - Shutdown request received in print thread, shutting down print thread.
2014-09-19 18:29:08,146 - Thread-2 - awscli.customizations.s3.executor - DEBUG - Shutdown request received in IO thread, shutting down.
2014-09-19 18:29:08,146 - MainThread - awscli.customizations.s3.executor - DEBUG - Waiting for result thread to shutdown.
2014-09-19 18:29:08,147 - MainThread - awscli.customizations.s3.executor - DEBUG - Waiting for IO thread to shutdown.
2014-09-19 18:29:08,147 - MainThread - awscli.customizations.s3.executor - DEBUG - All threads have been shutdown.
Alguma ideia?
Eu preferiria usar AWS_CONFIG_FILE
em vez de KEY e SECRET
Obrigado, - Jesse
Aqui está o que eu tentaria:
# 1. Run "aws configure" and enter your credentials.
# This will ensure the values are written to the correct file location.
$ aws configure
AWS Access Key ID [****************ABCD]: foo
AWS Secret Access Key [****************ABCD]: bar
Default region name [us-west-2]: us-west-2
Default output format [None]:
# 2. Then verify the configuration values, and make sure
# they are shown in the config file.
$ aws configure list
Name Value Type Location
---- ----- ---- --------
profile <not set> None None
access_key ****************ABCD config-file
secret_key ****************ABCD config-file
region us-west-2 config-file ~/.aws/config
@jamesls - Obrigado, isso ajudou a expor meu problema
aws_acces_key_id
vs aws_access_key_id
- doh!Tentei executar o aws configure. Deu todos os detalhes mas ainda não funciona para mw. Eu estou em um mac.
lista de configuração aws
Nome Valor Tipo Local
---- ----- ---- --------
perfil
chave de acesso
chave secreta
região
@pranshu1992 , este tópico é antigo, mas acabei de acontecer a mesma coisa comigo. Executei o aws configure para um perfil específico e, quando executei o aws configure list, minha lista de configuração estava vazia (mesmo que meus arquivos .aws/configure e connection tivessem valores neles). Para que funcione, configurei o parâmetro AWS_DEFAULT_PROFILE na linha de comando para o mesmo perfil que configurei e consegui ver minhas informações de configuração.
Eu tive o mesmo problema com aws configure list
não imprimir os valores configurados. Consegui trabalhar adicionando --profile xxx
com o xxx sendo o nome do perfil configurado em ~/.aws/credentials
. Editando o arquivo de credencial para ter o nome do perfil [ default
] fez aws configure list
imprimir os valores configurados conforme o esperado.
Eu tive o mesmo problema no OS X usando 'aws s3 sync ...'.
Estou usando esses arquivos para manter as credenciais e a configuração da AWS:
Eu não tenho nenhum conjunto de vars de ambiente da AWS.
Se eu confiar em um perfil padrão, ele não encontrará as credenciais. Este é o caso se eu deixar a opção de perfil na linha de comando ou se eu usar --profile default
No entanto, se eu der ao perfil um nome diferente de _default_ (nas credenciais e arquivos de configuração) e adicionar a opção de linha de comando '--profile profile-name', tudo funcionará bem. Estou usando isso como minha solução alternativa.
Parece que há um problema ao lidar com o perfil padrão no arquivo de credenciais.
EDIT: Parece que este problema tem uma solução adequada agora, então não há necessidade de executar este comando com sudo
. O restante deste comentário agora é inválido, mas estou deixando-o aqui para adicionar algum contexto histórico a este tópico.
Eu tive um problema semelhante para a maioria de vocês. Acontece que eu só precisava colocar um sudo
no início do comando aws configure
:
sudo aws configure
Então meu script tem os privilégios corretos para ler o arquivo de configuração.
É possível não executar com sudo?
@rochapablo Sim, mesmo com sudo os arquivos de configuração não estavam salvando para mim.
Aqui está a solução: basta alterar a propriedade para sua conta de usuário local no meu caso, é "jr", basta substituir "jr" pelo seu nome de usuário (e staff é o grupo padrão usado pelo OSX)
Exemplo:
sudo chown -R jr:staff ~/.aws
Obrigada. Não tenho certeza do que fiz, mas de alguma forma começou a funcionar sem a necessidade de sudo
.
Apenas adicionando à solução já disponível aqui: Criei um perfil padrão que resolveu o problema para mim:
Meu arquivo de configuração
[default]
output=json
region=xxxxxxx
e meu arquivo de credenciais tem isso
[default]
aws_access_key_id=XXXXXXXX
aws_secret_access_key=XXXXXX
@house9 - Obrigado por relatar este problema. Parece que a orientação fornecida por @jamesls e outros usuários do GitHub descartou um bug na CLI. Responda se houver outras dúvidas ou comentários sobre como podemos melhorar nossa documentação.
@justnance - Relatei esse problema em 19/09/2014, consegui determinar o erro do usuário da minha parte um dia depois: 20/09/2014, encerrei imediatamente esse problema naquele momento, outra pessoa o reabriu 2 anos depois 2016-09-30.
Está tudo bem no que me diz respeito.
@house9 - Obrigado pelo feedback. Fico feliz que tenha sido resolvido rapidamente, embora o problema tenha sido reaberto.
Apenas no caso de isso ajudar alguém eu queria adicionar o que estava errado com o meu ~/.aws/credentials
era que tinha esse formato por algum motivo. Com certeza não fui eu, mas ¯\_(ツ)_/¯
aws_access_key_id=XXXXXXXX[default]
aws_secret_access_key=XXXXXX
e alterando para o abaixo corrigiu
[default]
aws_access_key_id=XXXXXXXX
aws_secret_access_key=XXXXXX
@liamroth - Obrigado pela atualização. A alteração que você fez está correta e nossa documentação é mais detalhada e tem alguns exemplos.
Links Relacionados:
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html
Estava acontecendo porque você não configurou o usuário padrão
user<strong i="6">@ip</strong>:~/.aws$ cat credentials
[user1]
aws_access_key_id = ####
aws_secret_access_key = ****
[default]
aws_access_key_id = ####
aws_secret_access_key = ****
A resposta de @jamesls funcionou para mim
tente $ aws configure
se você estiver usando aws2, certifique-se de usar $ aws2 configure
Descobri que o aws cli estava falhando por não conseguir acessar o endereço de link local 169.254.169.254
usado para metadados ec2. Conforme documentado aqui , adicionar esse IP à variável de ambiente no_proxy
corrigiu o problema para mim:
$ export NO_PROXY=169.254.169.254
Comentários muito úteis
Aqui está o que eu tentaria: