Search code examples
aws-cloudformationopenvpn

CloudFormation OpenVPN


I want to configure OpenVPN using CloudFormation, I thought I can get the AMI ID from Market place and launch it, because I want to launch an instance with 10 connection, but unfortunately I am not able to get AMI ID from Market place. How to get the AMI ID of OpenVPN Server with 10 supported connection ?


Solution

  • You can launch OpenVPN Server using CloudFormation using the following steps :

    Use the following command to list the OpenVPN AMI ID

    aws --region=ap-southeast-2 ec2 describe-images --owner=aws-marketplace --filters 'Name=name,Values=OpenVPN Access Server 2.7.5*'
    

    The above command will give the following output

    {
        "Images": [
            {
                "VirtualizationType": "hvm",
                "Hypervisor": "xen",
                "RootDeviceType": "ebs",
                "SriovNetSupport": "simple",
                "OwnerId": "123",
                "ImageId": "ami-01f26c6ea254596c5",
                "Name": "OpenVPN Access Server 2.7.5-bbff26cd-b407-44a2-a7ef-70b8971391f1-ami-0c56f53c16ad84dcd.4",
                "BlockDeviceMappings": [
                    {
                        "DeviceName": "/dev/sda1",
                        "Ebs": {
                            "SnapshotId": "snap-0624e972dc64638ed",
                            "VolumeSize": 8,
                            "Encrypted": false,
                            "VolumeType": "standard",
                            "DeleteOnTermination": true
                        }
                    }
                ],
                "EnaSupport": true,
                "ImageLocation": "aws-marketplace/OpenVPN Access Server 2.7.5-bbff26cd-b407-44a2-a7ef-70b8971391f1-ami-0c56f53c16ad84dcd.4",
                "ImageOwnerAlias": "aws-marketplace",
                "ProductCodes": [
                    {
                        "ProductCodeId": "b4oaowtu943z36a9jxepql6gh",
                        "ProductCodeType": "marketplace"
                    }
                ],
                "ImageType": "machine",
                "Public": true,
                "CreationDate": "2019-09-30T14:17:14.000Z",
                "Description": "http://www.openvpn.net/",
                "State": "available",
                "RootDeviceName": "/dev/sda1",
                "Architecture": "x86_64"
            }, ...
            .....
    
    }]
    }
    

    To get more details about the image and OpenVPN Server you will have to search MarketPlace using the AMI-ID.

    To use the image in CloudFormation you have to Subscribe to the Product over Market Place. Once you have subscribed you can launch OpenVPN like other normal EC2 Instances using the AMI ID.