<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>The Wombelix Post - SSM</title><link href="https://dominik.wombacher.cc/" rel="alternate"/><link href="/feeds/tag_ssm.atom.xml" rel="self"/><id>https://dominik.wombacher.cc/</id><updated>2025-08-07T00:00:00+02:00</updated><entry><title>params2env: AWS SSM Parameter Store to Environment variables</title><link href="https://dominik.wombacher.cc/posts/params2env-aws-ssm-parameter-store-to-environment-variables.html" rel="alternate"/><published>2025-08-07T00:00:00+02:00</published><updated>2025-08-07T00:00:00+02:00</updated><author><name>Dominik Wombacher</name></author><id>tag:dominik.wombacher.cc,2025-08-07:/posts/params2env-aws-ssm-parameter-store-to-environment-variables.html</id><summary type="html">&lt;!-- SPDX-FileCopyrightText: 2025 Dominik Wombacher &lt;dominik@wombacher.cc&gt; --&gt;
&lt;!--  --&gt;
&lt;!-- SPDX-License-Identifier: CC-BY-SA-4.0 --&gt;
&lt;p&gt;I recently released &lt;a class="reference external" href="https://git.sr.ht/~wombelix/params2env"&gt;params2env&lt;/a&gt;,
a CLI tool written in Go that manages AWS SSM Parameter Store parameters and converts them to environment variables.
The project is available under the MIT  ... &lt;a class="read-more" href="/posts/params2env-aws-ssm-parameter-store-to-environment-variables.html"&gt; [read more]&lt;/a&gt;&lt;/p&gt;</summary><content type="html">&lt;!-- SPDX-FileCopyrightText: 2025 Dominik Wombacher &lt;dominik@wombacher.cc&gt; --&gt;
&lt;!--  --&gt;
&lt;!-- SPDX-License-Identifier: CC-BY-SA-4.0 --&gt;
&lt;p&gt;I recently released &lt;a class="reference external" href="https://git.sr.ht/~wombelix/params2env"&gt;params2env&lt;/a&gt;,
a CLI tool written in Go that manages AWS SSM Parameter Store parameters and converts them to environment variables.
The project is available under the MIT license with mirrors on
&lt;a class="reference external" href="https://codeberg.org/wombelix/params2env"&gt;Codeberg&lt;/a&gt;,
&lt;a class="reference external" href="https://gitlab.com/wombelix/params2env"&gt;GitLab&lt;/a&gt; and
&lt;a class="reference external" href="https://github.com/wombelix/params2env"&gt;GitHub&lt;/a&gt;.
Pre-built binaries for Linux, macOS, and Windows are available on the
&lt;a class="reference external" href="https://github.com/wombelix/params2env/releases"&gt;GitHub Releases&lt;/a&gt; page.&lt;/p&gt;
&lt;p&gt;My motivation was using AWS SSM Parameter Store as a low-cost password manager
for applications and pipelines. I don't need advanced features like rotation
that AWS Secrets Manager offers, so Parameter Store is much cheaper, basically free,
compared to Secrets Manager with costs per managed secret. I did some research and
there wasn't a tool that did exactly what and how I wanted it, so I built it myself.&lt;/p&gt;
&lt;p&gt;This tool is for you if you store configuration or secrets in AWS SSM Parameter Store
and need to get them into environment variables for your applications. It doesn't
matter if your workload runs on AWS, on-premises, or anywhere else. As long as your
application reads environment variables, params2env can provide them from Parameter Store.&lt;/p&gt;
&lt;p&gt;Parameter Store standard parameters with AWS-managed encryption are free, so using
params2env with standard parameters has no additional AWS costs beyond your existing setup.
Advanced parameters cost $0.05 per parameter per month. If you use customer-managed KMS keys
for SecureString parameters, each key costs $1 per month. See the
&lt;a class="reference external" href="https://aws.amazon.com/systems-manager/pricing/"&gt;AWS Systems Manager pricing&lt;/a&gt; and
&lt;a class="reference external" href="https://aws.amazon.com/kms/pricing/"&gt;AWS KMS pricing&lt;/a&gt; pages for current details.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;params2env&lt;/code&gt; provides four main subcommands for complete parameter management.
The &lt;strong&gt;read&lt;/strong&gt; command retrieves parameters and outputs them as environment variables,
either to stdout or files. You can customize variable names, add prefixes,
control case conversion, and read multiple parameters from a YAML configuration file.
The &lt;strong&gt;create&lt;/strong&gt; command creates new parameters with support for both String and SecureString types.
The &lt;strong&gt;modify&lt;/strong&gt; command updates existing parameter values and descriptions while preserving the original parameter type.
The &lt;strong&gt;delete&lt;/strong&gt; command removes parameters from Parameter Store.&lt;/p&gt;
&lt;p&gt;The tool uses the AWS Go SDK for authentication and supports all standard AWS
credential methods including IAM roles, profiles, and environment variables.
Role assumption is built-in for working across different AWS accounts and regions.
For SecureString parameters, it handles KMS encryption and supports both AWS-managed
and customer-managed KMS keys. When working with replicas, it automatically handles
KMS key ARN conversion between regions.&lt;/p&gt;
&lt;p&gt;Configuration can be managed through YAML files with a clear precedence order:
command line arguments override local config files (&lt;code&gt;.params2env.yaml&lt;/code&gt;),
which override global config files (&lt;code&gt;~/.params2env.yaml&lt;/code&gt;).
This makes it flexible for both one-off commands and repeatable workflows.
The &lt;a class="reference external" href="https://git.sr.ht/~wombelix/params2env/tree/main/item/docs/INSTRUCTIONS.md"&gt;usage instructions&lt;/a&gt;
include detailed examples and configuration options.&lt;/p&gt;
&lt;p&gt;You can install directly with Go:&lt;/p&gt;
&lt;pre class="code text literal-block"&gt;
go install git.sr.ht/~wombelix/params2env&amp;#64;latest

