Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      June 4, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      June 4, 2025

      How To Prevent WordPress SQL Injection Attacks

      June 4, 2025

      Smashing Animations Part 4: Optimising SVGs

      June 4, 2025

      I test AI tools for a living. Here are 3 image generators I actually use and how

      June 4, 2025

      The world’s smallest 65W USB-C charger is my latest travel essential

      June 4, 2025

      This Spotlight alternative for Mac is my secret weapon for AI-powered search

      June 4, 2025

      Tech prophet Mary Meeker just dropped a massive report on AI trends – here’s your TL;DR

      June 4, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Beyond AEM: How Adobe Sensei Powers the Full Enterprise Experience

      June 4, 2025
      Recent

      Beyond AEM: How Adobe Sensei Powers the Full Enterprise Experience

      June 4, 2025

      Simplify Negative Relation Queries with Laravel’s whereDoesntHaveRelation Methods

      June 4, 2025

      Cast Model Properties to a Uri Instance in 12.17

      June 4, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      My Favorite Obsidian Plugins and Their Hidden Settings

      June 4, 2025
      Recent

      My Favorite Obsidian Plugins and Their Hidden Settings

      June 4, 2025

      Rilasciata /e/OS 3.0: Nuova Vita per Android Senza Google, Più Privacy e Controllo per l’Utente

      June 4, 2025

      Rilasciata Oracle Linux 9.6: Scopri le Novità e i Miglioramenti nella Sicurezza e nelle Prestazioni

      June 4, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»AWS Secrets Manager – A Secure Solution for Protecting Your Data

    AWS Secrets Manager – A Secure Solution for Protecting Your Data

    February 5, 2025

    Objective

    If you are looking for a solution to securely store your secrets like DB credentials, API keys, tokens, passwords, etc., AWS Secret Manager is the service that comes to your rescue. Keeping the secrets as plain text in your code is highly risky. Hence, storing the secrets in AWS secret manager helps you with the following.

    AWS Secret Manager is a fully managed service that can store and manage sensitive information. It simplifies secret handling by enabling the auto-rotation of secrets to reduce the risk of compromise, monitoring the secrets for compliance, and reducing the manual effort of updating the credentials in the application after rotation.

    Essential Features of AWS Secret Manager

    Picture1

    • Security: Secrets are encrypted using encryption keys we can manage through AWS KMS.
    • Rotation schedule: Enable rotation of credentials through scheduling to replace long-term with short-term ones.
    • Authentication and Access control: Using AWS IAM, we can control access to the secrets, control lambda rotation functions, and permissions to replicate the secrets.
    • Monitor secrets for compliance: AWS Config rules can be used to check whether secrets align with internal security and compliance standards, such as HIPAA, PCI, ISO, AICPA SOC, FedRAMP, DoD, IRAP, and OSPAR.
    • Audit and monitoring: We can use other AWS services, such as Cloud Trail for auditing and Cloud Watch for monitoring.
    • Rollback through versioning: If needed, the secret can be reverted to the previous version by moving the labels attached to that secret.
    • Pay as you go: Charged based on the number of secrets managed through the Secret manager.
    • Integration with other AWS services: Integrating with other AWS services, such as EC2, Lambda, RDS, etc., eliminates the need to hard code secrets.

    AWS Secret Manager Pricing

    At the time of publishing this document, AWS Secret Manager pricing is below. This might be revised in the future.

    Component Cost Details
    Secret storage $0.40 per secret per month Charges are done per month. If they are stored for less than a month, the cost is prorated.
    API calls $0.05 per 10,000 API calls Charges are charged to API interactions like managing secrets / retrieving secrets.

    Creating a Secret

    Let us get deeper into the process of creating secrets.

    1. Log in to the AWS Secret management console and select the “store a new secret” option: https://console.aws.amazon.com/secretsmanager/.
      Picture2
    2. On the Choose secret type page,
      1. For Secret type, select the type of database secret that you want to store:
      2. For Credentials, input the credentials for the database that has been hardcoded. Picture3
      3. For the Encryption key, choose AWS/Secrets Manager. This encryption key service is free to use.
      4. For the Database field, choose your database.
      5. Then click Next.
    3. On the Configure secret page,
      1. Provide a descriptive secret name and description.
      2. In the Resource permissions field, choose Edit permissions. Provide the policy that allows RoleToRetrieveSecretAtRuntime and Save.
      3. Then, click Next. Picture4
    4. On the Configure rotation page,
      1. select the schedule for which you want this to be rotated.
      2. Click Next. Picture6
    5. On the Review page, review the details, and then Store.

    Output

    The secret is created as below.

    Picture7

    We can update the code to fetch the secret from Secrets Manager. For this, we need to remove the hardcoded credentials from the code. Based on the code language, there is a need to add a call to the function or method to the code to call the secret manager for the secret stored here. Depending on our requirements, we can modify the rotation strategy, versioning, monitoring, etc.

    Secret Rotation Strategy

    Picture8

    • Single user – It updates credentials for one user in one secret. During secret rotation, open connections will not be dropped. While rotating, Open connections might experience a low risk of database denial calls that use the newly rotated secrets. This can be mitigated through retry strategies. Once the rotation is completed, all new calls will use the rotated credentials.
      • Use case – This strategy can be used for one-time or interactive users.
    • Alternating users – This method updates secret values for two users in one secret. We create the first use. Then, we create a cloned second user using the rotation function during the first rotation. Whenever the secret rotates, the rotation function alternates between the user’s password and the one it updates. Even during rotation, the application gets a valid set of credentials.
      • Uses case – This is good for systems that require high availability.

    Versioning of Secrets

    A secret consists of the secret value and the metadata. To store multiple values in one secret, we can use json with key-value pairs. A secret has a version that holds copies of the encrypted secret values. AWS uses three labels, like:

    • AWSCURRENT – to store current secret value.
    • AWSPREVIOUS – to hold the previous version.
    • AWSPENDING – to hold pending value during rotation.

    Custom labeling of the versions is also possible. AWS can never remove labeled versions of secrets, but unlabeled versions are considered deprecated and will be removed at any time.

    Monitoring Secrets in AWS Secret Manager

    Secrets stored in AWS Secret Manager can be monitored by services provided by AWS as below.

    • Using cloud trail – This stores all API calls to the secret Manager as events, including secret rotation and version deletion.
    • Monitoring using Cloudwatch – the number of secrets in our account can be managed, secrets that are marked for deletion, monitor metrics, etc. We can also set an alarm for metric changes.

    Conclusion

    AWS Secrets Manager offers a secure, automated, scalable solution for managing sensitive data and credentials. It reduces the risk of secret exposure and helps improve application security with minimal manual intervention. Adopting best practices around secret management can ensure compliance and minimize vulnerabilities in your applications.

     

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleHumanize String, Number, and Date Values into Readable Formats
    Next Article An Interview with “Tech Humanist” Kate O’Neill

    Related Posts

    Security

    HPE StoreOnce Faces Critical CVE-2025-37093 Vulnerability — Urges Immediate Patch Upgrade

    June 4, 2025
    Security

    CISA Adds Qualcomm Vulnerabilities to KEV Catalog

    June 4, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    Slim-Llama: An Energy-Efficient LLM ASIC Processor Supporting 3-Billion Parameters at Just 4.69mW

    Development

    Video security analysis for privileged access management using generative AI and Amazon Bedrock

    Machine Learning

    New tool – Advanced data-focused fitness logging for athletes

    Web Development

    Effective ways of Exception Handling in Salesforce Apex

    Development

    Highlights

    Development

    RobustRAG: A Unique Defense Framework Developed for Opposing Retrieval Corruption Attacks in Retrieval-Augmented Generation (RAG) Systems

    June 1, 2024

    Retrieval-augmented generation (RAG) is a potent strategy that improves the capabilities of Large Language Models…

    WizardLM-2: An Open-Source AI Model that Claims to Outperform GPT-4 in the MT-Bench Benchmark

    April 16, 2024

    Google Chrome Vulnerability Let Attackers Escape Payload from Sandbox – Technical Details Disclosed

    April 29, 2025

    Researchers at the University of Cambridge Propose AnchorAL: A Unique Machine Learning Method for Active Learning in Unbalanced Classification Tasks

    April 11, 2024
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.