Closed alancooper-exizent closed 2 months ago
Thanks for opening this issue! Please make sure to provide the following information to help us reproduce the issue:
Thanks for opening this issue. The ticket CLOUDP-243501 was created for internal tracking.
Hi @alancooper-exizent, sorry to hear that you are running into this issue. I've tried to replicate the issue using the same script and it actually worked with the 2.0.0
This is the command I used:
cdk bootstrap aws://AWS_ACCOUNT_ID/ap-northeast-3
cdk deploy \
--context orgId=ORG_ID \
--context continuousBackupEnabled=false \
--context region=EU_WEST_2 \
--context profile=marcosuma \
--context projName=PROJ_NAME \
--context clusterName=CLUSTER_NAME \
--context clusterType=REPLICASET \
--context instanceSize=M10
One thing that @maastha noticed is that your CDK script doesn't match with the CFN script. in the latter you have auto-scaling enabled which instead is false in the CDK script.
Might be possible there is something different that has been done compared to what you described here?
This is the code I used:
// This example creates a project and a cluster in Atlas using the L1 resources.
import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { CfnProject, CfnCluster } from 'awscdk-resources-mongodbatlas';
interface AtlasStackProps {
readonly orgId: string;
readonly profile: string;
readonly projName: string;
readonly clusterName: string;
readonly clusterType: string;
readonly instanceSize: string;
readonly region: string;
}
export class CdkExamplesStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const atlasProps = this.getContextProps();
const projectRes = new CfnProject(this, 'ProjectResource', {
name: atlasProps.projName,
orgId: atlasProps.orgId,
profile: atlasProps.profile
});
const clusterRes = new CfnCluster(this, 'ClusterResource', {
name: atlasProps.clusterName,
projectId: projectRes.attrId,
profile: atlasProps.profile,
clusterType: atlasProps.clusterType,
backupEnabled: true,
pitEnabled: false,
replicationSpecs: [{
numShards: 1,
advancedRegionConfigs: [{
autoScaling: {
diskGb: {
enabled: true,
},
compute: {
enabled: false,
scaleDownEnabled: false,
},
},
analyticsSpecs: {
ebsVolumeType: "STANDARD",
instanceSize: atlasProps.instanceSize,
nodeCount: 3,
},
electableSpecs: {
ebsVolumeType: "STANDARD",
instanceSize: atlasProps.instanceSize,
nodeCount: 3,
},
readOnlySpecs: {
ebsVolumeType: "STANDARD",
instanceSize: atlasProps.instanceSize,
nodeCount: 3,
},
priority: 7,
regionName: atlasProps.region,
}]
}]
});
}
getContextProps(): AtlasStackProps {
const orgId = this.node.tryGetContext('orgId');
if (!orgId){
throw "No context value specified for orgId. Please specify via the cdk context."
}
const projName = this.node.tryGetContext('projName') ?? 'test-proj';
const profile = this.node.tryGetContext('profile') ?? 'default';
const clusterName = this.node.tryGetContext('clusterName') ?? 'test-cluster';
const clusterType = this.node.tryGetContext('clusterType') ?? 'REPLICASET';
const instanceSize = this.node.tryGetContext('instanceSize') ?? "M10";
const region = this.node.tryGetContext('region') ?? "US_EAST_1";
return {
projName,
orgId,
profile,
clusterName,
clusterType,
instanceSize,
region,
}
}
}
Is there an existing issue for this?
CDK package version
3.3.0
CFN Resource version
MongoDB::Atlas::Cluster v2.0.0
CFN Resource Region
eu-west-2
Current Behavior
When I deploy a cluster using the CfnCluster resource in CDK exactly as https://github.com/mongodb/awscdk-resources-mongodbatlas/blob/main/examples/l1-resources/cluster.ts the stack creation fails on creating the cluster itself with the error:
Resource handler returned message: "https://cloud.mongodb.com/api/atlas/v2/groups/661d67652954641210cbb2d1/clusters POST: HTTP 400 Bad Request (Error code: "COMPUTE_AUTO_SCALING_MAX_INSTANCE_SIZE_REQUIRED") Detail: Compute auto-scaling max instance size required. Reason: Bad Request. Params: []" (RequestToken: 6346e8cb-ec23-788c-b345-f53365eaab9d, HandlerErrorCode: InvalidRequest)
AWS CDK code to reproduce the issue
Steps To Reproduce
In AWS EU-WEST-2, running as an IAM role with full admin privileges,
cdk deploy ClusterStack --context orgId="myOrgId" --context profile="bitbucket"
Some resources create OK but the cluster always fails with this 400
cdk synth
Code of Conduct