&lt;/pre&gt;
&lt;p&gt;or pre-build binaries from the &lt;a class="reference external" href="https://github.com/wombelix/params2env/releases"&gt;Releases&lt;/a&gt; page.&lt;/p&gt;
&lt;p&gt;Basic usage to read a parameter and set it as an environment variable:&lt;/p&gt;
&lt;pre class="code text literal-block"&gt;
# Output to stdout
params2env read --path &amp;quot;/my/secret&amp;quot;

# Set in current shell
eval $(params2env read --path &amp;quot;/my/secret&amp;quot;)

# Write to file
params2env read --path &amp;quot;/my/secret&amp;quot; --file ~/.env

&lt;/pre&gt;
&lt;p&gt;Note: Only use eval with trusted sources. Since params2env outputs shell commands,
ensure you trust the parameter values and the tool itself before executing the output in your shell.&lt;/p&gt;
&lt;p&gt;Creating parameters:&lt;/p&gt;
&lt;pre class="code text literal-block"&gt;
# String parameter
params2env create --path &amp;quot;/my/param&amp;quot; --value &amp;quot;hello&amp;quot;

# SecureString with KMS
params2env create --path &amp;quot;/my/secret&amp;quot; --value &amp;quot;s3cret&amp;quot; \
  --type SecureString --kms &amp;quot;alias/myapp-key&amp;quot;

&lt;/pre&gt;
&lt;p&gt;For managing multiple parameters, you can use a YAML configuration file:&lt;/p&gt;
&lt;pre class="code text literal-block"&gt;
region: eu-central-1
role: arn:aws:iam::123456789012:role/my-role
env_prefix: APP_
params:
  - name: /app/db/url
    env: DB_URL
  - name: /app/db/password
    env: DB_PASSWORD

&lt;/pre&gt;
&lt;p&gt;Then run &lt;code&gt;params2env read&lt;/code&gt; to process all configured parameters.&lt;/p&gt;
&lt;p&gt;The replica feature is not an AWS native feature, it is something I've built into the tool.
It performs create, edit, or delete operations in two regions
instead of just one. AWS KMS supports custom keys to have identical backup keys
in another region. This way you have your key material and secrets region redundant
if you want that with minimal overhead and costs. This is useful for disaster recovery
scenarios or when you need the same secrets available in multiple regions for your applications.&lt;/p&gt;
&lt;p&gt;The code is organized into packages: &lt;code&gt;cmd&lt;/code&gt; handles CLI interactions,
&lt;code&gt;internal/aws&lt;/code&gt; manages AWS SDK operations, &lt;code&gt;internal/config&lt;/code&gt; handles YAML parsing,
&lt;code&gt;internal/validation&lt;/code&gt; provides input validation, and &lt;code&gt;internal/logger&lt;/code&gt; manages logging.
Input validation happens before AWS API calls to check parameter paths, regions,
KMS key formats, and IAM role ARNs.&lt;/p&gt;
&lt;p&gt;The project includes both unit tests and integration tests.
Unit tests focus on business logic validation.
Integration tests in &lt;code&gt;tests/integration-tests.sh&lt;/code&gt; validate real AWS service interactions,
including parameter creation, modification, deletion, and role assumption.
The build system uses a Makefile with targets for &lt;code&gt;build&lt;/code&gt;, &lt;code&gt;tests&lt;/code&gt;, and &lt;code&gt;clean&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Parts of the tool were built with AI assistance. I started with Cursor about
half a year ago, curious how well it would work to describe the program features
and implementation details, let AI create a design document, then use the AI agent
to build out structure and functionality based on that guide. It went surprisingly
well but required many iterations and improvements.&lt;/p&gt;
&lt;p&gt;When I recently continued work on &lt;code&gt;params2env&lt;/code&gt;, I used Amazon Q Developer to get
up to speed on what I had implemented in an unfinished feature branch.
I compared it with existing features and the original planning doc to identify
what was missing.&lt;/p&gt;
&lt;p&gt;I still wrote the majority of the code myself and worked on improvements through multiple iterations.
But AI saved time and suggested ideas and solutions I might not have thought of
or would have taken longer to develop.&lt;/p&gt;
&lt;p&gt;Overall I think such AI tools are a positive thing and can make
some tasks easier and faster. But they are not a magic solution that builds applications
automatically end to end. Similar to my experience with
&lt;a class="reference external" href="https://dominik.wombacher.cc/posts/dns-management-with-opentofu-and-some-ai-assistance.html"&gt;DNS management with OpenTofu and some AI assistance&lt;/a&gt;,
it was a useful experiment in understanding what these tools can contribute.&lt;/p&gt;
&lt;p&gt;Building &lt;code&gt;params2env&lt;/code&gt; was another great opportunity to improve my skills in Go development,
AWS SDK usage, and CLI tool design.&lt;/p&gt;
</content><category term="Code"/><category term="AWS"/><category term="SSM"/><category term="Go"/><category term="Golang"/><category term="CLI"/><category term="OpenSource"/><category term="ParameterStore"/><category term="AI"/></entry><entry><title>AWS CloudFormation and CDK doesn't support AWS SSM Parameter Store SecureString?!</title><link href="https://dominik.wombacher.cc/posts/aws-cloudformation-and-cdk-doesnt-support-aws-ssm-parameter-store-securestring.html" rel="alternate"/><published>2024-05-12T00:00:00+02:00</published><updated>2024-07-17T00:00:00+02:00</updated><author><name>Dominik Wombacher</name></author><id>tag:dominik.wombacher.cc,2024-05-12:/posts/aws-cloudformation-and-cdk-doesnt-support-aws-ssm-parameter-store-securestring.html</id><summary type="html">&lt;!-- SPDX-FileCopyrightText: 2024 Dominik Wombacher &lt;dominik@wombacher.cc&gt; --&gt;
&lt;!--  --&gt;
&lt;!-- SPDX-License-Identifier: CC-BY-SA-4.0 --&gt;
&lt;p&gt;I recently started to set up some resources on AWS for my side projects.
For starters an AWS KMS key so I can encrypt data on S3 and in the  ... &lt;a class="read-more" href="/posts/aws-cloudformation-and-cdk-doesnt-support-aws-ssm-parameter-store-securestring.html"&gt; [read more]&lt;/a&gt;&lt;/p&gt;</summary><content type="html">&lt;!-- SPDX-FileCopyrightText: 2024 Dominik Wombacher &lt;dominik@wombacher.cc&gt; --&gt;
&lt;!--  --&gt;
&lt;!-- SPDX-License-Identifier: CC-BY-SA-4.0 --&gt;
&lt;p&gt;I recently started to set up some resources on AWS for my side projects.
For starters an AWS KMS key so I can encrypt data on S3 and in the AWS SSM Parameter Store.
To use S3 and DynamoDB as backend and perform end-to-end state encryption for OpenTofu,
I also needed an IAM User. So the Idea was to write a CloudFormation template that
creates all these resources for me and then use it to deploy other Infrastructure as code via OpenTofu.
I'm not a huge fan of IAM Users and access keys, but in this case good enough to get started.&lt;/p&gt;
&lt;p&gt;What I wanted: The generated access and secret key are stored in AWS SSM Parameter store.
That way I don't have to deal with clear text credentials in CloudFormation.&lt;/p&gt;
&lt;p&gt;SSM Parameter Store can save Strings and SecureStrings. As the name implies, a SecureString
is encrypted via AWS KMS before put into SSM Parameter Store. But then I learned, neither Cfn nor CDK
support it. They can only write clear text Strings to the Parameter Store. What a bummer and pretty unexpected.&lt;/p&gt;
&lt;p&gt;So after some research, a Cfn CustomResource is what I need. It's basically a Lambda function
that receives a Create/Update/Delete request from Cfn, performs an action and sends the result back to the Stack.
It took me a bit to get something together but now it works like a charm.&lt;/p&gt;
&lt;p&gt;I'm still a bit disappointed that such a common feature isn't supported. Arguments are mostly
that Cfn and CDK are not supposed to deal with secrets. I can understand that, but putting some
data that were generated during a Cfn run into the parameter store can't be that unique.&lt;/p&gt;
&lt;p&gt;I published my Lambda Function to interact with AWS SSM Parameter Store SecureString under MIT:
&lt;a class="reference external" href="https://git.sr.ht/~wombelix/cfn-custom-resource-aws-ssm-securestring"&gt;https://git.sr.ht/~wombelix/cfn-custom-resource-aws-ssm-securestring&lt;/a&gt;&lt;/p&gt;
</content><category term="Cloud"/><category term="AWS"/><category term="SSM"/><category term="CloudFormation"/><category term="CDK"/><category term="Lambda"/></entry></feed>