<commit_before>{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "Cloud Formation template manipulated with `instavpn` to create VPN tunnels automatically.",
  "Parameters": {
    "MySide": {
      "Description": "Which side of VPN conneciton to build [Server, Client, TestBoth]",
      "Type": "String",
      "AllowedValues": ["Server", "Client", "TestBoth"],
      "ConstraintDescription": "Must be either Server, Client or TestBoth"
    },
    "InstanceType": {
      "Description": "VPN instance type. Recommended values are: t2.micro, m3.medium, m3.xlarge, c3.4xlarge, and c3.8xlarge.",
      "Type": "String",
      "AllowedValues": ["t1.micro","t2.micro","t2.small","t2.medium","m1.small","m1.medium","m1.large","m1.xlarge","m3.medium","m3.large","m3.xlarge","m3.2xlarge","c3.4xlarge","c3.8xlarge"],
      "ConstraintDescription": "must be a valid EC2 instance type."
    },
    "SharedSecret": {
      "NoEcho": "true",
      "Description": "Pre-shared secret between VPN boxes",
      "Type": "String",
      "MinLength": "16",
      "AllowedPattern": "[a-zA-Z0-9\\-\\_\\=]+",
      "ConstraintDescription": "must contain 15+ urlsafe_base64 characters."
    },

    "ServerName": {
      "Description": "Server (Service) Name",
      "Type": "String",
      "Default": "DCS",
      "AllowedPattern": "[a-zA-Z0-9\\-_]+",
      "ConstraintDescription": "must contain only [a-zA-Z0-9\\-_]."
    },
    "ServerEIP": {
      "Description": "Server elastic IP",
      "Type": "String",
      "AllowedPattern": "([0-9]{1,3}\\.){3}[0-9]{1,3}",
      "ConstraintDescription": "must contain only alphanumeric characters."
    },
    "ServerEIPId": {
      "Description": "Server Elastic IP allocation ID",
      "Type": "String",
      "AllowedPattern": "eipalloc-[a-z0-9]{8,}",
      "ConstraintDescription": "must be valid EIP allocation ID."
    },
    "ServerSubnetId": {
      "Description": "Server Subnet ID",
      "Type": "String",
      "AllowedPattern": "subnet-[a-z0-9]{8,}",
      "ConstraintDescription": "must be valid Subnet ID."
    },
    "ServerVPCId": {
      "Description": "Server VPC ID",
      "Type": "String",
      "AllowedPattern": "vpc-[a-z0-9]{8,}",
      "ConstraintDescription": "must be valid VPC ID."
    },
    "ServerSharedCIDRs": {
      "Description": "Subnet CIDRs exposed on the server side",
      "Type": "String",
      "AllowedPattern": "(([0-9]{1,3}\\.){3}[0-9]{1,3}/[0-9]{1,2}\\s+)*([0-9]{1,3}\\.){3}[0-9]{1,3}/[0-9]{1,2}",
      "ConstraintDescription": "must be valid CIDR(s)"
    },

    "ClientName": {
      "Description": "Client name, usually service name + stage. Never confuse with `Service` tag on the next stage.",
      "Type": "String",
      "AllowedPattern": "[a-zA-Z0-9\\-_]+",
      "ConstraintDescription": "must contain only [a-zA-Z0-9\\-_]."
    },
    "ClientEIP": {
      "Description": "Client elastic IP",
      "Type": "String",
      "AllowedPattern": "([0-9]{1,3}\\.){3}[0-9]{1,3}",
      "ConstraintDescription": "must contain only alphanumeric characters."
    },
    "ClientEIPId": {
      "Description": "Client Elastic IP allocation ID",
      "Type": "String",
      "AllowedPattern": "eipalloc-[a-z0-9]{8,}",
      "ConstraintDescription": "must be valid EIP allocation ID."
    },
    "ClientSubnetId": {
      "Description": "Client Subnet ID",
      "Type": "String",
      "AllowedPattern": "subnet-[a-z0-9]{8,}",
      "ConstraintDescription": "must be valid Subnet ID."
    },
    "ClientVPCId": {
      "Description": "Client VPC ID",
      "Type": "String",
      "AllowedPattern": "vpc-[a-z0-9]{8,}",
      "ConstraintDescription": "must be valid VPC ID."
    },
    "ClientSharedCIDRs": {
      "Description": "Subnet CIDRs exposed from the client side",
      "Type": "String",
      "AllowedPattern": "(([0-9]{1,3}\\.){3}[0-9]{1,3}/[0-9]{1,2}\\s+)*([0-9]{1,3}\\.){3}[0-9]{1,3}/[0-9]{1,2}",
      "ConstraintDescription": "must be valid CIDR(s)"
    }
  },

  "Conditions": {
    "IsServer": {
        "Fn::Or": [
            {"Fn::Equals": [{"Ref": "MySide"}, "Server"]},
            {"Fn::Equals": [{"Ref": "MySide"}, "TestBoth"]}
        ]
    },
    "IsClient": {
        "Fn::Or": [
            {"Fn::Equals": [{"Ref": "MySide"}, "Client"]},
            {"Fn::Equals": [{"Ref": "MySide"}, "TestBoth"]}
        ]
    }
  },

  "Mappings": {
    "AWSInstanceType2Arch": {
      "t1.micro":   {"Arch": "64"},
      "t2.micro":   {"Arch": "64HVM"},
      "t2.small":   {"Arch": "64HVM"},
      "t2.medium":  {"Arch": "64HVM"},
      "m1.small":   {"Arch": "64"},
      "m1.medium":  {"Arch": "64"},
      "m1.large":   {"Arch": "64"},
      "m1.xlarge":  {"Arch": "64"},
      "m3.medium":  {"Arch": "64HVM"},
      "m3.large":   {"Arch": "64HVM"},
      "m3.xlarge":  {"Arch": "64HVM"},
      "m3.2xlarge": {"Arch": "64HVM"},
      "c3.4xlarge": {"Arch": "64HVM"},
      "c3.8xlarge": {"Arch": "64HVM"}
    },
    "AWSRegionArch2AMI": {
      "us-east-1": {        "64": "ami-50842d38", "64HVM": "ami-08842d60"},
      "us-west-2": {        "64": "ami-af86c69f", "64HVM": "ami-8786c6b7"},
      "us-west-1": {        "64": "ami-c7a8a182", "64HVM": "ami-cfa8a18a"},
      "eu-west-1": {        "64": "ami-aa8f28dd", "64HVM": "ami-748e2903"},
      "ap-southeast-1": {   "64": "ami-20e1c572", "64HVM": "ami-d6e1c584"},
      "ap-southeast-2": {   "64": "ami-8b4724b1", "64HVM": "ami-fd4724c7"},
      "ap-northeast-1": {   "64": "ami-21072820", "64HVM": "ami-35072834"},
      "sa-east-1": {        "64": "ami-9d6cc680", "64HVM": "ami-956cc688"}
    }
  },

  "Resources": {
    "ServerSG": {
      "Type": "AWS::EC2::SecurityGroup",
      "Condition": "IsServer",
      "Properties": {
        "GroupDescription": {"Fn::Join": ["", ["VPN Server to ", {"Ref": "ClientName"}]]},
        "SecurityGroupIngress": [
          {"IpProtocol":"tcp","FromPort":  "50","ToPort":  "51","CidrIp":{"Fn::Join": ["", [{"Ref":"ClientEIP"}, "/32"]]}},
          {"IpProtocol":"udp","FromPort": "500","ToPort": "500","CidrIp":{"Fn::Join": ["", [{"Ref":"ClientEIP"}, "/32"]]}},
          {"IpProtocol":"udp","FromPort":"4500","ToPort":"4500","CidrIp":{"Fn::Join": ["", [{"Ref":"ClientEIP"}, "/32"]]}}
        ],
        "Tags": [
            {"Key": "Name", "Value": {"Fn::Join": ["", ["VPN-to-", {"Ref": "ClientName"}]]}}
        ],
        "VpcId": {"Ref": "ServerVPCId"}<commit_msg>Update AMI ID in eu-central-1 and eu-west-1<commit_after>{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "Cloud Formation template manipulated with `instavpn` to create VPN tunnels automatically.",
  "Parameters": {
    "MySide": {
      "Description": "Which side of VPN conneciton to build [Server, Client, TestBoth]",
      "Type": "String",
      "AllowedValues": ["Server", "Client", "TestBoth"],
      "ConstraintDescription": "Must be either Server, Client or TestBoth"
    },
    "InstanceType": {
      "Description": "VPN instance type. Recommended values are: t2.micro, m3.medium, m3.xlarge, c3.4xlarge, and c3.8xlarge.",
      "Type": "String",
      "AllowedValues": ["t1.micro","t2.micro","t2.small","t2.medium","m1.small","m1.medium","m1.large","m1.xlarge","m3.medium","m3.large","m3.xlarge","m3.2xlarge","c3.4xlarge","c3.8xlarge"],
      "ConstraintDescription": "must be a valid EC2 instance type."
    },
    "SharedSecret": {
      "NoEcho": "true",
      "Description": "Pre-shared secret between VPN boxes",
      "Type": "String",
      "MinLength": "16",
      "AllowedPattern": "[a-zA-Z0-9\\-\\_\\=]+",
      "ConstraintDescription": "must contain 15+ urlsafe_base64 characters."
    },

    "ServerName": {
      "Description": "Server (Service) Name",
      "Type": "String",
      "Default": "DCS",
      "AllowedPattern": "[a-zA-Z0-9\\-_]+",
      "ConstraintDescription": "must contain only [a-zA-Z0-9\\-_]."
    },
    "ServerEIP": {
      "Description": "Server elastic IP",
      "Type": "String",
      "AllowedPattern": "([0-9]{1,3}\\.){3}[0-9]{1,3}",
      "ConstraintDescription": "must contain only alphanumeric characters."
    },
    "ServerEIPId": {
      "Description": "Server Elastic IP allocation ID",
      "Type": "String",
      "AllowedPattern": "eipalloc-[a-z0-9]{8,}",
      "ConstraintDescription": "must be valid EIP allocation ID."
    },
    "ServerSubnetId": {
      "Description": "Server Subnet ID",
      "Type": "String",
      "AllowedPattern": "subnet-[a-z0-9]{8,}",
      "ConstraintDescription": "must be valid Subnet ID."
    },
    "ServerVPCId": {
      "Description": "Server VPC ID",
      "Type": "String",
      "AllowedPattern": "vpc-[a-z0-9]{8,}",
      "ConstraintDescription": "must be valid VPC ID."
    },
    "ServerSharedCIDRs": {
      "Description": "Subnet CIDRs exposed on the server side",
      "Type": "String",
      "AllowedPattern": "(([0-9]{1,3}\\.){3}[0-9]{1,3}/[0-9]{1,2}\\s+)*([0-9]{1,3}\\.){3}[0-9]{1,3}/[0-9]{1,2}",
      "ConstraintDescription": "must be valid CIDR(s)"
    },

    "ClientName": {
      "Description": "Client name, usually service name + stage. Never confuse with `Service` tag on the next stage.",
      "Type": "String",
      "AllowedPattern": "[a-zA-Z0-9\\-_]+",
      "ConstraintDescription": "must contain only [a-zA-Z0-9\\-_]."
    },
    "ClientEIP": {
      "Description": "Client elastic IP",
      "Type": "String",
      "AllowedPattern": "([0-9]{1,3}\\.){3}[0-9]{1,3}",
      "ConstraintDescription": "must contain only alphanumeric characters."
    },
    "ClientEIPId": {
      "Description": "Client Elastic IP allocation ID",
      "Type": "String",
      "AllowedPattern": "eipalloc-[a-z0-9]{8,}",
      "ConstraintDescription": "must be valid EIP allocation ID."
    },
    "ClientSubnetId": {
      "Description": "Client Subnet ID",
      "Type": "String",
      "AllowedPattern": "subnet-[a-z0-9]{8,}",
      "ConstraintDescription": "must be valid Subnet ID."
    },
    "ClientVPCId": {
      "Description": "Client VPC ID",
      "Type": "String",
      "AllowedPattern": "vpc-[a-z0-9]{8,}",
      "ConstraintDescription": "must be valid VPC ID."
    },
    "ClientSharedCIDRs": {
      "Description": "Subnet CIDRs exposed from the client side",
      "Type": "String",
      "AllowedPattern": "(([0-9]{1,3}\\.){3}[0-9]{1,3}/[0-9]{1,2}\\s+)*([0-9]{1,3}\\.){3}[0-9]{1,3}/[0-9]{1,2}",
      "ConstraintDescription": "must be valid CIDR(s)"
    }
  },

  "Conditions": {
    "IsServer": {
        "Fn::Or": [
            {"Fn::Equals": [{"Ref": "MySide"}, "Server"]},
            {"Fn::Equals": [{"Ref": "MySide"}, "TestBoth"]}
        ]
    },
    "IsClient": {
        "Fn::Or": [
            {"Fn::Equals": [{"Ref": "MySide"}, "Client"]},
            {"Fn::Equals": [{"Ref": "MySide"}, "TestBoth"]}
        ]
    }
  },

  "Mappings": {
    "AWSInstanceType2Arch": {
      "t1.micro":   {"Arch": "64"},
      "t2.micro":   {"Arch": "64HVM"},
      "t2.small":   {"Arch": "64HVM"},
      "t2.medium":  {"Arch": "64HVM"},
      "m1.small":   {"Arch": "64"},
      "m1.medium":  {"Arch": "64"},
      "m1.large":   {"Arch": "64"},
      "m1.xlarge":  {"Arch": "64"},
      "m3.medium":  {"Arch": "64HVM"},
      "m3.large":   {"Arch": "64HVM"},
      "m3.xlarge":  {"Arch": "64HVM"},
      "m3.2xlarge": {"Arch": "64HVM"},
      "c3.4xlarge": {"Arch": "64HVM"},
      "c3.8xlarge": {"Arch": "64HVM"}
    },
    "AWSRegionArch2AMI": {
      "us-east-1": {        "64": "ami-50842d38", "64HVM": "ami-08842d60"},
      "us-west-2": {        "64": "ami-af86c69f", "64HVM": "ami-8786c6b7"},
      "us-west-1": {        "64": "ami-c7a8a182", "64HVM": "ami-cfa8a18a"},
      "eu-west-1": {        "64": "ami-9c7ad8eb", "64HVM": "ami-6e7bd919"},
      "eu-central-1": {     "64": "ami-a03503bd", "64HVM": "ami-b43503a9"},
      "ap-southeast-1": {   "64": "ami-20e1c572", "64HVM": "ami-d6e1c584"},
      "ap-southeast-2": {   "64": "ami-8b4724b1", "64HVM": "ami-fd4724c7"},
      "ap-northeast-1": {   "64": "ami-21072820", "64HVM": "ami-35072834"},
      "sa-east-1": {        "64": "ami-9d6cc680", "64HVM": "ami-956cc688"}
    }
  },

  "Resources": {
    "ServerSG": {
      "Type": "AWS::EC2::SecurityGroup",
      "Condition": "IsServer",
      "Properties": {
        "GroupDescription": {"Fn::Join": ["", ["VPN Server to ", {"Ref": "ClientName"}]]},
        "SecurityGroupIngress": [
          {"IpProtocol":"tcp","FromPort":  "50","ToPort":  "51","CidrIp":{"Fn::Join": ["", [{"Ref":"ClientEIP"}, "/32"]]}},
          {"IpProtocol":"udp","FromPort": "500","ToPort": "500","CidrIp":{"Fn::Join": ["", [{"Ref":"ClientEIP"}, "/32"]]}},
          {"IpProtocol":"udp","FromPort":"4500","ToPort":"4500","CidrIp":{"Fn::Join": ["", [{"Ref":"ClientEIP"}, "/32"]]}}
        ],
        "Tags": [
            {"Key": "Name", "Value": {"Fn::Join": ["", ["VPN-to-", {"Ref": "ClientName"}]]}}
        ],
        "VpcId": {"Ref": "ServerVPCId"}
{'fraction_non_alphanumeric': 0.24416251556662516, 'fraction_numerical': 0.05417185554171856, 'mean_word_length': 2.909035594767265, 'pattern_counts': {'":': 369, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5897494', 'n_tokens_mistral': 4999, 'n_tokens_neox': 4747, 'n_words': 886}