Aws-cli: Tidak dapat menemukan kredensial

Dibuat pada 19 Sep 2014  ·  18Komentar  ·  Sumber: aws/aws-cli

Saya berhasil menggunakan awscli saat menentukan variabel lingkungan: AWS_ACCESS_KEY_ID dan AWS_SECRET_ACCESS_KEY , namun dalam pemasangan awscli sebelumnya:

  • Konfigurasi akan secara otomatis membaca dari file konfigurasi di ~/.aws/config - yang saat ini tidak berfungsi untuk saya

Juga, menentukan AWS_CONFIG_FILE juga tidak berfungsi

Mampu mereproduksi pada instans AWS EC2 dan secara lokal di kotak 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

Contoh yang gagal:

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

Contoh yang berhasil:

AWS_ACCESS_KEY_ID=xxxx AWS_SECRET_ACCESS_KEY=xxxx aws s3 cp test.txt s3://my-bucket/ 
# ^ this works

Tandai debug pada:

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.

Ada ide?
Saya lebih suka menggunakan AWS_CONFIG_FILE daripada KEY dan SECRET

Terima kasih, - Jesse

guidance

Komentar yang paling membantu

Inilah yang akan saya coba:

# 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

Semua 18 komentar

Inilah yang akan saya coba:

# 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 - Terima kasih, itu membantu mengungkap masalah saya

  • Saya menginstal awscli menggunakan chef dan konfigurasi chef saya salah ketik aws_acces_key_id vs aws_access_key_id - doh!

Mencoba menjalankan aws configure. Memberikan semua detail tetapi masih tidak berfungsi untuk mw. saya di mac.

daftar konfigurasi aws
Nama Nilai Jenis Lokasi
---- ----- ---- --------
ProfilTidak ada Tidak ada
kunci aksesTidak ada Tidak ada
kunci rahasiaTidak ada Tidak ada
wilayahTidak ada Tidak ada

@ pranshu1992 , utas ini sudah tua tetapi saya baru saja mengalami hal yang sama pada saya. Saya menjalankan aws configure untuk profil tertentu dan ketika saya menjalankan aws configure list, daftar konfigurasi saya kosong (meskipun .aws/ configure dan file koneksi saya memiliki nilai di dalamnya). Untuk membuatnya berfungsi, saya mengatur parameter AWS_DEFAULT_PROFILE pada baris perintah ke profil yang sama yang saya konfigurasikan dan saya dapat melihat informasi konfigurasi saya.

Saya memiliki masalah yang sama dengan aws configure list tidak mencetak nilai yang dikonfigurasi. Saya membuatnya berfungsi dengan menambahkan --profile xxx dengan xxx menjadi nama profil yang dikonfigurasi di ~/.aws/credentials . Mengedit file kredensial agar nama profil [ default ] membuat aws configure list mencetak nilai yang dikonfigurasi seperti yang diharapkan.

Saya memiliki masalah yang sama pada OS X menggunakan 'aws s3 sync ...'.

Saya menggunakan file-file ini untuk menyimpan kredensial dan konfigurasi AWS:

  • ~/.aws/credentials
  • ~/.aws/config

Saya tidak memiliki set vars lingkungan AWS.

Jika saya mengandalkan profil default, itu tidak akan menemukan kredensial. Ini adalah kasus jika saya mematikan sakelar profil pada baris perintah atau jika saya menggunakan --profile default

Namun, jika saya memberi profil nama selain _default_ (dalam kredensial & file konfigurasi) dan menambahkan sakelar baris perintah '--profile profile-name' semuanya berfungsi dengan baik. Saya menggunakan ini sebagai solusi saya.

Sepertinya ada masalah dengan penanganan profil default di file kredensial.

EDIT: Sepertinya masalah ini memiliki solusi yang tepat sekarang, jadi tidak perlu menjalankan perintah ini dengan sudo . Sisa dari komentar ini sekarang tidak valid, tetapi saya meninggalkannya di sini untuk menambahkan beberapa konteks historis ke utas ini.


Saya memiliki masalah yang sama dengan sebagian besar dari Anda. Ternyata saya hanya perlu memasukkan sudo di awal perintah aws configure :

sudo aws configure

Kemudian skrip saya memiliki hak istimewa yang benar untuk membaca dari file konfigurasi.

Apakah mungkin tidak dijalankan dengan Sudo?

@rochapablo Ya, bahkan dengan Sudo file konfigurasi tidak disimpan untuk saya.

Inilah solusinya: cukup ubah kepemilikan ke akun pengguna lokal Anda dalam kasus saya ini adalah "jr", cukup ganti "jr" dengan nama pengguna Anda (dan staf adalah grup default yang digunakan oleh OSX)

Contoh:

sudo chown -R jr:staff ~/.aws

Terima kasih. Saya tidak yakin apa yang saya lakukan, tetapi beberapa cara mulai bekerja tanpa perlu sudo .

Hanya menambahkan ke solusi yang sudah tersedia di sini: Saya telah membuat profil default yang memecahkan masalah bagi saya:

File konfigurasi saya

[default]
output=json
region=xxxxxxx

dan file kredensial saya memiliki ini

[default]
aws_access_key_id=XXXXXXXX
aws_secret_access_key=XXXXXX

@house9 - Terima kasih telah melaporkan masalah ini. Tampaknya panduan yang diberikan oleh @jamesls dan pengguna GitHub lainnya telah mengesampingkan bug di CLI. Harap balas jika ada pertanyaan atau umpan balik lain tentang bagaimana kami dapat meningkatkan dokumentasi kami.

@justnance - Saya melaporkan masalah ini pada 19-09-2014, saya dapat menentukan kesalahan pengguna di pihak saya sehari kemudian: 20-09-2014, saya segera menutup masalah ini pada waktu itu, orang lain membukanya kembali 2 tahun kemudian 30-09-2016.

Itu semua baik sejauh yang saya ketahui.

@house9 - Terima kasih atas umpan baliknya. Saya senang itu diselesaikan dengan cepat meskipun masalah dibuka kembali.

Untuk berjaga-jaga jika ini membantu seseorang yang ingin saya tambahkan apa yang salah dengan ~/.aws/credentials saya adalah yang memiliki format ini karena suatu alasan. Preeetty yakin itu bukan aku tapi \_(ツ)_/¯

aws_access_key_id=XXXXXXXX[default]
aws_secret_access_key=XXXXXX

dan mengubahnya ke bawah memperbaikinya

[default]
aws_access_key_id=XXXXXXXX
aws_secret_access_key=XXXXXX

@liamroth - Terima kasih atas pembaruannya. Perubahan yang Anda buat sudah benar dan dokumentasi kami menjelaskan lebih detail dan memiliki beberapa contoh.

Tautan yang berhubungan:
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html

Itu terjadi karena Anda tidak mengatur pengguna default

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 = ****

Jawaban @jamesls berhasil untuk saya

coba $ aws configure

jika Anda menggunakan aws2 maka pastikan Anda menggunakan $ aws2 configure

Saya menemukan bahwa aws cli gagal karena tidak dapat mencapai alamat link-local 169.254.169.254 yang digunakan untuk metadata EC2. Seperti yang didokumentasikan di sini , menambahkan IP itu ke variabel lingkungan no_proxy memperbaiki masalah bagi saya:

$ export NO_PROXY=169.254.169.254
Apakah halaman ini membantu?
0 / 5 - 0 peringkat