Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReservedConcurrentExecutions Removed #325

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added AWS Neptune to Opensearch.docx
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,7 @@
},
"MemorySize": 128,
"Runtime": "python3.9",
"Timeout": "30",
"ReservedConcurrentExecutions": 1
"Timeout": "30"
}
},
"KinesisToElasticSearchLambda": {
Expand Down Expand Up @@ -654,15 +653,15 @@
"STREAM_NAME": {
"Ref": "KinesisStream"
},
"ELASTIC_SEARCH_ENDPOINT": {
"Ref": "ElasticSearchEndpoint"
},
"log_commit_nums": "false"
}
},
"MemorySize": 1024,
"Runtime": "python3.9",
"Timeout": "900",
"ReservedConcurrentExecutions": {
"Ref": "KinesisShardCount"
},
"VpcConfig": {
"SecurityGroupIds": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,61 @@
import boto3
import logging
from datetime import datetime
from opensearchpy import OpenSearch, RequestsHttpConnection, AWSV4SignerAuth

client = boto3.client('batch')

logger = logging.getLogger()
logger.setLevel(logging.INFO)

def pre_trigger():
# clears `amazon_neptune` indices before we run rest of the job
print("Started PreTrigger Job")
host = os.environ['ELASTIC_SEARCH_ENDPOINT'] # cluster endpoint, for example: my-test-domain.us-east-1.es.amazonaws.com
region = os.environ['AWS_REGION']
service = 'es'
credentials = boto3.Session().get_credentials()
auth = AWSV4SignerAuth(credentials, region, service)

client = OpenSearch(
hosts = [{'host': host, 'port': 443}],
http_auth = auth,
use_ssl = True,
verify_certs = True,
connection_class = RequestsHttpConnection,
pool_maxsize = 20
)

logger.info("Listing Indices Now")
response = client.indices.get_alias("*")
logger.info(response)

logger.info("Creating Index Now")
index_name = "amazon_neptune"
index_body = {
"settings": {
"number_of_shards": 3,
"number_of_replicas": 2,
},
}
response = client.indices.create(index=index_name, body=index_body)
logger.info(response)

logger.info("Listing Indices Now")
response = client.indices.get_alias("*")
logger.info(response)

logger.info("Deleting Index Now")
response = client.indices.delete(index="your_index_name")
logger.info(response)

logger.info("Listing Indices Now")
response = client.indices.get_alias("*")
logger.info(response)

def trigger_neptune_export():

pre_trigger()
neptune_export_jar_uri = os.environ['NEPTUNE_EXPORT_JAR_URI']
neptune_endpoint = os.environ['NEPTUNE_ENDPOINT']
neptune_port = os.environ['NEPTUNE_PORT']
Expand Down
29 changes: 21 additions & 8 deletions export-neptune-to-elasticsearch/lambda/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
protobuf==3.18.3
six==1.16.0
aws-kinesis-agg==1.1.7
cachetools==5.3.1
certifi==2023.5.7
charset-normalizer==3.1.0
distlib==0.3.6
elasticsearch==6.4.0
filelock==3.12.2
idna==3.4
isodate==0.6.1
jmespath==1.0.1
opensearch-py==2.2.0
platformdirs==3.7.0
protobuf==3.18.3
pyparsing==3.1.0
python-dateutil==2.8.2
rdflib==6.2.0
retrying
requests
requests_aws4auth
cachetools
certifi
aws-kinesis-agg==1.1.7
requests==2.31.0
requests-aws4auth==1.2.3
retrying==1.3.4
s3transfer==0.6.1
six==1.16.0
urllib3==1.26.16
virtualenv==20.23.1