by Mo Miah and Jack Tilson on 01 OCT 2025 in Advanced (300), Amazon Connect, Technical How-to | Permalink | Share
Contact centers, particularly at Business Process Outsourcing (BPO) companies, operate multiple lines of business (LOB) with diverse regulatory or contractual requirements for contact recording retention.
Failure to comply with industry regulations or contractual obligations can result in fines, legal disputes, and reputational damage. Conversely, retaining contact recordings beyond the required period can lead to unnecessary storage costs and potential data privacy concerns.
Organizations must meet their compliance obligations while optimizing operational costs.
In this blog post, you will learn how you can apply multiple retention policies for contact recordings across LOBs within a single Amazon Connect instance.
Amazon Connect provides native contact recording capabilities, enabling customers to record conversations between their agents and customers securely. These recordings are stored in an Amazon S3 bucket created specifically for your instance. Amazon S3 Lifecycle configuration can manage the lifecycle of these recordings. This enables you to define expiration rules for objects that automatically delete expired recordings in Amazon S3 on your behalf.
In this solution, a custom contact attribute within the Amazon Connect Flow specifies the desired retention period for each contact. This contact attribute is then streamed to Amazon Kinesis, along with the rest of the Contact record, invoking an AWS Lambda function. The Lambda function uses the object tagging feature of Amazon S3 to tag the recording objects based on the specified contact attribute value. Consequently, the recording objects are set to expire according to their respective tags, following the predefined S3 Lifecycle rules configured for the bucket.
With this approach, you can implement customized retention policies for contact recordings to comply with data retention regulations, minimize storage costs, and optimize resource utilization.

Image 1 – Architecture diagram
retention is attached to the contact within the contact flow—the attribute value (short, long) assigned depending on the LOB.retention attribute (short, long) of the contact record.During this blog, we will deploy:
This architecture will fit into an existing Amazon Connect instance of your choice, and corresponding Amazon S3 contact recording bucket.
Validate that you have the relevant permissions to perform the tasks in this guide. If you encounter access rights issues, contact your AWS administrator to align the required permissions to your role.
As an outline, the following actions should be available to you within the AWS account where your Amazon Connect instance is deployed:
You can benefit from this guide irrespective of whether you have an Amazon Connect instance created already, or are getting started for the first time.
The following steps assume that you have an AWS account and an existing Amazon Connect instance. To create a new Amazon Connect instance, follow the steps in Lab 1 of the Getting Started with Amazon Connect Workshop. If you need an AWS account, follow the prerequisite steps.
A CloudFormation template can be written in JSON or YAML format, and represents a means of Infrastructure as Code (IaC) on AWS. The CloudFormation template for this guide can be downloaded by clicking the following button.
[Button to download CloudFormation template]
You will be greeted by a form from the CloudFormation service. Provide the Stack name with a descriptive name. These parameters align the template to your specific Amazon Connect instance and recordings bucket.

We will capture and note the information required for the next step.
a) BasicQueueId




b) ConnectInstanceID

ConnectInstanceId field in your other tab containing the CloudFormation template parameter input form.c) KinesisDataStreamName
d) RecordingBucketName


RecordingBucketName field in your other tab containing the CloudFormation template parameter input form.Upon gathering all preceding items, populate the CloudFormation template parameter form.


NOTE: Amazon Connect supports sending CTR data to a single Kinesis Data Stream only. If you are already sending CTR data to a Kinesis Data Stream, you may update the event trigger configuration within the
TagS3ObjectLambda function to be invoked when streaming records arrive in your incumbent Kinesis Data Stream. This avoids using the stream named “multiple-retention-ctr” from the template. This will make the Lambda function another consumer of your existing stream, without disrupting established workloads reliant upon Kinesis streams. Following this, please proceed directly to the Usage Validation section.
If you have not configured CTR streaming from the instance, continue along this section to do so.
The Amazon Connect Instance should be configured to send Contact Trace Records (CTR) data to the “multiple-retention-ctr” Kinesis Data Stream. This can be achieved by visiting the “Data streaming” section of the Amazon Connect Instance configuration screen in the AWS Management Console.
There is no additional configuration needed at the Contact Flow or Queue level to make this streaming behavior occur. It is an instance-level setting.


The following image shows the contact attribute assignment for contacts (in the following example, callers that have pressed option 1 are assigned short retention).
\
\
This code extracts the value of the retention attribute and creates a tag with key ‘retention’ and value obtained from ‘retentionvalue’, applies the tag to the Amazon S3 Object using ‘PutObjectTagging’ API.
At this stage, the solution should be ready for you to use and apply to your contact flows by setting the retention contact attribute where desired in your implementation.
Now that we have validated the deployment and understood each component, we can now try a test contact.
This step associates the Contact Flow deployed by the CloudFormation template to the phone number for testing the solution.



Try it out – you can press 1 or 2 to set the retention length. In this scenario, we pressed 1 for a short retention policy. The contact will then come through to the BasicQueue within Amazon Connect.
Now that we have disconnected the contact, we can inspect the Amazon S3 object to ensure that it is showing the expected tags. Please note, it may take a few minutes for the tags to be reflected.

retention tag will be present, with its value either being “long” or “short” depending on the option selected (and therefore contact attribute set) during the test contact.
This indicates a successful test. The contact attribute was set correctly, and the CTR record streamed to the Lambda function that led to the contact recording being tagged appropriately. The S3 Lifecycle Policy will now delete the recording at the right time without user intervention. For more information on S3 Lifecycle Policies, click here.Note: It is not necessary to select the recording retention policy via the IVR. Each flow can be configured via the Contact Flow designer to set the appropriate contact attribute silently in the background, using the Set Contact Attributes block.
To roll back the CloudFormation template deployment, there are two aspects. This will clean up the resources created during this guide.
Navigate to the CloudFormation template deployed as part of this blog, and delete the stack. This step should successfully delete the IAM, Lambda, and Kinesis Data Streams resources. The only exception to this should be the example Contact Flow, which we will tackle in the next step.
To minimize the risk of accidental disruption to the Contact Centre, it is not possible to delete Contact Flows from CloudFormation. To remove this, we can simply step into the Amazon Connect instance with a user holding the appropriate Security Profile, and archive the flow.
The Kinesis Stream will automatically unassign itself from the Data streaming configuration of the Amazon Connect Instance upon deletion of that Kinesis Stream in the previous step.
There are no charges associated with storing Contact Flows, thus archiving will not leave any residual cost over deletion.
At this stage, all resources involved in the preceding activities (except any contact recordings generated) will be cleaned up.
Implementing multiple call contact recording retention policies within a single Amazon Connect instance offers significant business benefits. By leveraging Amazon Connect and AWS Services, organizations can achieve a balance between compliance and cost-effectiveness.
This approach streamlines operations, ensures data privacy, and provides the flexibility to adapt to evolving business requirements. The result is a seamless, customized solution that optimizes costs and maintains regulatory compliance, all within a single, scalable platform.