[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed
The AWS CLI does not trust the TLS certificate it receives, often because a corporate proxy is inspecting traffic.
Why it happens
The AWS CLI does not trust your proxy's certificate, for example a self-signed certificate from your organisation's own certificate authority. AWS also lists using the wrong AWS Region as a cause.
Where you see it, and what it affects
The AWS CLI prints this when it opens a secure connection to an AWS endpoint, for example on aws s3 ls, and cannot find the certificate authority in its local registry. It is common behind proxies that inspect traffic. A related message, "SSL validation failed for <region> [Errno 2] No such file or directory", means the ca_bundle path is wrong.
How to fix it
- 1
Step 1
Get your organisation's certificate bundle as a
.pemfile from your network team. - 2
Step 2
Point the AWS CLI to it with the
ca_bundlesetting in the config file, the--ca-bundleoption, or theAWS_CA_BUNDLEenvironment variable. - 3
Step 3
Check the Region is correct in the
--regionoption, theAWS_DEFAULT_REGIONvariable or theregionprofile setting.
aws s3 ls --ca-bundle /path/to/ca-bundle.pemCheck that it is fixed
- Run
aws s3 lsagain (with yourca_bundlesetting in place) and confirm it returns results without an SSL error. - Run
aws configure listand confirm the region value is the Region your resources are in. - If you see "No such file or directory", confirm the
.pempath inca_bundleorAWS_CA_BUNDLEexists.