Question: How do I troubleshoot the error "Status Code: 400; Error Code: xxx" when using CloudFormation for ElastiCache?

When invoking my AWS CloudFormation stack or using the AWS API call for Amazon ElastiCache, the request fails and I receive the following error:"Status Code: 400; Error Code: xxx"How do I troubleshoot this error?Short descriptionWhen you start an AWS API request directly or using a CloudFormation stack, AWS performs initial syntax checks. These checks verify that the request is complete and has all mandatory parameters. The following are common reasons the 400 error occurs when you send an API request for Amazon ElastiCache:Your request was denied because of API request throttling.AWS doesn't have enough available capacity to complete your request.The cache node isn't support in the Region or Availability Zone specified in your request.You used an invalid parameter combination.You used an invalid or out-of-range value for the input parameter.The API is missing a required parameter or action.You're trying to remove a resource currently used by another ElastiCache resource or AWS service.

ResolutionIdentify the specific ElastiCache Invoke API error that you received. Then, follow the troubleshooting steps listed for that error.Note: For a list of possible errors and their descriptions, see Common errors in the ElastiCache Invoke API Reference.Error Code: ThrottlingError: "Rate exceeded (Service: AmazonElastiCache; Status Code: 400; Error Code: Throttling; Request ID: xxx)"This error means that your request was denied due to API request throttling. These account-level API call limits aren't specific to any service.Note: You can't increase or modify limits for a particular call. AWS makes sure that API calls don't exceed the maximum allowed API request rate. This includes API calls that come from an application, are a call to a command line interface or to the AWS Management Console.Avoid this error using the following methods:Retry your call with exponential backoff and jitter.Distribute your API calls evenly over time rather than making several API calls in a short time span.Error Code: InsufficientCacheClusterCapacityError: "cache.xxx (VPC) is not currently supported in the availability zone xxx. Retry the launch with no availability zone or target: xxx. (Service: AmazonElastiCache; Status Code: 400; Error Code: InsufficientCacheClusterCapacity; Request ID: xxx)".This error indicates that AWS doesn't currently have enough available On-Demand capacity to complete your request. For more information, see Error Messages: InsufficidentCacheClusterCapacity.If you receive this error, do the following:Wait a few minutes and then submit your request again. Capacity shifts frequently.Use another cache node type and then submit your request again.Use another subnet and Availability Zone and then submit your request again.Error Code: SubnetInUseError: "The subnet ID subnet-xxx is in use (Service: AmazonElastiCache; Status Code: 400; Error Code: SubnetInUse; Request ID: xxx)".This error occurs if you try to remove a subnet from an Elasticache subnet group that currently has instances associated with it. You must remove all related resources from the subnet and then submit your request again. For more information, see DeleteCacheSubnetGroup.Error Code: InvalidParameterValueThis error indicates that a parameter value isn't valid, is unsupported, or can't be used in your request. Check each parameter for your request call. For example, If you've used an unsupported parameter value, you might see one of the following error messages:"Invalid AuthToken provided. (Service: AmazonElastiCache; Status Code: 400; Error Code: InvalidParameterValue"; Request ID: xxx)".This error indicates that the auth-token setting doesn't meet constraints when using AUTH with ElastiCache for Redis. For more information, see Authenticating users with the Redis AUTH command."The snapshot window and maintenance window must not overlap. (Service: AmazonElastiCache; Status Code: 400; Error Code: InvalidParameterValue; Request ID: xxx)".Snapshot windows and maintenance windows can't set up at the same time. Adjust the operation window to another period to avoid this error."The number of replicas per node group must be within 0 and 5. (Service: AmazonElastiCache; Status Code: 400; Error Code: InvalidParameterValue; Request ID: xxx)".ElastiCache Redis supports one primary and from 0 to 5 replicas per shard. If you add more than 5 replica nodes, you receive this error. For more information, see Understanding Redis replication.Error Code: InvalidParameterCombinationThis error indicates that your request call contains an incorrect combination of parameters or a missing parameter. If this occurs, you might see one of the following error messages:"Cannot find version 5.0.0 for redis (Service: AmazonElastiCache; Status Code: 400; Error Code: InvalidParameterCombination; Request ID: xxx)".This error indicates that the version of Redis indicated in your request call isn't supported. For more information, see Supported ElastiCache for Redis verisons and Supported ElastiCache for Memcached versions."Cannot restore redis from 6.0.5 to 5.0.6. (Service: AmazonElastiCache; Status Code: 400; Error Code: InvalidParameterCombination; Request ID: xxx)".ElastiCache for Redis doesn't support downgraded Redis engine versions when using a backup to create a new Redis cluster. ElastiCache for Redis also doesn't support downgrading the Redis engine on a running Redis cluster. When creating a new Redis cluster using a backup, the Redis engine version must be greater than or equal to the current engine version."When using automatic failover, there must be at least 2 cache clusters in the replication group. (Service: AmazonElastiCache; Status Code: 400; Error Code: InvalidParameterCombination; Request ID: xxx)".You can turn on the automatic failover option in a Redis cluster that has at least one available read replica on it. Verify that your Redis replication group has more than one replica node and then submit your request again. For more information, see Minimizing downtime in ElastiCache for Redis with Multi-AZ.

Related informationQuotas for ElastiCacheAmazon ElastiCache error messagesTroubleshooting - Amazon ElastiCache for RedisTroubleshooting AWS CLI errors