Game cannot connect to Photon Server hosted on Amazon EC2

I have a Unity project that was connecting perfectly fine via UDP when I connect to the Photon Cloud.

Since I want to host the game myself, I have created an Amazon EC2 instance, and followed all the instructions on setting up Photon Control on my server. I am using the latest version of Photon Server 4.

In Photon Control, I have set the IP address to public IP, and the IP is, and started the LoadBalancing (MyCloud) application.

In my Unity game configuration, I have set the option to 'Self Hosted', and set the IP as above, and for the port I have tried both 5055, and 5056.

But when I connect from my game, it just stays on 'Connecting...' and nothing happens. Eventually I get the following error... Failed to set ServerAddress. Can be set only when using HTTP.

The Photon Socket Server is in the list of Inbound rules (I assume this is all I need to setup, as according to the docs Photon Control sets up the firewall for me).

Is there something I am missing here?


Best Answer

  • Meltdown
    Answer ✓
    EDIT : Never mind, I got this working. Being an Amazon AWS Noob I realised I had to go into my AWS Console and edit my EC2 instance Security Groups configuration and add the TCP and UDP ports.