{"id":21670856,"url":"https://github.com/tkuchiki/ssmenv","last_synced_at":"2025-03-20T07:43:39.840Z","repository":{"id":64306593,"uuid":"136336153","full_name":"tkuchiki/ssmenv","owner":"tkuchiki","description":"Expand environment variables from AWS EC2 Systems Manager Parameter Store","archived":false,"fork":false,"pushed_at":"2018-07-03T02:29:53.000Z","size":9,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-25T09:11:05.476Z","etag":null,"topics":["aws","cli","ec2-systems-manager","env","environment-variables","golang","parameter-store"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tkuchiki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-06T13:55:26.000Z","updated_at":"2018-07-13T02:55:38.000Z","dependencies_parsed_at":"2023-01-15T10:45:15.305Z","dependency_job_id":null,"html_url":"https://github.com/tkuchiki/ssmenv","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkuchiki%2Fssmenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkuchiki%2Fssmenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkuchiki%2Fssmenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkuchiki%2Fssmenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tkuchiki","download_url":"https://codeload.github.com/tkuchiki/ssmenv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244574795,"owners_count":20474818,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","cli","ec2-systems-manager","env","environment-variables","golang","parameter-store"],"created_at":"2024-11-25T12:36:56.794Z","updated_at":"2025-03-20T07:43:39.800Z","avatar_url":"https://github.com/tkuchiki.png","language":"Go","readme":"# ssmenv\nExpand environment variables from AWS EC2 Systems Manager Parameter Store\n\n# Installation\n\nDownload from https://github.com/tkuchiki/ssmenv/releases\n\n# Usage\n\n```console\n$ ./ssmenv --help\nusage: ssmenv [\u003cflags\u003e]\n\nExpand environment variables from AWS EC2 Systems Manager Parameter Store\n\nFlags:\n  --help                         Show context-sensitive help (also try --help-long and --help-man).\n  --names=PARAM_NAME,...         Names of the parameters (comma separated)\n  --paths=PARAM_PATH,...         The hierarchy for the parameter names (comma separated)\n  --tags=KEY=VALUE,...           Filter by tags (comma separated)\n  --types=String,SecureString    The type of parameters (comma separated)\n  --multi-values=PARAM_NAME,...  Names or paths with multiple values (comma separated)\n  --without-export               Without export\n  --hide-exists                  Hide environment variables if it already exists\n  --fail-exists                  Fail if environment variables alerady exists\n  --retries=3                    Number of times of retry\n  --access-key=ACCESS-KEY        The AWS access key ID\n  --secret-key=SECRET-KEY        The AWS secret access key\n  --assume-role-arn=ASSUME-ROLE-ARN\n                                 The AWS assume role ARN\n  --token=TOKEN                  The AWS access token\n  --region=REGION                The AWS region\n  --profile=PROFILE              The AWS CLI profile\n  --aws-config=AWS-CONFIG        The AWS CLI Config file\n  --credentials=CREDENTIALS      The AWS CLI Credential file\n  --version                      Show application version.\n```\n\n# Examples\n\n```console\n$ aws ssm put-parameter --name /test/env1 --value \"foo\" --type String --region us-east-1\n$ aws ssm put-parameter --name /test/env2 --value \"bar\" --type String --region us-east-1\n\n$ ./ssmenv --paths /test\nexport ENV1=\"foo\"\nexport ENV2=\"bar\"\n\n$ eval $(./ssmenv --paths /test)\n$ echo $ENV1\nfoo\n$ echo $ENV2\nbar\n```\n\n```console\n$ aws ssm put-parameter --name test.env1 --value \"foo\" --type String --region us-east-1\n$ aws ssm put-parameter --name test.env2 --value \"bar\" --type String --region us-east-1\n\n$ ./ssmenv --names test.env1,test.env2\nexport ENV1=\"foo\"\nexport ENV2=\"bar\"\n\n$ eval $(./ssmenv --names test.env1,test.env2)\n$ echo $ENV1\nfoo\n$ echo $ENV2\nbar\n```\n\n```console\n$ aws ssm put-parameter --name /test/env1 --value \"foo\" --type String --region us-east-1\n$ aws ssm put-parameter --name /test/env2 --value \"bar\" --type String --region us-east-1\n$ aws ssm add-tags-to-resource --resource-type Parameter --resource-id \"/test/env1 resource id(n.b. invalid resource id)\" --tags \"Key=Env,Value=Production\"\n\n$ ./ssmenv --paths /test/env1,/test/env2 --tags \"Env=Production\"\nexport ENV1=\"foo\"\n\n$ eval $(./ssmenv --paths /test/env1,/test/env2 --tags \"Env=Production\")\n$ echo $ENV1\nfoo\n```\n\n```console\n$ aws ssm put-parameter --name /test/env1 --value \"foo\" --type String --region us-east-1\n$ aws ssm put-parameter --name /test/env2 --value \"bar\" --type String --region us-east-1\n\n$ ./ssmenv --paths /test\nexport ENV1=\"foo\"\nexport ENV2=\"bar\"\n\n$ ./ssmenv --paths /test --without-export\nENV1=\"foo\"\nENV2=\"bar\"\n```\n\n```console\n$ aws ssm put-parameter --name /test/env1 --value \"foo\" --type String --region us-east-1\n$ aws ssm put-parameter --name /test/env2 --value \"bar\" --type String --region us-east-1\n\n$ ./ssmenv --paths /test\nexport ENV1=\"foo\"\nexport ENV2=\"bar\"\n\n$ export ENV2=\"\"\n$ ./ssmenv --paths /test --hide-exists\nexport ENV1=\"foo\"\n\n$ ./ssmenv --paths /test --fail-exists\n2018/07/02 12:31:49 ENV2 already exists\n$ echo $1\n1\n```\n\n```console\n$ aws ssm put-parameter --name /test/multienv --value \"$(echo ENV3=bar; echo ENV4=baz)\" --type String --region us-east-1\n\n$ ./ssmenv --paths /test --multi-values /test/multienv\nexport ENV1=\"foo\"\nexport ENV2=\"bar\"\nexport ENV3=\"bar\"\nexport ENV4=\"baz\"\n\n$ aws ssm put-parameter --name /test/secure_multienv --value \"$(echo ENV5=foobar; echo ENV6=foobaz)\" --type SecureString --key-id alias/aws/ssm --region us-east-1\n\n$ ./ssmenv --paths /test --multi-values /test/multienv,/test/secure_multienv\nexport ENV1=\"foo\"\nexport ENV2=\"bar\"\nexport ENV3=\"bar\"\nexport ENV4=\"baz\"\nexport ENV5=\"foobar\"\nexport ENV6=\"foobaz\"\n\n$ ./ssmenv --paths /test --multi-values /test/multienv,/test/secure_multienv --without-export\nENV1=\"foo\"\nENV2=\"bar\"\nENV3=\"bar\"\nENV4=\"baz\"\nENV5=\"foobar\"\nENV6=\"foobaz\"\n```\n\n# Known Issues\n\n- `--paths` does not work absolute path\n\n```console\n$ aws ssm put-parameter --name /test/env1 --value \"foo\" --type String --region us-east-1\n$ aws ssm put-parameter --name /test/env2 --value \"bar\" --type String --region us-east-1\n\n# work\n$ ./ssmenv --paths /test/\nexport ENV1=\"foo\"\nexport ENV2=\"bar\"\n\n# does not work\n$ ./ssmenv --paths /test/env1\n2018/07/02 13:37:45 InvalidParameter: 1 validation error(s) found.\n- minimum field size of 1, GetParametersInput.Names.\n\n# work\n$ ./ssmenv --names /test/env1,/test/env2\nexport ENV1=\"foo\"\nexport ENV2=\"bar\"\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkuchiki%2Fssmenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftkuchiki%2Fssmenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkuchiki%2Fssmenv/lists"}