<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Yusuf Ishola</title>
    <description>The latest articles on DEV Community by Yusuf Ishola (@ollycare).</description>
    <link>https://dev.to/ollycare</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2663635%2F824cdd48-b00b-4983-aada-27620be2f212.png</url>
      <title>DEV Community: Yusuf Ishola</title>
      <link>https://dev.to/ollycare</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ollycare"/>
    <language>en</language>
    <item>
      <title>Optimising Cloud Costs and Security: With Scientific Research Platform Using AWS Manager Store</title>
      <dc:creator>Yusuf Ishola</dc:creator>
      <pubDate>Sat, 26 Apr 2025 06:40:11 +0000</pubDate>
      <link>https://dev.to/ollycare/optimising-cloud-costs-and-security-with-scientific-research-platform-using-aws-manager-store-3ikc</link>
      <guid>https://dev.to/ollycare/optimising-cloud-costs-and-security-with-scientific-research-platform-using-aws-manager-store-3ikc</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0qqt9yr5nagh46ypfdy7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0qqt9yr5nagh46ypfdy7.png" alt="Image description" width="800" height="498"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In today’s cloud-driven world, managing sensitive credentials securely while keeping costs in check presents a significant challenge for organisations. Our recent publishers project demonstrates how thoughtful implementation of AWS services can achieve both goals. This article explores how we leveraged &lt;strong&gt;AWS Secrets Manager&lt;/strong&gt; and &lt;strong&gt;AWS Systems Manager Parameter Store&lt;/strong&gt; to securely manage database credentials and API keys while optimising cloud expenditure for our green technology research platform.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Publishers Project: Architecture and Requirements
&lt;/h2&gt;

&lt;p&gt;Our publishers project is a comprehensive platform that retrieves scientific articles about green technology from multiple publisher’s researcher using their respective APIs. The workflow follows these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Lambda functions&lt;/strong&gt; query publisher &lt;strong&gt;APIs&lt;/strong&gt; using specific keywords.&lt;/li&gt;
&lt;li&gt;Retrieved articles are processed and uploaded to &lt;strong&gt;Amazon S3 buckets&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Article &lt;strong&gt;Metadata&lt;/strong&gt; is inserted into a &lt;strong&gt;PostgreSQL database&lt;/strong&gt; for indexing and research.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Step Functions&lt;/strong&gt; orchestrate the entire workflow to avoid Lambda timeouts&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This data pipeline requires secure management of two types of sensitive information:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Database credentials for PostgreSQL&lt;/li&gt;
&lt;li&gt;Multiple publisher-specific API keys&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Understanding AWS Secrets Management Options in Depth
&lt;/h2&gt;

&lt;p&gt;AWS offers two primary services for managing sensitive information, each with distinct capabilities and cost profiles. Understanding their similarities and differences is crucial for optimal implementation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fngzd7azljr58ar61apbj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fngzd7azljr58ar61apbj.png" alt="Image description" width="800" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWS Secrets Manager:&lt;/strong&gt; AWS Secrets Manager helps you manage, retrieve, and rotate database credentials, application credentials, OAuth tokens, API keys, and other secrets throughout their lifecycles. Many AWS services store and use secrets in Secrets Manager.&lt;/p&gt;

&lt;p&gt;Secrets Manager helps you improve your security posture, because you no longer need hard-coded credentials in application source code. Storing the credentials in Secrets Manager helps avoid possible compromise by anyone who can inspect your application or the components. You replace hard-coded credentials with a runtime call to the Secrets Manager service to retrieve credentials dynamically when you need them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWS Systems Manager:&lt;/strong&gt; AWS Systems Manager helps you centrally view, manage, and operate nodes at scale in AWS, on-premises, and multi-cloud environments. With the launch of a unified console experience, Systems Manager consolidates various tools to help you complete common node tasks across AWS accounts and Regions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Parameter Store:&lt;/strong&gt; Parameter Store, a tool in AWS Systems Manager, provides secure, hierarchical storage for configuration data management and secrets management. You can store data such as passwords, API keys, database strings, Amazon Machine Image (AMI) IDs, and license codes as parameter values. You can store values as plain text or encrypted data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Similarities Between Secrets Manager and Parameter Store
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Encryption Capabilities&lt;/strong&gt;&lt;br&gt;
Both services leverage &lt;strong&gt;AWS KMS&lt;/strong&gt; to encrypt values, providing an additional security layer beyond &lt;strong&gt;IAM permissions&lt;/strong&gt;. This encryption is essential for compliance requirements and protecting sensitive information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key/Value Store Structure&lt;/strong&gt;&lt;br&gt;
Both implement a key/value store model, allowing values to be organised with prefix schemas like &lt;code&gt;application/environment/parametername&lt;/code&gt;. In our research platform, we organise our parameters logically:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/publisher/green-technology/api-key
/publisher/climate-chnage/api-key
/publisher/global-warming/api-key
/publisher/Sustainable-development/api-key
/publisher/clean-energy/api-key
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CloudFormation Integration&lt;/strong&gt;&lt;br&gt;
Both services integrate with CloudFormation, enabling infrastructure-as-code without embedding secrets in templates. This allows our &lt;strong&gt;CI/CD pipeline&lt;/strong&gt; to reference secure values rather than hardcoding them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Versioning Support&lt;/strong&gt;&lt;br&gt;
Both services maintain version history of secrets, allowing you to track changes and restore previous values if needed. This provides an audit trail of credential modifications.&lt;/p&gt;
&lt;h2&gt;
  
  
  AWS Secrets Manager
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;AWS Secrets Manager&lt;/strong&gt; is a specialised service designed specifically for high-security storage of sensitive credentials with advanced features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Automatic secret rotation:&lt;/strong&gt; Automatically updates credentials on a schedule.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-account access:&lt;/strong&gt; Shares secrets across multiple AWS accounts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fine-grained permissions:&lt;/strong&gt; Controls access through IAM policies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integration with AWS services:&lt;/strong&gt; Seamlessly works with RDS, Redshift, and other services.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Higher cost:&lt;/strong&gt; $0.40 per secret per month + $0.05 per 10,000 API calls.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Larger storage capacity:&lt;/strong&gt; Can store secrets up to 10KB in size.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multiple region replication:&lt;/strong&gt; Enables disaster recovery and multi-region applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Service limits:&lt;/strong&gt; Supports up to 500,000 secrets per region per account.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  AWS Systems Manager Parameter Store
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Parameter Store&lt;/strong&gt; provides hierarchical configuration data management with tiered pricing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Free standard tier:&lt;/strong&gt; Stores up to 10,000 parameters at no cost.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hierarchical organisation:&lt;/strong&gt; Uses path-like structures for better organisation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optional encryption:&lt;/strong&gt; Can use AWS KMS for sensitive parameters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No automatic rotation:&lt;/strong&gt; Requires manual management of parameter updates.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lower cost:&lt;/strong&gt; Free for standard parameters, $0.05 per 10,000 API calls for advanced tier.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Storage limitations:&lt;/strong&gt; 4KB for standard parameters, 8KB for advanced parameters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No built-in cross-region replication:&lt;/strong&gt; Requires custom implementation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Service limits:&lt;/strong&gt; 10,000 standard parameters per region per account.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Our Cost-Optimised Implementation Strategy
&lt;/h2&gt;

&lt;p&gt;After analysing our requirements, we implemented a hybrid approach using both services strategically:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Database Credentials in AWS Secrets Manager&lt;/strong&gt;&lt;br&gt;
We store PostgreSQL database credentials in AWS Secrets Manager because:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Database credential rotation:&lt;/strong&gt; Secrets Manager can automatically rotate database credentials, reducing security risks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Single point of access:&lt;/strong&gt; Our application only retrieves database credentials during initialisation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IAM integration:&lt;/strong&gt; Secrets Manager integrates directly with our RDS instance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Critical security:&lt;/strong&gt; Database access requires the highest level of protection.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The implementation in our Lambda functions uses the following approach:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def get_db_credentials():
    secret_name = "publishers_db_credentials"
    region_name = "eu-west-2"
    session = boto3.session.Session()
    client = session.client(service_name='secretsmanager', region_name=region_name)
    try:
        get_secret_value_response = client.get_secret_value(SecretId=secret_name)
        secret = json.loads(get_secret_value_response['SecretString'])
        return {
            "host": secret["postgresql"]["host"],
            "port": secret["postgresql"]["port"],
            "dbname": secret["postgresql"]["dbname"],
            "user": secret["postgresql"]["user"],
            "password": secret["postgresql"]["password"]
        }
    except ClientError as e:
        print(f"Error retrieving secret: {e}")

        raise
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbca9w1eu2919ffagk1v8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbca9w1eu2919ffagk1v8.png" alt="Image description" width="800" height="182"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  API Keys in AWS Systems Manager Parameter Store
&lt;/h2&gt;

