Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Fish-Net server deployment process on AWS EC2

Discussion in 'Multiplayer' started by haseebzahid413, Feb 8, 2022.

  1. haseebzahid413

    haseebzahid413

    Joined:
    Feb 25, 2017
    Posts:
    1
    Verify we have necessary permissions for AWS account

    1. Go to AWS Management Console

    2. Launch a Virtual Machine

    3. Select any free-tier Linux machine

    4. Select any free-tier instance type

    5. Edit Security Groups

      1. Add Rule

      2. Custom TCP Rule - port 7770 (or whatever you want to choose for your game)

      3. set Source to anywhere

      4. Add Rule

      5. UDP rule - port 7770 (or whatever you want to choose for your game)

      6. set Source to anywhere

      7. Press “Review and Launch”
    6. Create a new Key Pair

      1. Give it a name

      2. download keypair

      3. Press “Launch Instance”
    7. Download Putty

    8. Download WinSCP

    9. Open PuttyGen

      1. Conversions > Import Key

      2. Select the downloaded key

      3. Set the right Key Type as you set while creating the key above

      4. Save Private Key

      5. Close Window

      6. This file of type ppk will be used later
    10. Open Putty

      1. Copy IPV4 DNS address for the instance we created above from AWS EC2 Instances window

      2. Putty Configuration > Session > Host Name set this hostname to follows

        1. ec2-user@ followed by the DNS address copied above
      3. Keep port at 22

      4. Connection Type SSH

      5. Go to Connection > SSH > Auth

        1. Provide the ppk generated above here in “Browse”
      6. Go back to Session

        1. Provide a name in Saved Sessions to be save this session

        2. Press Save
      7. Now double click this name in session to open this session

      8. Our Putty terminal is up and running on the Linux machine
    11. Open WinSCP

      1. When asked opt for single window with 2 panels option

      2. Login > New Site

        1. File Protocol > SCP

        2. Paste the same hostname pasted in Putty, or copied from AWS EC2 Instances Console

        3. Username > ec2-user

        4. Advanced > SSH > Authentication > Private Key File

          1. Provide the private key file here

          2. Press Okay
        5. Press Save

        6. Provide a name to this new Login
      3. Double click on the login created

      4. It will connect to our Linux Server

      5. We will use this Window to transfer replace or delete build on our Linux server
    12. Go back to Unity

      1. Set NetworkHudCanvases -> AutoStartType to Server

      2. Add TugBoat component on Network Manager

        1. Set server bind address to localhost

        2. Set port to 7770 (or whatever you want to specify but should be allowed in EC2 instance network incoming traffic conditions)

        3. Set client address to EC2 instance public IPV4 DNS address

        4. Save scene
      3. In Build Settings

        1. Set target platform to Linux

        2. Keep architecture to x86_64

        3. Enable ServerBuild (to keep headless)

        4. Make sure the server scene is added and enabled in build settings
      4. Build and save in a folder

      5. Wait for the build process to complete
    13. WinSCP

      1. Navigate left panel to the unity server build folder

      2. Right click and upload that to the linux server

      3. It will take some time to upload

      4. Once upload complete
    14. Putty terminal

      1. Go the the Putty terminal window

      2. Using standard commands navigate inside the build folder

      3. Run commands

        1. chmod +x “executable file name of type .x86_64”

        2. ./“executable file name of type .x86_64”

        3. Server is up and running
      4. Go back to Unity for Client editor testing or build
    15. Unity

      1. NetworkHudCanvases > AutoStartType set this to Disabled

      2. Save scene

      3. Run in unity

      4. Press Client

      5. Client should be up and connected with AWS Server
     
  2. Punfish

    Punfish

    Joined:
    Dec 7, 2014
    Posts:
    411
    Thank you!
     
  3. thedrhax14

    thedrhax14

    Joined:
    Aug 7, 2014
    Posts:
    38
    It worth noting at step 12.2.1 is not correct. If you write localhost explicitly, fishnet will throw a message saying it failed to parse the ip and force 127.0.0.1 which is unreachable. Better leave it empty so that the fishnet process gets local address at 0.0.0.0:7770 and receive any UDP traffic which arrives at 7770 port when the process is started as server. We were also able to confirm this behavior using nmap. However, it is maybe not safe and if you care about security than better to put server public ip address instead.
     
  4. johnny004

    johnny004

    Joined:
    Feb 21, 2024
    Posts:
    5
    You can also simply connect to AWS EC2 console by using PuTTY to see the whole process click here.