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

      Sunshine And March Vibes (2025 Wallpapers Edition)

      June 2, 2025

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

      June 2, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      June 2, 2025

      How To Prevent WordPress SQL Injection Attacks

      June 2, 2025

      How Red Hat just quietly, radically transformed enterprise server Linux

      June 2, 2025

      OpenAI wants ChatGPT to be your ‘super assistant’ – what that means

      June 2, 2025

      The best Linux VPNs of 2025: Expert tested and reviewed

      June 2, 2025

      One of my favorite gaming PCs is 60% off right now

      June 2, 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

      `document.currentScript` is more useful than I thought.

      June 2, 2025
      Recent

      `document.currentScript` is more useful than I thought.

      June 2, 2025

      Adobe Sensei and GenAI in Practice for Enterprise CMS

      June 2, 2025

      Over The Air Updates for React Native Apps

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

      You can now open ChatGPT on Windows 11 with Win+C (if you change the Settings)

      June 2, 2025
      Recent

      You can now open ChatGPT on Windows 11 with Win+C (if you change the Settings)

      June 2, 2025

      Microsoft says Copilot can use location to change Outlook’s UI on Android

      June 2, 2025

      TempoMail — Command Line Temporary Email in Linux

      June 2, 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

    Chrome Zero-Day Alert: CVE-2025-5419 Actively Exploited in the Wild

    June 2, 2025
    Security

    CISA Adds 5 Actively Exploited Vulnerabilities to KEV Catalog: ASUS Routers, Craft CMS, and ConnectWise Targeted

    June 2, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    5 Trends Shaping Medical Device Innovation and Experience in 2025

    Development

    Anole: An Open, Autoregressive, Native Large Multimodal Model for Interleaved Image-Text Generation

    Development

    CVE-2025-47245 – BlueWave Checkmate Role Tampering Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-2102 – HYPR Passwordless Link Following Privilege Escalation Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Highlights

    concurrently lets you run multiple commands concurrently

    March 31, 2025

    concurrently is similar to the command npm run watch-js & npm run watch-less but better.…

    AI Fitness Apps: The Next Big Opportunity in Health Tech

    February 13, 2025

    Google DeepMind at NeurIPS 2023

    May 13, 2025

    You can get the Amazon Fire HD 8 Plus for over 50% off with this trade-in deal

    August 23, 2024
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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