blob: 45fe14f83cdc055aa1f05f4c880f0957553b1562 [file] [log] [blame]
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Stack for running OpenNLP testing.",
"Parameters": {
"InstanceType": {
"Description": "EC2 instance type.",
"Type": "String",
"Default": "r4.xlarge"
},
"Image": {
"Description": "The base AMI.",
"Type": "String",
"Default": "ami-80861296"
},
"KeyName": {
"Description": "An existing EC2 keypair.",
"Type": "AWS::EC2::KeyPair::KeyName",
"ConstraintDescription": "Must be the name of an existing EC2 keypair."
}
},
"Resources": {
"VPC": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "10.0.0.0/16",
"Tags": [
{
"Key": "Application",
"Value": {
"Ref": "AWS::StackId"
}
}
]
}
},
"Subnet": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"VpcId": {
"Ref": "VPC"
},
"CidrBlock": "10.0.0.0/24",
"Tags": [
{
"Key": "Application",
"Value": {
"Ref": "AWS::StackId"
}
}
]
}
},
"InternetGateway": {
"Type": "AWS::EC2::InternetGateway",
"Properties": {
"Tags": [
{
"Key": "Application",
"Value": {
"Ref": "AWS::StackId"
}
}
]
}
},
"AttachGateway": {
"Type": "AWS::EC2::VPCGatewayAttachment",
"Properties": {
"VpcId": {
"Ref": "VPC"
},
"InternetGatewayId": {
"Ref": "InternetGateway"
}
}
},
"RouteTable": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "VPC"
},
"Tags": [
{
"Key": "Application",
"Value": {
"Ref": "AWS::StackId"
}
}
]
}
},
"Route": {
"Type": "AWS::EC2::Route",
"DependsOn": "AttachGateway",
"Properties": {
"RouteTableId": {
"Ref": "RouteTable"
},
"DestinationCidrBlock": "0.0.0.0/0",
"GatewayId": {
"Ref": "InternetGateway"
}
}
},
"SubnetRouteTableAssociation": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"SubnetId": {
"Ref": "Subnet"
},
"RouteTableId": {
"Ref": "RouteTable"
}
}
},
"NetworkAcl": {
"Type": "AWS::EC2::NetworkAcl",
"Properties": {
"VpcId": {
"Ref": "VPC"
},
"Tags": [
{
"Key": "Application",
"Value": {
"Ref": "AWS::StackId"
}
}
]
}
},
"InstanceSecurityGroup": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"VpcId": {
"Ref": "VPC"
},
"GroupDescription": "Enable SSH access via port 22",
"SecurityGroupIngress": [
{
"IpProtocol": "tcp",
"FromPort": "22",
"ToPort": "22",
"CidrIp": "0.0.0.0/0"
}
]
}
},
"OpenNLPInstance": {
"Type": "AWS::EC2::Instance",
"DependsOn": "AttachGateway",
"Properties": {
"ImageId": {
"Ref": "Image"
},
"InstanceType": {
"Ref": "InstanceType"
},
"KeyName": {
"Ref": "KeyName"
},
"Tags": [
{
"Key": "Application",
"Value": {
"Ref": "AWS::StackId"
}
},
{
"Key": "Name",
"Value": "OpenNLP Testing"
}
],
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"",
[
"#!/bin/bash -xe\n",
"apt-get update && sudo apt-get -y dist-upgrade\n",
"apt-get install -y openjdk-8-jdk git maven awscli\n",
"# Get the scripts\n",
"git clone https://github.com/apache/opennlp-sandbox.git\n",
"mv opennlp-sandbox/aws-ec2-testing-scripts/* /opt/\n",
"# Get OpenNLP\n",
"git clone https://github.com/apache/opennlp.git\n",
"mv opennlp /opt/\n",
"mkdir /opt/opennlp-data\n",
"aws s3 cp s3://bucket/opennlp-data /opt/opennlp-data --recursive\n"
]
]
}
}
}
}
},
"Outputs": {}
}