copyright | lastupdated | keywords | subcollection | content-type | services | account-plan | completion-time | ||
---|---|---|---|---|---|---|---|---|---|
|
2023-12-12 |
secure-infrastructure-vpc |
tutorial |
vpc, security-groups |
paid |
1h |
{{site.data.keyword.attribute-definition-list}}
{: #access-public-app} {: toc-content-type="tutorial"} {: toc-services="vpc, security-groups"} {: toc-completion-time="1h"}
In this tutorial, you use a public {{site.data.keyword.cloud_notm}} {{site.data.keyword.alb_full}} to allow access over the public internet to an app that runs on your VSI on VPC landing zone deployable architecture. {: shortdesc}
The load balancer can distribute traffic among multiple application server instances that are running in the VPC (in the workload VSIs). It forwards traffic only to instances that respond correctly to periodic health checks. For more information about load balancing, see the overview to Load balancers for VPC.
{: #prereqs-public-app}
- Deploy an instance of a VSI on VPC landing zone deployable architecture. For more information, see Deploying a landing zone deployable architecture.
- Create a web application on a workload VSI in your deployable architecture.
{: #alb-public-app} {: step}
Create a public {{site.data.keyword.alb_full}}.
-
In the {{site.data.keyword.cloud_notm}} console{: external}, click the Menu icon , and then click VPC Infrastructure > Load balancers.
-
On the Load balancers page, click Create.
-
Specify the settings for your load balancer:
-
Load balancer type: Application Load Balancer (ALB)
-
Location: Select the geography and region where you provisioned your VPC resources
-
Details:
- Name:
<your_prefix>-web-lb
, where<your_prefix>
is any string of lowercase alphanumeric characters and hyphens. - Resource group: Select or create a group. For example,
<your_prefix>-workload-rg
. - Virtual private cloud: Select your VPC.
- Type: Public.
- DNS type: Public.
- Subnets: The VSI that is running your application. For example,
<your_prefix>-workload-vsi-zone-1
.
- Name:
-
Backend pool:
Click Create pool and specify the following information to create a back-end pool.
- Name:
<your_prefix>-backend-pool
. - Pool protocol: HTTP
- Session stickiness: Select whether all requests during a user's session are sent to the same instance.
- Proxy Protocol: Disabled.
- Method: Select how you want the load balancer to distribute traffic across the instances in the pool. If you don't have other requirements, select Round robin.
- Health Check:
- Health Port:
80
- Use the default settings for all other options.
- Name:
-
-
Click Create to create the back-end pool.
-
Click Attach server in the Server instances column of the Back-end pools table.
-
Select the VPC devices tab
- Add the VSI that is in the subnet the VSI that is running your application (for example,
<your_prefix>-workload-vsi-zone-1
). - Select an instance. If an instance has multiple interfaces, make sure that you select the correct IP address.
- Specify port
80
.
You can assign multiple VSIs here if you want to distribute the load.
- Add the VSI that is in the subnet the VSI that is running your application (for example,
-
In the Front-end listeners section, click Create listener.
- Set the listener port to
80
. Use the default settings for all other options. - Click Create to create the front-end listener.
- Set the listener port to
-
In the security groups section, clear all settings except the one labeled
<your_prefix>-workload
. -
After you finish creating pools and listeners, click Create load balancer.
{: #security-public-app} {: step}
To allow access to your load balancer, complete the following steps:
- Click the Menu icon , and then click VPC Infrastructure > Security groups.
- Find the
<your_prefix>-workload
security group that you want to attach your load balancer to. - Add the following inbound rule to that security group:
- Protocol:
TCP
- Port: Port Range:
- Min:
80
- Max:
80
- Min:
- Source Type:
Any
- Protocol:
To allow internet access to the load balancer, complete the following steps. For more information, see Creating a network ACL.
- Click the Menu icon , and then click **VPC Infrastructure > Access control lists.
- Find the ACL named
<your-prefix>-workload-acl
. - Create an inbound rule with the following settings:
- Allow or deny:
Allow
- Protocol:
TCP
- Source:
- Type:
Any
- Port:
Any
- Type:
- Destination:
- Type:
IP or CIDR
:10.40.10.0/24
- Port:
Port range
- Port min:
80
- Port max:
80
- Port min:
- Type:
- Priority:
Set to top
- Allow or deny:
- Create an outbound rule with the following settings:
- Allow or deny: Allow
- Protocol:
TCP
- Source:
- Type:
IP or CIDR
:10.40.10.0/24
- Port:
Port range
- Port min:
80
- Port max:
80
- Port min:
- Type:
- Destination:
- Type:
Any
- Port:
Any
- Type:
- Priority:
Set to top
It can take several minutes for your load balancer to finish provisioning. Wait until the status is Active
in Load balancers for VPC in the console. You might need to refresh the page periodically.
{: tip}
{: #check-public-app} {: step}
Now that your load balancer is configured, verify that it routes traffic to your app.
- Retrieve the fully qualified domain name of your load balancer:
- Paste the hostname in a browser and check whether your app responds.
You can also test connectivity by issuing the curl command curl http://<value of the Hostname>
.
{: tip}
{: #tshoot-vpn-public-app}
If you have connectivity issues through your load balancer, check out the troubleshooting topics in the VPN docs. For example, Why is traffic not reaching my back-end members?
{: #summary-public-app}
You configured your VSI on VPC landing zone deployable architecture that hosts a web application to allow traffic from the public internet through the {{site.data.keyword.alb_full}}. Your app is now accessible from any browser on the public internet through the fully qualified domain name of the load balancer.
{: #next-steps-public-app}
Learn more about how you can further extend your deployable architecture.
- Learn how to share your deployable architecture.
- Read about the global load balancing capabilities with {{site.data.keyword.cis_full_notm}} (CIS).