How to setup a connection to VPN from AWS EC2 instance? - amazon-web-services

I'm running an application in EC2 which needs to connect to an external service running in a VPN (a connection to third party network). I have the IP address and auth details (pre-shared key) through which to connect, but don't know how exactly to setup the connection. Do I need to install a VPN Client or is there any other way through AWS Console?
If you can share the steps/tutorial to set it up, it would be really helpful.
I've configured Site-Site VPN and can see two tunnels under the VPN Connection (both are DOWN right now). I've shared the VPN config file with the third party and they have asked my source IP address to be used for both the tunnels. I'm assuming the source IP will be the public IP of NAT Gateway attached to my VPC (since the servers don't have public IP assigned to them).

You can use the Site to Site VPN(AWS hardware VPN) configuration from Amazon Virtual Private Cloud to your On-Premise Network which do not require a separate VPN Client. After the configuration, you can access the Server in the VPN from its IP range.
Following AWS User Guides will take you through to configure a VPN Connection. Basic configuration is straight forward and AWS will also provide automated scripts to setup configuration in your OnPremise network.
General Introduction to VPN Options Available in AWS: VPN Connections
Guide with Details in Setting up VPN: Adding a Hardware Virtual Private Gateway to Your VPC
Step by Step Guide for Configuration: Setting Up the VPN Connection

You can set up a VPN client in your EC2 instance but also can connect your VPC to the VPN server using:
VPN Connections.
Adding a Hardware Virtual Private Gateway to Your VPC

Related

Check that VM on GCP is connecting to GCP VPN Gateway

How do I confirm that my VM connects to my GCP VPN Gateway? The two are already on the same network. I have tried pinging to the VPN Gateway IP from the vm but I cannot.
You would have to review and make sure that:
The VPN is active under Cloud VPN
Ensure that your GCP and on-prem firewall are allowing ingress/egress traffic between them
Depending on the type of VPN you choose, make sure that the IP address of the VM is shared to your on-prem via BPG, Route or Policy
If you see an issue with the VPN, you can review the VPN logs logs via logging (log viewer) and choose GCE Router. https://cloud.google.com/logging/docs/view/overview
If the issue is with the BGP/Route/Policy based, you would need to ensure your VPN IP is part of the shared range on both side (GCP and on-prem). https://cloud.google.com/network-connectivity/docs/vpn/concepts/overview#classic-vpn
If the issue is with Firewall, make sure that nothing is blocking your VM from communicating with your VPN IP range on GCP side and on your on-prem side. https://cloud.google.com/network-connectivity/docs/vpn/how-to/configuring-firewall-rules
Here is more troubleshooting you can review/try: https://cloud.google.com/network-connectivity/docs/vpn/support/troubleshooting

Can I connect my PC directly to the Google Cloud VPN

I run some web services running in Google Compute Engine. I want to secure them and make available only to my coallegues. I don't want to rely on web server security, so my idea was to configure a VPN with Google Cloud Platform.
My question may be silly, because I don't really know how VPN works. Is it possible to create a VPN in Google Cloud and connect to it directly from my laptop? I've tried to use "Hybrid Connectivity VPN" - but it allows only to connect to another VPN. When I make a tunnel, it asks me "Remote peer IP address". I don't have any on-premise VPN in my organization, also I am behind a NAT of my provider.
I know that that it could be possible in principle - once I've connected to VPN of my previous job. I've just used build-in Windows function "Add a VPN connection", inputed IP of the server and the secret. After that I could connect to the servers that were inside the corporate network.
Can I configure Google Cloud VPN to work in similar way?
Client-to-gateway(road warrior) setup is not supported by CloudVPN. For client-to-gateway scenarios, you can install and configure an IPSec VPN software, like Strongswan on a GCE VM and configure it for remote access. Users can than connect to this VPN server through VPN client and, after a secure tunnel established they can connect to all other VMs which are deployed inside the same network. With this setup, you can also configure NAT gateway and remove the public IP from other VMs. Configuring a NAT gateway is described in this article.
https://serverfault.com/questions/818101/does-gcp-support-p2s

How to connect to on-premise VPN from EC2?

I would like to run my Node application from EC2. But my application's database is in Client's location and I usually connect through Cisco AnyConnect VPN application.
I tried installing openconnect in the EC2, the moment I connect to the VPN, the instance goes out of my control. I understood this, because I no longer have control on the EC2 instance, since it's in the Client's VPN network. So I rebooted the EC2 to get back the access.
So how can I connect my Client's VPN from EC2 ?
Note: I cannot install or ask my client to configure anything on their end for this, they just provided their VPN connection details.
Create a Gateway in AWS. You can build an IPsec tunnel from AWS to a client's firewall using a site-to-site VPN.

AWS VPC route traffic to Client VPN connections

I have successfully configured an AWS Client VPN connection to a box running OpenVPN. I can access any devices on my VPC, which I've allowed access to.
Can I configure my VPC instances (an EC2 for example) to route traffic (SSH for example) to a client connected to the VPN?
Currently I cannot ssh to a client connected. I don't see any options to add a route to the Client VPN network. I've allowed all traffic in the Client VPN security group.
Is this a limitation of the Client VPN? If I want my VPN clients to be accessible from the VPC, will I need to configure a site to site connection?
Thanks a lot.
Per the recommendation of #James Dean, I configured a site to site between the devices which needed two way communication.

Is there a managed way to do P2S VPN in AWS?

I want to connect my (OSX) laptop to a VPC in AWS but I couldn't find a way to do this since I don't have a static IP.
Azure has managed P2S VPN: https://learn.microsoft.com/en-us/azure/vpn-gateway/point-to-site-about. Is there something like this in AWS?
You can stand up a virtual device (such as a CheckPoint firewall) in the VPC on an EC2 instance that has point to site VPN functionality. There are a number of AMI’s and quick starts for this available. You would also need a VPN client running on your laptop.
As an alternative, you can set up a bastion server and whitelist your IP. You can create a shell script that gets your IP and makes an AWS CLI call to update the security group with that value if it doesn’t exist. Then, log into the bastion and you’re in the VPC.
You can setup a client VPN under the VPC menu:
https://docs.aws.amazon.com/vpn/latest/clientvpn-admin/cvpn-working-endpoints.html
It will require to have server cert, as well as client certificates or a link to managed AD for authentication.