
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@casechek/aws-cdk-elasticsearch-index
Advanced tools
Elasticsearch Index Custom Resource for AWS CDK
This construct allows you to deploy an elasticsearch index and all its settings and mappings within a stack.
Install the package in your CDK application.
npm install @casechek/aws-cdk-elasticsearch-index
This is currently in the experimental stage over at AWS; however, it is the easiest way to setup a basic Elasticsearch cluster.
// in your stack constructor
import {CfnDomain} from '@aws-cdk/aws-cdk-elasticsearch-index';
const elasticsearchDomain = new CfnDomain(
this,
'ElasticsearchDomain',
{
accessPolicies: {
Version: '2012-10-17',
Statement: [
{
Effect: 'Allow',
Principal: {
AWS: '*',
},
Action: 'es:*',
Resource: `arn:aws:es:${this.region}:${this.account}:domain/${this.stackName}/*`,
},
],
},
ebsOptions: {
ebsEnabled: true,
volumeSize: 20,
volumeType: 'standard',
},
elasticsearchClusterConfig: {
instanceCount: 1,
instanceType: 't2.medium.elasticsearch',
},
domainName: this.stackName,
encryptionAtRestOptions: {
enabled: false,
},
nodeToNodeEncryptionOptions: {
enabled: true,
},
vpcOptions: {
securityGroupIds: [securityGroupIdFromSomewhere],
subnetIds: [privateSubnetIdFromSomewhere],
},
elasticsearchVersion: '7.1',
}
);
The construct
import {ElasticsearchIndex} from 'aws-cdk-elasticsearch-index'
const es = new ElasticsearchIndex(this, 'ElasticsearchIndex', {
mappingJSONPath: PATH_TO_A_JSON_FILE_CONTAINING_FULL_INDEX_CONFIGURATION,
elasticSearchIndex: NAME_OF_THE_INDEX_TO_CREATE,
elasticSearchEndpoint: FULL_URL_TO_THE_ELASTICSEARCH_ENDPOINT_INCLUDING_SCHEME,
vpc: VPC_OF_YOUR_ELASTIC_SEARCH_DOMAIN, // If you want to host the lambda functions responsible for resource creation in your vpc
policyArn: elasticsearchDomain.attrArn, // where elasticSearch domain is your elasticsearch CDK construct instance, only required if you are using AWS Elasticsearch
});
It's helpful to be able to test a change you're working on in your own project's stack. To do that with a working branch of this repo, here are some tips:
Note: This is assuming you have aws-cdk-elasticsearch-index
and some my_project
project directory in 2 folders in ~/dev/
.
my_project
's package.json
, set "@casechek/aws-cdk-elasticsearch-index": "../aws-cdk-elasticsearch-index",
for the dependency versionnpm install
in my_project
(maybe npm ci
is needed for a clean install)npm install
in aws-cdk-elasticsearch-index
then run npm run build
node_modules
directory (run rm -rf node_modules
) in aws-cdk-elasticsearch-index
ln -s ../my_project/node_modules
in aws-cdk-elasticsearch-index
With this, you should be able to deploy your project's stack, and it will be using your modified custom construct.
Note: Don't forget to remove the symlink if you're going through various npm installs, or you'll run into a stack memory issue. In order
to do that, you can delete ./node_modules
.
git clone git@github.com:incompass/aws-cdk-elasticsearch-domain
To help contributing to this project, a docker-compose
configuration is provided that includes:
on-event
lambda functiondocker-compose up
This package includes both jest and cucumber-js tests. Jest is used for unit testing the lambda functions and for testing the cdk stack using the AWS supplied helpers. Cucumber is used for e2e testing the lambda functions. All contributions must include relevant tests.
npm run test
You need to start the docker-compose
stack before running the end to end tests. In one terminal, run:
docker-compose up
In another window, set the appropriate environment variables and run cucumber:
AWS_ENDPOINT=http://localhost \
AWS_REGION=us-east-1 \
S3_ENDPOINT=http://localhost:1080 \
ON_EVENT_PORT=9001 \
ON_EVENT_S3_BUCKET_NAME=test-bucket \
ON_EVENT_S3_OBJECT_KEY=test-object-key \
ON_EVENT_INDEX=test-index \
ELASTICSEARCH_ENDPOINT=http://localhost:9200 \
ELASTICSEARCH_INDEX=test-index \
npm run cucumber -- --tags=@on-event
$env:AWS_ENDPOINT='http://localhost';
$env:AWS_REGION='us-east-1';
$env:S3_ENDPOINT='http://localhost:1080';
$env:ON_EVENT_PORT='9001';
$env:ON_EVENT_S3_BUCkET_NAME='test-bucket';
$env:ON_EVENT_S3_OBJECT_KEY='test-object-key';
$env:ON_EVENT_INDEX='test-index';
$env:ELASTICSEARCH_ENDPOINT='http://localhost:9200';
$env:ELASTICSEARCH_INDEX='test-index';
npm run cucumber -- --tags=@on-event
This package uses the conventional commit message format. All PRs will be squashed and merged.
npm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testsnpm run cucumber
perform the cucumber e2e testsFAQs
Elasticsearch Index Custom Resource for AWS CDK
We found that @casechek/aws-cdk-elasticsearch-index demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.