&lt;p&gt;We store the publisher API keys in Parameter Store because:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Higher retrieval frequency:&lt;/strong&gt; Our Lambda functions retrieve API keys for every article request.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multiple distinct keys:&lt;/strong&gt; We manage five different publisher API keys.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hierarchical organisation:&lt;/strong&gt; We organise keys by publisher in a structured hierarchy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost efficiency:&lt;/strong&gt; Parameter Store’s free tier significantly reduces operational costs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Adequate security:&lt;/strong&gt; Parameter Store provides sufficient encryption for API keys.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Our implementation uses a clear hierarchical structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def get_springer_api_key():
    ssm = boto3.client('ssm')
    try:
        response = ssm.get_parameter(
            Name='publisher/green-technology/api-key',
            WithDecryption=True
        )
        return response['Parameter']['Value']
    except ClientError as e:
        raise Exception(f"Failed to retrieve Climate Change API key: {str(e)}")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Cost Analysis: The Financial Impact of Our Strategy&lt;/strong&gt;&lt;br&gt;
Let’s analyse the cost implications of our approach:&lt;/p&gt;
&lt;h2&gt;
  
  
  Scenario 1: Everything in Secrets Manager
&lt;/h2&gt;

&lt;p&gt;If we stored all credentials (&lt;strong&gt;1 database secret + 5 API keys&lt;/strong&gt;) in AWS Secrets Manager:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;6 secrets × $0.40&lt;/strong&gt; per month = &lt;strong&gt;$2.40&lt;/strong&gt; per month.&lt;/li&gt;
&lt;li&gt;Assuming 1 million API calls per month: (&lt;strong&gt;1,000,000 ÷ 10,000&lt;/strong&gt;) × &lt;strong&gt;$0.05&lt;/strong&gt; = $5.00 per month.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Total: $7.40&lt;/strong&gt; per month.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Scenario 2: Our Hybrid Approach
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Database credentials in Secrets Manager: &lt;strong&gt;1 secret&lt;/strong&gt; × &lt;strong&gt;$0.40&lt;/strong&gt; = &lt;strong&gt;$0.40&lt;/strong&gt; per month.&lt;/li&gt;
&lt;li&gt;API keys in Parameter Store: &lt;strong&gt;Free&lt;/strong&gt; (within standard tier).&lt;/li&gt;
&lt;li&gt;API calls to Secrets Manager (less frequent): (&lt;strong&gt;10,000&lt;/strong&gt; ÷ &lt;strong&gt;10,000&lt;/strong&gt;) × &lt;strong&gt;$0.05&lt;/strong&gt; = &lt;strong&gt;$0.05&lt;/strong&gt; per month.&lt;/li&gt;
&lt;li&gt;API calls to Parameter Store (more frequent): &lt;strong&gt;Free&lt;/strong&gt; (standard tier).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Total: $0.45&lt;/strong&gt; per month.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Annual savings: $83.40&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This cost optimisation becomes even more significant as the number of API keys increases or when API call volume grows.&lt;/p&gt;
&lt;h2&gt;
  
  
  Choosing Between Secrets Manager and Parameter Store: Decision Criteria
&lt;/h2&gt;

&lt;p&gt;When deciding which service to use for your specific use case, consider these criteria:&lt;/p&gt;
&lt;h2&gt;
  
  
  Choose Secrets Manager if:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You need automatic rotation of credentials.&lt;/li&gt;
