You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@mongodbatlas-awscdk/atlas-basic-private-endpoint

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mongodbatlas-awscdk/atlas-basic-private-endpoint

Creates a project, cluster, dbuser, private endpoint and adds an IP entry to the access list in MongoDB Atlas

1.1.6
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

@mongodbatlas-awscdk/atlas-basic-private-endpoint

This package is now deprecated and will no longer receive new features. Use awscdk-resource-mongodbatlas instead.

The official MongoDB Atlas AWS CDK resource for Node.js.

This construct uses MongoDB Level 1 construct and data structures for the AWS CloudFormation Registry Level 3 type.

Description

Creates a MongoDB Atlas Project, Cluster, DBuser, Private Endpoint and adds an IP entry to the IP Access List.

MongoDB Atlas API Docs

For more information for each of the specific APIs used in this Level 3 AWS CDK resource please refer to: Official Documentation

Usage

In order to use this library, you will need to activate this AWS CloudFormation Registry type in your account. You can do this via the AWS Management Console or using the AWS CLI using the following command:

aws cloudformation activate-type \
  --type-name MongoDB::Atlas::Cluster \
  --publisher-id bb989456c78c398a858fef18f2ca1bfc1fbba082 \
  --type RESOURCE \
  --execution-role-arn ROLE-ARN
  
aws cloudformation activate-type \
  --type-name MongoDB::Atlas::Project \
  --publisher-id bb989456c78c398a858fef18f2ca1bfc1fbba082 \
  --type RESOURCE \
  --execution-role-arn ROLE-ARN

aws cloudformation activate-type \
  --type-name MongoDB::Atlas::DatabaseUser \
  --publisher-id bb989456c78c398a858fef18f2ca1bfc1fbba082 \
  --type RESOURCE \
  --execution-role-arn ROLE-ARN  

aws cloudformation activate-type \
  --type-name MongoDB::Atlas::ProjectIpAccessList \
  --publisher-id bb989456c78c398a858fef18f2ca1bfc1fbba082 \
  --type RESOURCE \
  --execution-role-arn ROLE-ARN  
  
aws cloudformation activate-type \
  --type-name MongoDB::Atlas::PrivateEndpoint \
  --publisher-id bb989456c78c398a858fef18f2ca1bfc1fbba082 \
  --type RESOURCE \
  --execution-role-arn ROLE-ARN

Minimal configuration to use this construct

import * as cdk from 'aws-cdk-lib';
import { AtlasBasicProps } from "@mongodbatlas-awscdk/atlas-basic";
import {AtlasBasicPrivateEndpoint, PrivateEndpointProps} from "./index";

const app = new cdk.App();

const stack = new cdk.Stack(app, 'atlas-basic-default', {
    env: { region: process.env.CDK_DEFAULT_REGION, account: process.env.CDK_DEFAULT_ACCOUNT },
});


const orgId = stack.node.tryGetContext('MONGODB_ATLAS_ORG_ID') || process.env.MONGODB_ATLAS_ORG_ID;
const vpcId = stack.node.tryGetContext('AWS_VPC_ID') || process.env.AWS_VPC_ID;
const subnetId = stack.node.tryGetContext('AWS_SUBNET_ID') || process.env.AWS_SUBNET_ID;
const awsRegion = stack.node.tryGetContext('AWS_REGION') || process.env.AWS_REGION;

const replicationSpecs = [
    {
        numShards: 1,
        advancedRegionConfigs: [
            {
                analyticsSpecs: {
                    ebsVolumeType: 'STANDARD',
                    instanceSize: 'M10',
                    nodeCount: 1,
                },
                electableSpecs: {
                    ebsVolumeType: 'STANDARD',
                    instanceSize: 'M10',
                    nodeCount: 3,
                },
                priority: 7,
                regionName: 'US_EAST_1',
            },
        ],
    },
];

const atlasBasicProps : AtlasBasicProps = {
    clusterProps: {
        replicationSpecs: replicationSpecs,
    },
    projectProps: {
        orgId: orgId,
    },
    ipAccessListProps : {
        accessList: [
            {
                ipAddress: '10.10.0.0/24',
                comment: 'Open Subnets',
            },
        ],
    }
}

const privateEndpointProps : PrivateEndpointProps = {
    privateEndpoints: [{
        vpcId: vpcId,
        subnetIds: [subnetId]
    }],
}

const props   = {
    apiKeys: apiKeys,
    atlasBasicProps: atlasBasicProps,
    privateEndpointProps: privateEndpointProps,
    region: awsRegion
}

new AtlasBasicPrivateEndpoint(stack,'private-endpoint', props)

The library also defines some default values for individual L1s.


const projectDefaults = {
        projectName: 'atlas-project-{random_num}',
    };

const dbDefaults = {
    dbName: 'admin',
    username: 'atlas-user',
    password: 'atlas-pwd',
    roles: [{
        roleName: 'atlasAdmin',
        databaseName: 'admin',
    }],
}
const clusterDefaults = {
    clusterName: 'atlas-cluster-{random_num}',
    clusterType: 'REPLICASET',
}

Default Region is set to us-east-1 region (AWS US East N. Virginia)

You can find more information about activating this type in the AWS CloudFormation documentation.

Feedback

  • Issues related to this generated library should be reported here.
  • Issues related to this library should be reported to the publisher.
  • Feature requests should be reported here

License

Distributed under the Apache-2.0 License.

Keywords

atlas

FAQs

Package last updated on 17 Apr 2023

Did you know?

Socket

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.

Install

Related posts