Virtual Private Network (VPN)
Learn how to connect AEM as a Cloud Service with your VPN to create secure communication channels between AEM and internal services.
What is Virtual Private Network?
Virtual Private Network (VPN) allows an AEM as a Cloud Service customer to connect the AEM environments within a Cloud Manager Program to an existing, supported VPN. VPN allows secure and controlled connections between AEM as a Cloud Service and services within the customer’s network.
A Cloud Manager Program can only have a single network infrastructure type. Ensure that Virtual Private Network is the most appropriate type of network infrastructure for your AEM as a Cloud Service before executing the following commands.
Prerequisites
The following are required when setting up a Virtual Private Network using Cloud Manager APIs:
-
ÃÛ¶¹ÊÓƵ account with
-
Access to
- Organization ID (aka IMS Org ID)
- Client ID (aka API Key)
- Access Token (aka Bearer Token)
-
The Cloud Manager Program ID
-
The Cloud Manager Environment IDs
-
A Route-Based Virtual Private Network, with access to all necessary connection parameters.
For more details review how to setup, configure, and obtain Cloud Manger API credentials,to use them to make a Cloud Manager API call.
This tutorial uses curl
to make the Cloud Manager API configurations. The provided curl
commands assume a Linux/macOS syntax. If using the Windows command prompt, replace the \
line-break character with ^
.
Enable Virtual Private Network per program
Start by enabling the Virtual Private Network on AEM as a Cloud Service.
Flexible port egress can be enabled using Cloud Manager. The following steps outline how to enable flexible port egress on AEM as a Cloud Service using the Cloud Manager.
-
Log in to the as a Cloud Manager Business Owner.
-
Navigate to the desired Program.
-
In the left menu, navigate to Services > Network Infrastructures.
-
Select the Add network infrastructure button.
-
In the Add network infrastructure dialog, select the Virtual private network option. Fill out the fields and select Continue. Work with your organization’s network administrator to obtain the correct values.
-
Create at least one VPN connection. Give the connection a meaningful name and select the Add connection button.
-
Configure the VPN connection. Work with your organization’s network administrator to obtain the correct values. Select Save to confirm the addition of the connection.
-
If multiple VPN connections are required, as more connections as needed. When all VPN connections are added, select Continue.
-
Select Save to confirm the addition of the VPN and all configured connections.
-
Wait for the network infrastructure to be created and marked as Ready. This process can take up to 1 hour.
With the VPN created, you can now configure it using the Cloud Manager APIs as described below.
Virtual Private Network can be enabled using Cloud Manager APIs. The following steps outline how to enable VPN on AEM as a Cloud Service using the Cloud Manager API.
-
First, determine the region in which the Advanced Networking is needed by using the Cloud Manager API operation. The
region name
is required to make subsequent Cloud Manager API calls. Typically, the region the Production environment resides in is used.Find your AEM as a Cloud Service environment’s region in under the environment’s details. The region name displayed in Cloud Manager can be used in the Cloud Manager API.
listRegions HTTP request
code language-shell $ curl -X GET https://cloudmanager.adobe.io/api/program/{programId}/regions \ -H 'x-gw-ims-org-id: <ORGANIZATION_ID>' \ -H 'x-api-key: <CLIENT_ID>' \ -H 'Authorization: Bearer <ACCESS_TOKEN>' \ -H 'Content-Type: application/json'
-
Enable Virtual Private Network for a Cloud Manager Program using Cloud Manager APIs operation. Use the appropriate
region
code obtained from the Cloud Manager APIlistRegions
operation.createNetworkInfrastructure HTTP request
code language-shell $ curl -X POST https://cloudmanager.adobe.io/api/program/{programId}/networkInfrastructures \ -H 'x-gw-ims-org-id: <ORGANIZATION_ID>' \ -H 'x-api-key: <CLIENT_ID>' \ -H 'Authorization: Bearer <ACCESS_TOKEN>' \ -H 'Content-Type: application/json' -d @./vpn-create.json
Define the JSON parameters in a
vpn-create.json
and provided to curl via... -d @./vpn-create.json
.Download the example vpn-create.json. This file is only an example. Configure your file as required based on the optional/required fields documented at .
code language-json { "kind": "vpn", "region": "va7", "addressSpace": [ "10.104.182.64/26" ], "dns": { "resolvers": [ "10.151.201.22", "10.151.202.22", "10.154.155.22" ], "domains": [ "wknd.site", "wknd.com" ] }, "connections": [{ "name": "connection-1", "gateway": { "address": "195.231.212.78", "addressSpace": [ "10.151.0.0/16", "10.152.0.0/16", "10.153.0.0/16", "10.154.0.0/16", "10.142.0.0/16", "10.143.0.0/16", "10.124.128.0/17" ] }, "sharedKey": "<secret_shared_key>", "ipsecPolicy": { "dhGroup": "ECP256", "ikeEncryption": "AES256", "ikeIntegrity": "SHA256", "ipsecEncryption": "AES256", "ipsecIntegrity": "SHA256", "pfsGroup": "ECP256", "saDatasize": 102400000, "saLifetime": 3600 } }] }
Wait 45-60 minutes for the Cloud Manager Program to provision the network infrastructure.
-
Check that the environment has finished Virtual Private Network configuration using the Cloud Manager API operation, using the
id
returned from thecreateNetworkInfrastructure
HTTP request in the previous step.getNetworkInfrastructure HTTP request
code language-shell $ curl -X GET https://cloudmanager.adobe.io/api/program/{programId}/networkInfrastructure/{networkInfrastructureId} \ -H 'x-gw-ims-org-id: <ORGANIZATION_ID>' \ -H 'x-api-key: <CLIENT_ID>' \ -H 'Authorization: <YOUR_BEARER_TOKEN>' \ -H 'Content-Type: application/json'
Verify that the HTTP response contains a status of ready. If not yet ready, recheck the status every few minutes.
With the VPN created, you can now configure it using the Cloud Manager APIs as described below.
Configure Virtual Private Network proxies per environment
-
Enable and configure the Virtual Private Network configuration on each AEM as a Cloud Service environment using the Cloud Manager API operation.
enableEnvironmentAdvancedNetworkingConfiguration HTTP request
code language-shell $ curl -X PUT https://cloudmanager.adobe.io/api/program/{programId}/environment/{environmentId}/advancedNetworking \ -H 'x-gw-ims-org-id: <ORGANIZATION_ID>' \ -H 'x-api-key: <CLIENT_ID>' \ -H 'Authorization: Bearer <ACCESS_TOKEN>' \ -H 'Content-Type: application/json' \ -d @./vpn-configure.json
Define the JSON parameters in a
vpn-configure.json
and provided to curl via... -d @./vpn-configure.json
.Download the example vpn-configure.json
code language-json { "nonProxyHosts": [ "example.net", "*.example.org" ], "portForwards": [ { "name": "mysql.example.com", "portDest": 3306, "portOrig": 30001 }, { "name": "smtp.sendgrid.com", "portDest": 465, "portOrig": 30002 } ] }
nonProxyHosts
declares a set of hosts for which port 80 or 443 should be routed through the default shared IP address ranges rather than the dedicated egress IP.nonProxyHosts
may be useful as traffic egressing through shared IPs is optimized automatically by ÃÛ¶¹ÊÓƵ.For each
portForwards
mapping, the advanced networking defines the following forwarding rule:table 0-row-5 1-row-5 Proxy host Proxy port External host External port AEM_PROXY_HOST
portForwards.portOrig
→ portForwards.name
portForwards.portDest
If your AEM deployment only requires HTTP/HTTPS connections to external service, leave the
portForwards
array empty, as these rules are only required for non-HTTP/HTTPS requests. -
For each environment, validate the VPN routing rules are in effect using the Cloud Manager API’s operation.
getEnvironmentAdvancedNetworkingConfiguration HTTP request
code language-shell $ curl -X GET https://cloudmanager.adobe.io/api/program/{programId}/environment/{environmentId}/advancedNetworking \ -H 'x-gw-ims-org-id: <ORGANIZATION_ID>' \ -H 'x-api-key: <CLIENT_ID>' \ -H 'Authorization: Bearer <ACCESS_TOKEN>' \ -H 'Content-Type: application/json'
-
Virtual private network proxy configurations can be updated using the Cloud Manager API’s operation. Remember
enableEnvironmentAdvancedNetworkingConfiguration
is aPUT
operation, so all rules must be provided with every invocation of this operation. -
Now, you can use the Virtual Private Network egress configuration in your custom AEM code and configuration.
Connecting to external services over the Virtual Private Network
With the Virtual Private Network enabled, AEM code and configuration can use them to make calls to external services via the VPN. There are two flavors of external calls that AEM treats differently:
- HTTP/HTTPS calls to external services
- Includes HTTP/HTTPS calls made to services running on ports other than the standard 80 or 443 ports.
- non-HTTP/HTTPS calls to external services
- Includes any non-HTTP calls, such as connections with Mail servers, SQL databases, or services that run on other non-HTTP/HTTPS protocols.
HTTP/HTTPS requests from AEM on standard ports (80/443) are allowed by default but do not use the VPN connection if not configured appropriately as described below.
HTTP/HTTPS
When creating HTTP/HTTPS connections from AEM, when using VPN, HTTP/HTTPS connections are automatically proxied out of AEM. No additional code or configuration is required to support HTTP/HTTPS connections.
Code examples
Non-HTTP/HTTPS connections code examples
When creating non-HTTP/HTTPS connections (ex. SQL, SMTP, and so on) from AEM, the connection must be made through a special host name provided by AEM.
AEM_PROXY_HOST
System.getenv("AEM_PROXY_HOST")
$[env:AEM_PROXY_HOST]
Connections to external services are then called through the AEM_PROXY_HOST
and the mapped port (portForwards.portOrig
), which AEM then routes to the mapped external hostname (portForwards.name
) and port (portForwards.portDest
).
AEM_PROXY_HOST
portForwards.portOrig
portForwards.name
portForwards.portDest
Code examples
Limit access to AEM as a Cloud Service via VPN
The Virtual Private Network configuration limits access to AEM as a Cloud Service environments to a VPN.