&lt;li&gt;Cross-account access is required.&lt;/li&gt;
&lt;li&gt;You’re using AWS services with built-in Secrets Manager integration.&lt;/li&gt;
&lt;li&gt;You need multi-region replication.&lt;/li&gt;
&lt;li&gt;Compliance requirements mandate advanced security features.&lt;/li&gt;
&lt;li&gt;You need to store secrets larger than 4KB.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Choose Parameter Store if:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Cost optimisation is a priority.&lt;/li&gt;
&lt;li&gt;You’re storing a mix of configuration data and credentials.&lt;/li&gt;
&lt;li&gt;You don’t require automatic rotation.&lt;/li&gt;
&lt;li&gt;You’re working within a single AWS account.&lt;/li&gt;
&lt;li&gt;Your secrets are smaller than 4KB (standard tier).&lt;/li&gt;
&lt;li&gt;You have a large number of parameters to store.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Alternative Solutions
&lt;/h2&gt;

&lt;p&gt;While AWS provides robust solutions for secrets management, there are alternatives worth considering:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Hashicorp Vault:&lt;/strong&gt; An open-source solution offering advanced secret management with pluggable authentication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Azure Key Vault:&lt;/strong&gt; Microsoft’s equivalent service for managing keys, secrets, and certificates.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Azure App Configuration:&lt;/strong&gt; Similar to Parameter Store but for Azure environments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For our scientific research platform, AWS services provided the best integration with our existing infrastructure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWS Best Practices for Credential Management&lt;/strong&gt;&lt;br&gt;
Our implementation follows AWS best practices for credential management:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Separation of Sensitive Information from Application Code&lt;/strong&gt;&lt;br&gt;
By storing credentials in dedicated services, we’ve completely separated sensitive information from our application code. This improves security and simplifies credential rotation without code changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Appropriate Service Selection&lt;/strong&gt;&lt;br&gt;
We’ve followed AWS’s guidance by selecting:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Secrets Manager for critical credentials requiring rotation (database credentials).&lt;/li&gt;
&lt;li&gt;Parameter Store for configuration data and less critical secrets (API keys).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Hierarchical Organisation&lt;/strong&gt;&lt;br&gt;
We’ve implemented a structured parameter hierarchy in Parameter Store:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/publisher/green-technology/api-key
/publisher/climate-change/api-key
/publisher/global-warming/api-key
/publisher/Sustainable-development/api-key
/publisher/clean-energy/api-key
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This organisation improves manageability and allows for more granular IAM permissions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Least Privilege Access&lt;/strong&gt;&lt;br&gt;
Our Lambda functions have &lt;strong&gt;IAM roles&lt;/strong&gt; with permissions only to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Access specific secrets or parameters.&lt;/li&gt;
&lt;li&gt;Access only the necessary actions (&lt;strong&gt;GetSecretValue&lt;/strong&gt;, &lt;strong&gt;GetParameter&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;Operate only in the required region.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. Encryption for All Sensitive Data&lt;/strong&gt;&lt;br&gt;
We ensure that all sensitive data is encrypted:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Secrets Manager&lt;/strong&gt; automatically encrypts all secrets with &lt;strong&gt;AWS KMS&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parameter Store&lt;/strong&gt; API keys use the &lt;strong&gt;SecureString&lt;/strong&gt; type with &lt;strong&gt;KMS encryption&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion: Balancing Security and Cost Efficiency
&lt;/h2&gt;

&lt;p&gt;Our green technology research platform demonstrates that with thoughtful service selection, organisations can achieve both robust security and cost efficiency. By leveraging &lt;strong&gt;AWS Secrets Manager&lt;/strong&gt; for critical database credentials and &lt;strong&gt;AWS Systems Manager Parameter Store&lt;/strong&gt; for API keys, we’ve implemented a solution that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Follows &lt;strong&gt;AWS security best practices&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Reduces monthly operational costs by over &lt;strong&gt;90%&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Maintains appropriate &lt;strong&gt;security levels&lt;/strong&gt; for different types of credentials.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scales efficiently&lt;/strong&gt; as our API usage grows.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This hybrid approach represents an optimal balance between security and cost-effectiveness, proving that with careful planning, organisations don’t need to compromise on either factor. For any cloud application managing multiple types of credentials, we recommend conducting a similar analysis to determine the most appropriate credential management strategy based on security requirements and cost constraints.&lt;/p&gt;

&lt;p&gt;As cloud architectures become increasingly complex, strategic service selection becomes more critical for maintaining both security and cost efficiency. Our scientific research platform serves as a practical example of how this balance can be achieved, demonstrating that well-architected applications can be both secure and cost-effective.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thank you for following along. I hope you find this valuable. Build On!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you found this helpful, don’t forget to give this article a like and follow me for more tips and insights! Your support means a lot.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>managerstore</category>
      <category>costsmanagement</category>
      <category>serverless</category>
    </item>
    <item>
      <title>How to Fix Psycopg2 ‘ModuleNotFoundError’:Using AWS Lambda-Layer</title>
      <dc:creator>Yusuf Ishola</dc:creator>
      <pubDate>Sat, 22 Mar 2025 14:49:27 +0000</pubDate>
      <link>https://dev.to/ollycare/how-to-fix-psycopg2-modulenotfounderrorusing-aws-lambda-layer-57jo</link>
      <guid>https://dev.to/ollycare/how-to-fix-psycopg2-modulenotfounderrorusing-aws-lambda-layer-57jo</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw9rwp9ebjlnmpgod3z95.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw9rwp9ebjlnmpgod3z95.png" alt="Image description" width="800" height="536"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;psycopg2&lt;/strong&gt; module is a &lt;strong&gt;PostgreSQL&lt;/strong&gt; adapter for &lt;strong&gt;Python&lt;/strong&gt;, which is commonly used in applications requiring database interactions. However, when deploying such applications to &lt;strong&gt;AWS Lambda&lt;/strong&gt;, the module must be packaged as a Lambda layer due to Lambda’s isolated environment. This involves creating a virtual environment, installing psycopg2-binary, and zipping the site-packages directory to create the layer. Once uploaded to AWS, this layer can be attached to Lambda functions, ensuring that psycopg2 is available during execution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Python Code Error: No Module Named ‘psycopg2’&lt;/strong&gt;&lt;br&gt;
When you try to run a Python script in AWS Lambda, it might not find certain libraries like psycopg2, even if they’re installed on your computer. This happens because AWS Lambda runs in a different environment than your local machine. To fix this, you need to package these libraries into something called a “&lt;strong&gt;Lambda layer&lt;/strong&gt;” and attach it to your Lambda function. Think of a Lambda layer like a special package that includes all the extra tools your script needs to work properly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7x4s5lfqu547lnnvqvjl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7x4s5lfqu547lnnvqvjl.png" alt="Image description" width="393" height="495"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Resolving the psycopg2 Module Error in AWS Lambda
&lt;/h2&gt;

&lt;p&gt;Even if it's installed in your local IDE. This error occurs because AWS Lambda requires a specific environment setup for dependencies, which differs from your local development environment.&lt;/p&gt;
&lt;h2&gt;
  
  
  Understanding the Error
&lt;/h2&gt;

&lt;p&gt;The psycopg2 module is a PostgreSQL database adapter for Python. When you install it locally using pip, it works fine in your IDE. However, AWS Lambda has its own environment and dependencies must be packaged differently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why psycopg2 Isn’t Found in Lambda&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Local Installation vs. Lambda Environment&lt;/strong&gt;: When you install psycopg2 locally, it’s installed in your system’s Python environment. AWS Lambda, however, runs in a separate environment (Amazon Linux) and doesn’t access your local Python environment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dependency Packaging&lt;/strong&gt;: AWS Lambda requires that all dependencies be included in the deployment package. If psycopg2 isn’t properly packaged, it won’t be available in the Lambda environment.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3zlbzlyhtlqje16fgmpu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3zlbzlyhtlqje16fgmpu.png" alt="Image description" width="800" height="146"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Guide to Creating a psycopg2 Lambda Layer&lt;/strong&gt;&lt;br&gt;
To resolve this issue, we are going to create a Lambda layer for psycopg2.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a Directory for the Layer&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir psycopg2_layer
cd psycopg2_layer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Create a Virtual Environment&lt;/strong&gt;:&lt;br&gt;
Ensure using a compatible Python version (e.g., Python 3.9).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3 -m venv env
source env/bin/activate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Install psycopg2-binary in the Virtual Environment:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Upgrade pip inside the virtual environment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install --upgrade pip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Install psycopg2-binary&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install psycopg2-binary
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Package psycopg2 as a Lambda Layer&lt;/strong&gt;: Create a directory for the Lambda layer.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir python
cp -r env/lib/python3.*/site-packages/* python/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Zip the directory&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;zip -r psycopg2_layer.zip python/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Mac Terminal &amp;amp; VScode views&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvhhcyrejm0xmfui2ai0p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvhhcyrejm0xmfui2ai0p.png" alt="Image description" width="800" height="509"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdw301oxa4fivruifp6u8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdw301oxa4fivruifp6u8.png" alt="Image description" width="800" height="50"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn87s37e0emmb84g4yggr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn87s37e0emmb84g4yggr.png" alt="Image description" width="800" height="502"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6sdyb16rlh6f23xxxrsy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6sdyb16rlh6f23xxxrsy.png" alt="Image description" width="352" height="601"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Create a Lambda Layer in AWS&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to the &lt;strong&gt;AWS Lambda console&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Navigate to the “&lt;strong&gt;Layers&lt;/strong&gt;” section.&lt;/li&gt;
&lt;li&gt;Click “&lt;strong&gt;Create layer&lt;/strong&gt;”: Name- &lt;strong&gt;psycopg2-layer&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Description: &lt;strong&gt;PostgreSQL-adapter&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Choose “&lt;strong&gt;Upload a .zip file&lt;/strong&gt;” and select the &lt;strong&gt;psycopg2_layer.zip&lt;/strong&gt; file.&lt;/li&gt;
&lt;li&gt;Set the runtime to match your Lambda function’s runtime &lt;strong&gt;Python 3.9&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj9kw4mqslus6ms3ddb9n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj9kw4mqslus6ms3ddb9n.png" alt="Image description" width="800" height="506"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvx535chjh3jaldlkjukl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvx535chjh3jaldlkjukl.png" alt="Image description" width="800" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Attach the Layer to Your Lambda Function&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open your Lambda function in the AWS console.&lt;/li&gt;
&lt;li&gt;Go to the “Layers” section.&lt;/li&gt;
&lt;li&gt;Click “Add a layer” and select the psycopg2 layer you created.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx0nvvotujed8qve4qqey.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx0nvvotujed8qve4qqey.png" alt="Image description" width="800" height="266"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhfekk0gqmk8o4m1gvpm6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhfekk0gqmk8o4m1gvpm6.png" alt="Image description" width="800" height="95"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbl2utj6wstyukibw3oeb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbl2utj6wstyukibw3oeb.png" alt="Image description" width="800" height="373"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwjxd3862ex8msqbx3gmd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwjxd3862ex8msqbx3gmd.png" alt="Image description" width="800" height="303"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;By following these steps, you can successfully resolve the psycopg2 “&lt;strong&gt;ModuleNotFoundError&lt;/strong&gt;” in AWS Lambda by creating and using a Lambda layer. This approach ensures that your application has access to all necessary dependencies in the Lambda environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe6i0m4qsb3km44ra5yv1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe6i0m4qsb3km44ra5yv1.png" alt="Image description" width="800" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Share Your Thoughts
&lt;/h2&gt;

&lt;p&gt;Have you encountered similar issues with AWS Lambda? How did you resolve them? Share your experiences in the comments below!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>lambda</category>
      <category>serverless</category>
      <category>postgres</category>
    </item>
    <item>
      <title>Amazon EKS Now Defaults to Envelope Encryption for Kubernetes API Data</title>
      <dc:creator>Yusuf Ishola</dc:creator>
      <pubDate>Tue, 11 Mar 2025 07:22:04 +0000</pubDate>
      <link>https://dev.to/ollycare/amazon-eks-now-defaults-to-envelope-encryption-for-kubernetes-api-data-3pb9</link>
      <guid>https://dev.to/ollycare/amazon-eks-now-defaults-to-envelope-encryption-for-kubernetes-api-data-3pb9</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq1g0s0egl6v0ct1r1rvh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq1g0s0egl6v0ct1r1rvh.png" alt="Image description" width="698" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Amazon EKS
&lt;/h2&gt;

&lt;p&gt;Amazon Elastic Kubernetes Service (Amazon EKS) is a managed Kubernetes service that eliminates the need to operate and maintain the availability and scalability of Kubernetes clusters in Amazon Web Services (AWS) and in your own data centre's.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Kubernetes&lt;/strong&gt;: is an open source system that automates the management, scaling, and deployment of containerised applications.&lt;/p&gt;

&lt;p&gt;Amazon Elastic Kubernetes Service (EKS) is rolling out a major security enhancement for Kubernetes users: &lt;strong&gt;default envelope encryption **for all Kubernetes API data in clusters running **version 1.28 or higher&lt;/strong&gt;. This update integrates &lt;strong&gt;AWS Key Management Service (KMS)&lt;/strong&gt; with &lt;strong&gt;Kubernetes KMS provider v2&lt;/strong&gt;, delivering a fully managed, defense-in-depth security layer for your Kubernetes applications — straight out of the box.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What’s Changing?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Previously, envelope encryption in EKS was an &lt;strong&gt;optional&lt;/strong&gt; feature, available through &lt;strong&gt;KMS provider v1&lt;/strong&gt;. With this update, it becomes the &lt;strong&gt;default configuration&lt;/strong&gt; for all Kubernetes API objects. AWS will now provide a &lt;strong&gt;default KMS encryption key&lt;/strong&gt;, but you still have the flexibility to create or import your own keys into AWS KMS for your cluster’s control plane.&lt;br&gt;
If you’ve already been using a customer-managed key (CMK) to encrypt Kubernetes Secrets, the same key will seamlessly extend to encrypt additional API data types in your cluster — no additional configuration needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why This Matters for DevOps Engineers&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This update simplifies security management for Kubernetes workloads:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reduced Configuration Overhead&lt;/strong&gt;: No need to manually enable encryption; it’s built-in by default.&lt;br&gt;
&lt;strong&gt;Seamless CMK Integration&lt;/strong&gt;: If you’re already using a CMK, no extra steps are required to extend encryption across API data.&lt;br&gt;
&lt;strong&gt;Stronger Security &amp;amp; Compliance&lt;/strong&gt;: Automatically enhances data protection without increasing operational complexity.&lt;br&gt;
&lt;strong&gt;More Time for Innovation&lt;/strong&gt;: Focus on delivering applications, not configuring encryption settings.&lt;/p&gt;

&lt;p&gt;For teams prioritising security and compliance, this change reinforces data protection while maintaining flexibility. Whether you’re a seasoned cloud architect or a DevOps engineer managing multiple clusters, this update means one less security concern to worry about.&lt;/p&gt;

&lt;p&gt;What do you think, how will this impact your workflows? Let’s discuss below!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>kubernetes</category>
      <category>devops</category>
      <category>api</category>
    </item>
    <item>
      <title>Troubleshooting Kubernetes Persistent Volume Binding Issues.</title>
      <dc:creator>Yusuf Ishola</dc:creator>
      <pubDate>Sun, 09 Feb 2025 18:41:15 +0000</pubDate>
      <link>https://dev.to/ollycare/troubleshooting-kubernetes-persistent-volume-binding-issues-pk3</link>
      <guid>https://dev.to/ollycare/troubleshooting-kubernetes-persistent-volume-binding-issues-pk3</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs6rmhv2byzvnv70cgw9g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs6rmhv2byzvnv70cgw9g.png" alt="Image description" width="800" height="445"&gt;&lt;/a&gt; &lt;br&gt;
As Kubernetes becomes the backbone of modern infrastructure, engineers are increasingly facing the challenges of managing PersistentVolumes (PV) and PersistentVolumeClaims (PVC) effectively. In this article, we’ll walk through a real-world scenario of troubleshooting a PVC stuck in a “Pending” state, sharing the insights and best practices that every DevOps engineer should know.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Understanding the Problem: PVC Stuck in “Pending” State&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Pending&lt;/strong&gt; state of a PVC is often a bottleneck for engineers deploying stateful applications in Kubernetes. In our scenario, a PVC (devops-1-claim0) was failing to bind to its associated PV, with the following error:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Warning FailedBinding persistentvolume-controller volume “kt-migration-devops-1-pv” already bound to a different claim.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;At first glance, this error might seem vague, but it points to a classic issue with Kubernetes’ PV lifecycle: the PV was in the Released state, preventing it from being re-bound.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Root Cause: Understanding the “Released” State in Kubernetes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Kubernetes PVs follow a well-defined lifecycle:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Available&lt;/strong&gt;: Ready for a PVC to claim it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bound&lt;/strong&gt;: Attached to a PVC.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Released&lt;/strong&gt;: The PVC is deleted, but the data on the PV remains, and the volume isn’t yet ready for another claim.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Failed&lt;/strong&gt;: Something went wrong in the lifecycle.&lt;/p&gt;

&lt;p&gt;In this case, the ReclaimPolicy for the PV was set to &lt;strong&gt;Retain&lt;/strong&gt;, meaning that even after the original PVC was deleted, the data remained intact, and the PV was marked as &lt;strong&gt;Released&lt;/strong&gt;. However, Kubernetes doesn’t automatically clean or make the volume available for reuse, leading to the binding failure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Troubleshooting Steps: Clearing the “ClaimRef” Field&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To resolve this issue, we needed to make the PV available again by clearing its ClaimRef, which was still pointing to the deleted PVC.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check the PV’s Status&lt;/strong&gt;: First, confirm the PV’s state and check if it’s in the &lt;strong&gt;Released&lt;/strong&gt; state:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kubectl get pv kt-migration-devops-1-pv&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Manually Clear the ClaimRef&lt;/strong&gt;: The quickest way to reset the PV is by patching it to clear the old reference to the previous PVC:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kubectl patch pv kt-migration-devops-1-pv -p ‘{“spec”:{“claimRef”: null}}’&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This effectively releases the PV for new claims, allowing the PVC to bind again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check the PVC Binding&lt;/strong&gt;: Once the ClaimRef is cleared, check the status of the PVC:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kubectl get pvc -n kt-migration&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;NAME               STATUS   VOLUME                      CAPACITY   ACCESS MODES   STORAGECLASS   VOLUMEATTRIBUTESCLASS   AGE&lt;br&gt;
devops-1-claim0   Bound    kt-migration-devops-1-pv   300Gi      RWO            gp3            &amp;lt;unset&amp;gt;                 2d4h&lt;br&gt;
devops-2-claim0   Bound    kt-migration-devops-2-pv   300Gi      RWO            gp3            &amp;lt;unset&amp;gt;                 2d4h&lt;br&gt;
devops-3-claim0   Bound    kt-migration-devops-3-pv   300Gi      RWO            gp3            &amp;lt;unset&amp;gt;                 2d4h&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In our case, the PVC was successfully bound to the PV after clearing the ClaimRef.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lessons Learned and Best Practices&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This experience teaches several valuable lessons for managing stateful applications in Kubernetes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Understand PV Lifecycles&lt;/strong&gt;: As DevOps engineers, it’s crucial to understand how PVs move through their lifecycle. The Released state often trips engineers up when they expect Kubernetes to handle the cleanup automatically, especially with the Retain policy.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Monitor PVC and PV States&lt;/strong&gt;: Keep an eye on both your PVC and PV states using kubectl describe to catch issues early. When a PVC gets stuck in Pending, don’t just focus on the PVC — check the associated PV to diagnose the problem.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use Dynamic Provisioning When Possible&lt;/strong&gt;: Static provisioning (pre-creating PVs) can lead to issues like this, where manual intervention is required to reset or clean up volumes. Whenever possible, rely on dynamic provisioning, where Kubernetes automatically creates and deletes volumes as needed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Choose the Right Reclaim Policy&lt;/strong&gt;: Be mindful of the ReclaimPolicy. In scenarios where data persistence is critical, Retain is the right choice. However, if volumes don’t need to retain data after the PVC is deleted, consider using Delete to avoid manual cleanup.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Persistent storage management in Kubernetes can be tricky, but understanding how PVs and PVCs interact will save you a lot of time and headaches. By sharing this real-world experience, I hope to help other engineers navigate similar issues with greater confidence and insight.&lt;/p&gt;

&lt;p&gt;Kubernetes is powerful, but it requires a strong grasp of its underlying systems to ensure smooth deployments — especially in complex, stateful workloads like databases.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>kubernetes</category>
      <category>cloud</category>
    </item>
  </channel>
</rss>
