Skip to content

What is the limit: "Segment value count is larger than limit"

0

Getting the following error while trying to create Segments..

Amazon.Pinpoint.Model.BadRequestException, Message=Segment value count 15000 is larger than limit, Source=AWSSDK.Core

Can't find any information on this Limit, we're tyring to do some initial load testing against a non-Sandboxed Pinpoint instance.

  • The Segment value count of 15000 is larger than the limit error in Amazon Pinpoint indicating that you are exceeding the allowed number of values for a segment attribute.

asked 2 years ago304 views
1 Answer
0

Here’s an example of how you might create smaller segments programmatically to stay within limits:

import boto3

client = boto3.client('pinpoint')

def create_segment(segment_name, attribute_name, attribute_values):
    # Split attribute values into chunks to stay within the limit
    chunk_size = 1000  # Adjust based on your understanding of limits
    chunks = [attribute_values[i:i + chunk_size] for i in range(0, len(attribute_values), chunk_size)]

    for index, chunk in enumerate(chunks):
        segment_response = client.create_segment(
            ApplicationId='your-app-id',
            WriteSegmentRequest={
                'Name': f'{segment_name}_part_{index + 1}',
                'Dimensions': {
                    'Attributes': {
                        attribute_name: {
                            'Values': chunk,
                            'AttributeType': 'INCLUSIVE'
                        }
                    }
                }
            }
        )
        print(f'Segment {segment_name}_part_{index + 1} created: {segment_response}')

# Example usage
create_segment('MySegment', 'CustomAttribute', ['value1', 'value2', ... up to 15000 values ...])

answered 2 years ago
  • what is the limit though it seems to possibly be adaptive! Is there documentation for this limit?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.