- AWS account
- AWS cli
- AWS SAM cli
- Java 8
- Maven
- create an AWS Neptune instance:
- go to AWS Neptune home
- click "Launch Amazon Neptune"
- select DB engine version and DB instance class
- enable or disable high availability (Multi-AZ)
- enter a DB instance identifier in the "Settings" section
- click "Next"
- select VPC, subnet group and availability zone
- leave "Create new VPC security group" checked
- leave other parameters as default and click "Create Database" below
- it will take some time (ca. 7 min) for the instance to start and become available
- adjust the created Neptune's security group:
- go to the security groups
- find the newly created security group. it should have the name "rds-launch-wizard" or similar.
- write down the security group ID
- add a new inbound rule allowing all incoming TCP connections from inside the security group:
- Type = Custom TCP
- Protocol = TCP
- Port Range = 0 - 65535
- Source = < ID of the security group >
- create an S3 bucket. AWS SAM will use it for storing lambdas (ZIP archives).
- create an IAM role for lambdas. The role should have the following (predefined by AWS) policies:
- build and deploy lambdas:
cd cloudformation
cp vars.template.sh vars.sh
vi vars.sh
- adjust the variables:
S3_BUCKET
-- name of the created S3 bucket where lambdas will be stored.STACK_NAME
-- name that will be used for the CloudFormation stack with lambdas.ROLE_ARN
-- ARN of the created IAM role for lambdas.SECURITY_GROUP_IDS
-- the ID of the security group created for Neptune.SUBNET_IDS
-- IDs of the subnets of the VPC where the Neptune instance has been deployed.NEPTUNE_ENDPOINT
-- Neptune's endpoint. It can be found in the Neptune clusters. Click on the created cluster and find the "Cluster endpoint" DNS name in the "Details" section.NEPTUNE_PORT
-- Neptune's port (8182 by default).TAG_USER
-- user name for marking AWS resources with taguser
.
- build and deploy lambdas:
. build.sh && . package.sh && . deploy.sh
- go to the CloudFormation home and observe that a new stack with lambdas appeared
- wait for the stack to be ready
- go to the AWS Lambda Functions and observe 2 AWS functions
- go to the AWS Lambda Functions
- find the
LoadTestDataFunction
function and click on it - run test with any payload e.g. with the empty one:
{}
- the lambda should then load test data into Neptune
- go to the AWS Lambda Functions
- find the
RunAdHocQueryFunction
function and click on it - call lambda (via "Test") with the following payload:
{
"skill1": "Java EE 8",
"skill2": "PostgreSQL",
"skill3": "TDD",
"certificate": "OCP Java SE 8",
"customer": "Big Brother Corporation",
"availableFrom": 1516492800000,
"availableTo": 1516665600000
}
- the response should be:
[
{
"firstName": [
"Bob"
],
"lastName": [
"Smith"
],
"id": [
10
],
"position": [
"software engineer"
]
}
]
- call lambda with another payload:
{
"skill1": "Java EE 8",
"skill2": "PostgreSQL",
"skill3": "TDD",
"certificate": "OCP Java SE 8",
"customer": "Space Logistics AG",
"availableFrom": 1514764800000,
"availableTo": 1517443200000
}
- the response should be:
[
{
"firstName": [
"Alice"
],
"lastName": [
"Brown"
],
"id": [
20
],
"position": [
"senior software engineer"
]
},
{
"firstName": [
"Bob"
],
"lastName": [
"Smith"
],
"id": [
10
],
"position": [
"software engineer"
]
}
]