Troubleshooting URL Access Issue on Elastic Beanstalk in Beijing Region

Hello, I’m cross-posting this from the aws forums, let me know if this is not allowed.

I’m having trouble accessing the url after deploying a sample application on Elastic Beanstalk. I’m deploying on cn-north-1 (Beijing) and already have past experience with this. What I’ve already tried:

  1. Made sure the security group allows inbound connections from the 80 port.

  2. Made sure I can ssh into the EC2 instance, and performed ‘curl -v 127.0.0.1’, and it responded successfully with the sample application contents.

  3. Tried restarting and creating from scratch both the EC2 instance and the EBS app.

  4. Created everything from scratch, side by side with my us-east console version, applying the same configuration. I could connect to the us-east url.

  5. Tried all of the above while connected to a computer located in China.

Accessing the public ip of the console also doesn’t work. I’m not using load balancers or Route 53, I’m launching a single-instance.

Also, the health status is ok and logs don’t show any problems.

I appreciate any insight on this.

https://i.redd.it/gm4v72bnv2qc1.jpg

https://i.redd.it/6awfszanv2qc1.jpg

Have you configured the necessary managed policies in your Role/InstanceProfile for the instances that run your ElasticBeanstalk environment?

  • AWSElasticBeanstalkWebTier
  • AWSElasticBeanstalkWorkerTier
  • AWSElasticBeanstalkMulticontainerDocker

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts-roles-instance.html

Just so I understand this, your surfing at the ec2 public up at port 80/443 and can’t get to the running nginx service?

*also, exposing ssh port to anyone is a big no no.
Limit to your own ip or use ssm.

I’m trying to access the domain to use the application deployed with elastic beanstalk, but it times out, despite everything looking right. Also thanks for your advice on the ssh port

Haven’t tinkered with beanstalk in a while now but let’s try.

Timeout means you’re probably not reaching the environment, that’s why not logs are produced, since no traffic is reaching nginx.
I suggest you to inspect what dns resolution, and see if the ebs domain is pointing at the ec2 public ip correctly. If you do try and curl the ec2 public ip and get a response from nginx, that’s your problem then.

China region have some different behaviours and blockers, did you check about it?

Yes, I am actually using the Chinese version of aws (https://amazonaws.cn/) in order to mitigate those problems

What is the application stack being used? And what are is the error when you are trying to access the url?

Are you getting “Connection Timed Out”?

I’m trying to launch the sample python application, it runs on a nginx server. It seems to be running normally, since I can ssh into it, and curl to localhost. When I try to access the public ipv4 or the elasticbeanstalk url, it fails with “Connection Timed Out”

I doubled checked and both the service role and instance profile have the required policies. One strange thing, however, is that I can request logs on Elastic Beanstalk, but can’t view/download them unless I manually get them on the s3 bucket. Otherwise, I get a “You are not authorized to perform this operation” error.

Using curl on the public ip fails, it only works if I ssh into the environment and curl localhost.

I also double checked the VPC configuration (I’m using the default VPC). The Network ACL is connected to three subnets, each with inbound and outbound rules permitting all traffic. These subnets are linked to a route table that directs traffic to an internet gateway. I compared this setup with the functioning instance in the us-east region, and nothing seems out of normal.

Fails how? Timeout or refused?
I was just about to say the instance resides in a private subnet but looks like your covered that.
Set up a simple ec2 instance in the same box and subnet and see whether it can reach the instance/application.
There might be a policy blocking access to certain regions / countries. Are you in the US?

It fails with “Connection Timed Out”. I’m in Brazil, but I have access to a Chinese machine from where I tried both deploying and accessing the url. I’m actually trying to deploy the sample python application

Also, instead of launching the EC2 instance from Elastic Beanstalk, I tried using the EC2 wizard, and still I can’t curl the public IPv4 address

It may be possible either the app of nginx (maybe both) are not binding to all Ethernet interfaces, and only to the loop one (127.0.01).
Try adjusting them to use 0.0.0.0 (all interfaces) and see it anything’s different.
Btw is anything hitting nginx at all? Any log entries through all those tries?
Check the machine it it’s port are opened, and try establishing a connection on 0.0.0.0 using telnet and nc

Attention: by default port 80&443 are blocked in China. This is due to legal reasons. To make this possible you have to talk to AWS support they then open the ports.

I was very surprised that 8080 worked but http/s not.

And also don’t forget you need an icp license for a website hosted in China mainland.

Hrm I had in mind 8080 worked, maybe it was some other. Here the official doc from AWS

https://www.amazonaws.cn/en/support/icp/

Oh wow, thank you for this, I was about to lose my mind!

Thank you for your help, as pointed out by another user, some ports are not open by default in China, and you need a license to use them

Holy shit, good to know. Thanks!