Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Levon's avatar
Level 1

Forge AWS EC2 Elastic IP ssh connection

Hi. After setup an ec2 instance I connected it to forge and connection succeeded. I created an elastic ip for my instance to make already purchased domain work with that instance by static ip address. After I updated Forge server meta ip address (the old dynamic) to the elastic one. Tried to connect to the instance and connection status was 'Failed'. One thing I noticed that by EC2 documentation after creating elastic ip and attaching it to an instance the old dinamic ip should be released which wasn't. I could access that dynamic ip address and see the sample testing page there. Also could access by the newly created Elastic IP address. I thought that they are the same. Manually ssh-ed to [email protected] and changed index.php, then visited the by the elastic one it wasn't changed. Is forge handling the dynamic ip address on creation/connection time (the first time when connecting to the instance) and remembering it, because when I changed the ip address from forge->server->metas to the previous dynamic then it connected again.? Should I leave the dynamic address and not change it (but I think it is wrong) ? Help me to sort it out, please !

0 likes
9 replies
Cronix's avatar

Try generating a new key in Forge once you change to elastic ip

Levon's avatar
Level 1

Thanks, but no results. I see Installing SSH in Recent Events section 3 times and when I click to see what happened it says 'Permission denied (publickey).' It just looses the connection when Elastic IP is connected and then changed from forge metas.

Cronix's avatar

I'm not sure what the issue is. I'm using forge with aws/elastic ip.

Levon's avatar
Level 1

Hmm. how did you connect it to aws @Cronix, as CUSTOM VPS (ip...) or AMAZON(key, secret) service provider, and what is the difference, may be security or smth else ?

Cronix's avatar

I'm just using the forge user, and ssh'ing in using the elastic ip along with the ssh key. I use the same user and key to ssh tunnel into the database.

The only time I used a Amazon Key/Secret was when creating the server through forge since it needs those to make the server on amazon.

Levon's avatar
Level 1

Thanks guys for response, Tested many times and found this solution. I connected forge to a newly created instance in aws (I did many times before with no result) but this time with Custom VPS (not Amazon Key/Secret) giving the elastic ip that I attached to the instance before. This time connection is successful. Still have no idea what is/was the reason.

ThinkingMan's avatar

@CRONIX - So it's rather easy to get an Elastic IP in place and use with Forge? I have an AWS instance running and a site deployed now. What will I need to do to make sure nothing breaks once I assign the Elastic IP in the AWS console?

Cronix's avatar

Just go into "Server Details" in Forge for that server, and update the IP with the new elastic IP in the "Meta" section. Leave the "Private IP" the same.

Please or to participate in this conversation.