Skip to content

⚡ Connect your virtual machine to the Internet via the web

Summary
This tutorial shows you how to create a security group, manage its rules, and assign them and a public IP address to a virtual machine.
Internet
https://pouta.csc.fi
flowchart LR
    A(Log in to<br>my.csc.fi) --> B(Select Network and 'Security Groups')
    B --> C(Create and name a security group)
    C --> D(Manage rules)
    D --> E{Create<br>another}
    E -->|Yes| C
    E -->|No| F(Allocate public IP address)
    F --> G(Associate the IP)
    G --> H(Apply SSH Security rule)

Prerequisites

  1. An existing virtual machine in the cPouta. Create a virtual machine in cPouta over the web

🟩 Procedure

The procedure is divided into three steps:
1. Create a security group
2. Allocate a public IP
3. Apply the security group and the IP to the virtual machine.

Let's start by creating a security group.

Create Security Group

Sign in to cPouta. Select 'Security Groups' 1⃣ from the Network menu on the left.

Click the ' Create Security Group' 2⃣ button.

Select Security Groups

Enter a name for your security group 3⃣ and click the 'Create Security Group' 4⃣ button.

Name the Security Group

If you want to try it yourself:

🌵 Create another security group and name it to HTTP.

Click the 'Manage Rules' 5⃣ button at the far right of the security group row.

Manage the Security Group

By default, all security groups contain an egress rule 6⃣ that allows traffic from the virtual machine to the Internet.

Add a new rule 7⃣ to allow inbound (ingress) traffic.

Add a rule to the Security Group

Select SSH rule 8⃣. Define remote as CIDR 9⃣ and allow traffic from anywhere (0.0.0.0/0).

Accept the rule by clicking the Add 1⃣0⃣ button.

Define the rule

Note the newly created rule 1⃣1⃣.

You can return to the list of security groups by clicking 'Security Groups' 1⃣2⃣ in the Network menu on the left.

View the freshly created rule

If you like, you can try it out for yourself:

🌵 Create a rule in the HTTP security group to allow traffic to port 80 from the Internet.

Then we'll move on to a public IP address.

Reserve floating IP

Select 'Floating IPs' 1⃣ from the Network menu on the left.

Click on ' Allocate IP To Project' 2⃣.

Floating IPs

Enter the purpose of the public IP in the description field, if you wish, and click on 'Allocate IP' 3⃣.

Allocate IP

Check the IP address 4⃣ allocated to you.

Info

This is a unique, public IPv4 address that can be used to connect the virtual machine from anywhere, if security rules allow.

View allocated IPs

Tip

It is possible to associate the public IP with a virtual machine from this view, but in this tutorial we will show another way.

Apply configurations

Next, let's assign the SSH security rule and the IP address to the virtual machine.

Return to the Compute -> Instances view. Select 'Associate Floating IP' 1⃣ from the drop down menu.

Associate Floating IP

Check that the public IP address is selectable 2⃣ and that it is associated with the virtual machine's private IP address 3⃣.

Click on 'Associate' 4⃣.

Bind the address to a virtual machine

The instance view should be updated with the associated public IP address 5⃣.

Next, select 'Edit Security Groups' 6⃣ from the drop down menu.

View the IP and edit security groups

On the left you can see the available security groups and on the right the ones in effect.

Click on the next to SSH security group 7⃣ to add the SSH rule to your virtual machine.

Save the changes using the Save 8⃣ button.

Tip

You can remove a security rule (deny access) by clicking sign next to the group name in the 'Instance Security Groups' list.

Add SSH security group to the virtual machine

That's it!

Your virtual machine is now accessible from the Internet.

List of running instances and associated IP addresses

And again, if you like:

🌵 Make your virtual machine available for HTTP requests.

Further Learning

Here are some suggestions for what to read next: