{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "Neptune-Export service",
  "Parameters": {
    "NeptuneExportVersion": {
      "Type": "String",
      "Default": "v2.1.1",
      "AllowedPattern": "v\\d+\\.(latest|\\d+\\.\\d+)",
      "ConstraintDescription": "Invalid NeptuneExportVersion, must match pattern [v<Major>.<Minor>.<Patch>] or [v<Major>.latest] eg: v2.0.0 or v2.latest",
      "Description": "Determines the version of the Neptune Export utility to be used."
    },
    "VPC": {
      "Description": "ID of the VPC in which to install Neptune-Export.",
      "Type": "AWS::EC2::VPC::Id"
    },
    "Subnet1": {
      "Description": "Subnet in your VPC with route to the internet.",
      "Type": "AWS::EC2::Subnet::Id"
    },
    "Subnet2": {
      "Description": "Subnet in your VPC with route to the internet.",
      "Type": "AWS::EC2::Subnet::Id"
    },
    "EnableIAM": {
      "Type": "String",
      "Default": "true",
      "AllowedValues": [
        "true",
        "false"
      ],
      "ConstraintDescription": "Must be a either true or false",
      "Description": "Enable IAM for Neptune-Export API."
    },
    "VPCOnly": {
      "Type": "String",
      "Default": "true",
      "AllowedValues": [
        "true",
        "false"
      ],
      "ConstraintDescription": "Must be a either true or false",
      "Description": "Determines whether Neptune-Export is a VPC-only service."
    },
    "EBSVolumeSize": {
      "Type": "Number",
      "Default": 1000,
      "MinValue": 1000,
      "MaxValue": 16384,
      "Description": "Specify size of the EBS volume, in GiBs (1000-16384). Keep the default value of 1000 unless you are exporting a large amount of data (e.g. more than 4TB storage volume)."
    },
    "NumOfFilesULimit": {
      "Type": "Number",
      "Default": 10000,
      "MinValue": 10000,
      "MaxValue": 1000000,
      "Description": "Specify the value for `nofile` in container property `ulimits` (10000-1000000). Keep the default value of 10000 unless your graph contains a large number of unique labels."
    },
    "PrivateDnsEnabled": {
      "Type": "String",
      "Default": "true",
      "AllowedValues": [
        "true",
        "false"
      ],
      "Description": "Indicate whether to associate a private hosted zone with the specified VPC"
    }
  },
  "Metadata": {
    "AWS::CloudFormation::Interface": {
      "ParameterGroups": [
        {
          "Label": {
            "default": "Network Configuration"
          },
          "Parameters": [
            "VPC",
            "Subnet1",
            "Subnet2"
          ]
        },
        {
          "Label": {
            "default": "Security"
          },
          "Parameters": [
            "EnableIAM",
            "VPCOnly"
          ]
        },
        {
          "Label": {
            "default": "Amazon EC2 Configuration"
          },
          "Parameters": [
            "EBSVolumeSize"
          ]
        },
        {
          "Label": {
            "default": "AWS Batch job definition parameters"
          },
          "Parameters": [
            "NumOfFilesULimit"
          ]
        }
      ]
    }
  },
  "Resources": {
    "NeptuneExportServiceStack": {
      "Type": "AWS::CloudFormation::Stack",
      "UpdateReplacePolicy": "Delete",
      "DeletionPolicy": "Delete",
      "Properties": {
        "TemplateURL": "https://s3.amazonaws.com/aws-neptune-customer-samples/neptune-export/install/cloudformation-templates/neptune-export-service-stack.json",
        "Parameters": {
          "NeptuneExportVersion": {
            "Ref": "NeptuneExportVersion"
          },
          "VPC": {
            "Ref": "VPC"
          },
          "Subnet1": {
            "Ref": "Subnet1"
          },
          "Subnet2": {
            "Ref": "Subnet2"
          },
          "EnableIAM": {
            "Ref": "EnableIAM"
          },
          "VPCOnly": {
            "Ref": "VPCOnly"
          },
          "EBSVolumeSize": {
            "Ref": "EBSVolumeSize"
          },
          "NumOfFilesULimit": {
            "Ref": "NumOfFilesULimit"
          },
          "IdSuffix": {
            "Fn::Select": [
              0,
              {
                "Fn::Split": [
                  "-",
                  {
                    "Fn::Select": [
                      2,
                      {
                        "Fn::Split": [
                          "/",
                          {
                            "Ref": "AWS::StackId"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          },
          "PrivateDnsEnabled": {
            "Ref": "PrivateDnsEnabled"
          }
        },
        "TimeoutInMinutes": "60"
      }
    }
  },
  "Outputs": {
    "StartNeptuneExportCommand": {
      "Description": "API command to start Neptune-Export job for property graph data",
      "Value": {
        "Fn::GetAtt": [
          "NeptuneExportServiceStack",
          "Outputs.StartNeptuneExportCommand"
        ]
      }
    },
    "StartNeptuneExportCommandForRdf": {
      "Description": "API command to start Neptune-Export job for RDF data",
      "Value": {
        "Fn::GetAtt": [
          "NeptuneExportServiceStack",
          "Outputs.StartNeptuneExportCommandForRdf"
        ]
      }
    },
    "NeptuneExportStatusCommand": {
      "Description": "API command to get status of a Neptune-Export job",
      "Value": {
        "Fn::GetAtt": [
          "NeptuneExportServiceStack",
          "Outputs.NeptuneExportStatusCommand"
        ]
      }
    },
    "CancelNeptuneExportCommand": {
      "Description": "API command to cancel a Neptune-Export job",
      "Value": {
        "Fn::GetAtt": [
          "NeptuneExportServiceStack",
          "Outputs.CancelNeptuneExportCommand"
        ]
      }
    },
    "NeptuneExportSecurityGroup": {
      "Description": "Neptune-Export Security Group",
      "Value": {
        "Fn::GetAtt": [
          "NeptuneExportServiceStack",
          "Outputs.NeptuneExportSecurityGroup"
        ]
      }
    },
    "NeptuneExportApiUri": {
      "Description": "Neptune-Export API URI",
      "Value": {
        "Fn::GetAtt": [
          "NeptuneExportServiceStack",
          "Outputs.NeptuneExportApiUri"
        ]
      }
    },
    "NeptuneExportApiId": {
      "Description": "Neptune-Export API ID",
      "Value": {
        "Fn::GetAtt": [
          "NeptuneExportServiceStack",
          "Outputs.NeptuneExportApiId"
        ]
      }
    },
    "NeptuneExportLambdaArn": {
      "Description": "NeptuneExportLambda ARN",
      "Value": {
        "Fn::GetAtt": [
          "NeptuneExportServiceStack",
          "Outputs.NeptuneExportLambdaArn"
        ]
      }
    }
  }
}