AWS CloudWatch: EndpointConnectionError: Could not connect to the endpoint URL

gigawatts picture gigawatts · May 28, 2016 · Viewed 8k times · Source

I just followed these instructions (Link) to get AWS CloudWatch installed on my EC2 instance.

  1. I updated my repositories: sudo yum update -y
  2. I installed the awslogs package: sudo yum install -y awslogs
  3. I edited the /etc/awslogs/awscli.conf, confirming that my AZ is us-west-2b on the EC2 page
  4. I left the default condiguration of the /etc/awslogs/awslogs.conf file as is, confirming that the default path indeed has logs being written to it
  5. I checked the /var/log/awslogs.log file and it is repeatedly showing the error: EndpointConnectionError: Could not connect to the endpoint URL: "https://logs.us-west-2b.amazonaws.com/"

    • I do not see any newly created log group and log stream in the CloudWatch console as expected. What am I missing here?

Should I be pointing at some other endpoint other than https://logs.us-west-2b.amazonaws.com/ ? If so, where is that configured?

Thanks in advance,

Graham

Answer

Shibashis picture Shibashis · May 28, 2016

The awscli.conf expects the region and not the AZ.

Specify the region as us-west-2.

Here is the documentation from the reference page

Edit the /etc/awslogs/awscli.conf file and in the [default] section, specify the region where you want to view log data and add your credentials.

region = us-east-1
aws_access_key_id = <YOUR ACCESS KEY>
aws_secret_access_key = <YOUR SECRET KEY>

The error EndpointConnectionError: Could not connect to the endpoint URL: "https://logs.us-west-2b.amazonaws.com/" could be attributed to wrong specification of region.

The correct endpoint for the cloudwatch logs service in US-WEST-2 is logs.us-west-2.amazonaws.com.

Please refer to the following documentation for aws service endpoints http://docs.aws.amazon.com/general/latest/gr/rande.html#cwl_region