Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

355
Views
How can I improve the Performance (response time) for the AWS Encryption SDK on decrypt

I have an AWS Lambda that is used to encrypt PII (Personal Identifying Information) using the AWS Encryption SDK before storing it in DynamoDB.

When retrieving the data from DynamoDB using a different Lambda to display to end users, the average time for each call to KMS is 9.48sec. This is averaged across roughly 2k requests with requests ranging from ~14.5 seconds to ~5.1 seconds. The calls to KMS are being made asynchronously.

The total time from the first KMS call to the last is ~20 seconds

We have considered using data key caching and read this AWS blog post about when to use it.

The input of our data may not be frequent enough to take full advantage of caching, and I am trying to find other ways to improve the performance.

Decrypt Code Sippet:

async function decryptWithKeyring(keyring: KmsKeyringNode, ciphertext: string, context: {}) {
    const b: Buffer = Buffer.from(ciphertext, 'base64');
    const { plaintext, messageHeader } = await decrypt(keyring, b);
    const { encryptionContext } = messageHeader;
    Object.entries(context).forEach(([key, value]) => {
        if (encryptionContext[key] !== value) {
            throw new Error('Encryption Context does not match expected values');
        }
    });
    return plaintext.toString();
}

Encrypt Snippet:

async function encryptWithKeyring(keyring: KmsKeyringNode, value: any, context: any) {
    const { result } = await encrypt(keyring, value, { encryptionContext: context });
    return result.toString('base64');
}

The conversion to base64 was to facilitate storing in DynamoDB.

XRay Trace Map Sampling of KMS Trace data

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!