Skip to content

Environments injection tool for AWS EC2, with SSM (EC2 Parameter Store).

Notifications You must be signed in to change notification settings

timakin/ssm2env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ssm2env

Environments injection tool with parameters fetched from AWS (Amazon System Manager EC2 Parameter Store).

Install

$ go get -u github.com/timakin/ssm2env

Prepare

At first, set your own parameters to SSM, EC2 parameter store.

Notice: Please set the prefix for parameters with dots.

ex) testapi.prod.DB_PASSWORD

$ aws ssm get-parameters --with-decryption --names testapi.prod.DB_USER testapi.prod.DB_PASSWORD
{
    "InvalidParameters": [],
    "Parameters": [
        {
            "Type": "String",
            "Name": "testapi.prod.DB_USER",
            "Value": "root"
        },
        {
            "Type": "SecureString",
            "Name": "testapi.prod.DB_PASSWORD",
            "Value": "password"
        }
    ]
}

Usage

Inside your server with aws credentials, just type SSM2ENV_PREFIX=testapi.prod ssm2env [-v] .

This command will generate the script to export the environments.

After reproduction a process, init script will be called and it'll export above variables.

If you'd set envs immediately, just call the raw script file. source /etc/profile.d/loadenv_fromssm.sh

About

Environments injection tool for AWS EC2, with SSM (EC2 Parameter Store).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages