Git Product home page Git Product logo

aws-configuration-loader's Introduction

AWS configuration loader

This utility loads parameters stored in the AWS SSM (Simple Systems Manager) service into a processes environment

Problematic

Applications need configurations to be able to address external elements (like databases, queues, etc). In the cloud the ability to create these elements on-demand and programatically enable developers and system administrators to deploy their applications as many times as needed at will, but that also means that external elements can also get created with new names. When we prepare an application for the cloud, we have to start caring about configuring the applications, handling secrets for connecting to databases, etc.

These configurations are often stored on services like etcd, zookeeper, consul, etc, which you have to manage, and pay for servers. It's not always trivial! See: https://crewjam.com/etcd-aws/, https://github.com/stylight/etcd-bootstrap, https://limecodeblog.wordpress.com/2016/09/19/consul-cluster-in-aws-with-auto-scaling/.

AWS provides a service called SSM that exposes an API for storing parameters. These parameters can be strings and encrypted strings (enabled for storing secrets). This utility leverages the SSM Parameters API to expose parameters in a way that your application doesn't have to become aware of the SSM service. It does this exposing the parameters stored in the service via environment variables to your application. This practice is inspired by https://12factor.net/es/config (Twelve factor App). Note that once your application is configured via environment variables, it is independent of where the configuration is stored (you can easily adopt the same method if you are using etcd or consul).

Usage

Create SSM parameters with names that follow this structure: /APP_NAME/ENVIRONMENT_NAME/ENVIRONMENT_VARIABLE.

When you invoke

bin/load_ssm_to_env APP_NAME:ENVIRONMENT_NAME:region your_app

your_app will have all the SSM parameters' values that start with /APP_NAME/ENVIRONMENT_NAME/ accessible as environment variables:

/appname/pre/DBHOST will be accessible in the environment as DBHOST /appname/pre/DBPASS will be accessible in the environment as DBPASS

Parameter creation

You can create the parameters from the AWS console manually. Go to the console -> EC2 -> SYSTEMS MANAGER SHARED RESOURCES -> Parameter Store

You can also create the parameters with CloudFormation (see the example in the examples dir). This lets you create resources, and save them as parameters so that later your application can read them.

Security

You can limit an instance, via an Instance Role to only be able to access the set of parameters for it's environment via an IAM policy:

{
   "Version":"2012-10-17",
   "Statement":[
      {
         "Effect":"Allow",
         "Action":[
            "ssm:DescribeParameterByPath",
         ],
         "Resource":"/myapp/pre/*",
      }
   ]
}

See [http://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-paramstore-working.html]

License

This software is released under the Apache 2 License

Author

Jose Luis Martinez

Copyright

(c) 2017 CAPSiDE SL

aws-configuration-loader's People

Contributors

pplu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  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.