Code Monkey home page Code Monkey logo

aws-secrets-bundle-1's Introduction

AWS Secrets Bundle

GitHub license PHP version Symfony

Use AWS Secrets as service container parameters in Symfony.

History and honorable mentions

This bundle is loosely based on and inspired by incompass/aws-secrets-bundle (https://github.com/casechek/aws-secrets-bundle). The Incompass bundle is compatible with Symfony 3 and 4, and it looks like it's not updated/maintained anymore. This package is built to be compatible with Symfony 5 and will, over time, get improvements.

If you are still using Symfony 3 or 4, please use the Incompass bundle instead of this one.

Prerequisites

Install AWS SDK

Since the official recommendation from Symfony is: A bundle must not embed third-party PHP libraries. It should rely on the standard Symfony autoloading instead., the aws/aws-sdk-php Composer package is included in this bundle only as a dev dependency (for testing purposes).

You need to install AWS SDK for PHP in your project yourself:

composer require aws/aws-sdk-php

AWS credentials

In order to connect to any AWS service (for example: AWS Secrets Manager), your application must be authenticated on that AWS service. Since there are several scenarios for this, depending on your environment setup, configuring environments and using credentials is covered here: AWS credentials and authentication

Installation

$ composer require constup/aws-secrets-bundle

Configuration

By default, configuration for this bundle is loaded from config/packages/aws_secrets.yaml file or its environment-specific alternatives (for example: config/packages/test/aws_secrets.yaml). The following configuration properties are available:

aws_secrets:
  client_config:
    region:           # Required if "ignore" is false.
    version: 'latest' # Defaults to "latest".
    endpoint: ~
    credentials: 
        key: ~
        secret: ~
  cache: 'array'      # Can be one of the following: apcu, array, filesystem. Default is array.
  delimiter: ','      # Delimiter to separate key from secret name.
  ignore: false       # Pass through AWS (for local dev environments set to "true").

Usage

Set an env var to an AWS Secret Manager Secret name like so:

AWS_SECRET=secret_name

If you want to grab a key in a JSON secret, you can separate the secret name and key:

AWS_SECRET=secret_name,key

Set a parameter to this environment variable with the aws processor:

parameters:
    my_parameter: '%env(aws:AWS_SECRET)%'

Your secret will now be loaded at runtime!

Examples

aws-secrets-bundle-1's People

Contributors

constup avatar dmitry-shylov avatar nikoladstojiljkovic avatar satdeveloping avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.