Skip to content

WI: How to connect to a mac in EC2

Onitsiky edited this page Jan 24, 2023 · 8 revisions

To connect to the virtual machine on EC2, please follow this steps:


1. REQUIREMENTS ✨

  • You must have the access to the AWS Console of Bpartners

2. STEPS ✨

Start the Mac instance and get connection instruction

  • Connect to the AWS Console
  • Change the region to eu-west-1
  • Navigate through EC2
  • Click on instance
  • Select the instance
  • Click on instance state
  • Start instance
  • Go back to the instance and click on it
  • Click on connect
  • Click on ssh client and copy the ssh link

If you still haven't downloaded the keypair yet do the following, otherwise skip these 3 steps

  • Navigate through the S3 and download the keypair stored in infra-bpartners bucket
  • Put the keypair in your working directory, make sure you are inside the directory before running the command below
  • run this command to change the permission of the keypair file:
   chmod 400 'keypair_file.pem'

Connect to the Mac instance

  • Create ssh tunnel to the VNC port using the url you copied before:

Add this option to the link

   -L 5900:localhost:5900 

The link should look like this

ssh -i "eu-west-1-ec2-mac1-keypair.pem" -L 5900:localhost:5900 ec2-user@ec2-3-248-183-27.eu-west-1.compute.amazonaws.com
  • Use VNC Client to connect to localhost

    • If you are a linux user, you can download remmina
    • If you are a window user, you can use RealVNC
    • If you are mac user, macOS has a built-in VNC client.
  • When you get inside the client, click on new connection profile then choose VNC as protocol

  • The GUI launches. Connect to the remote session of the Mac instance using:

      * the password stored in ssm parameter: '/bpartners/macVirtual/password'
      * the username stored in ssm parameter: '/bpartners/macVirtual/username'
    

Note: If Ireland is saturated, connect to Virginia, the steps remain the same. Just change the region to us-east-1

DON'T FORGET TO STOP THE INSTANCE AFTER USE