What I built
I built a GitHub Action that sets Heroku environment variables from the AWS SSM Parameter Store. This Action was created to efficiently synchronize environment variables when using both AWS and Heroku.
Category Submission:
DIY Deployments
App Link
ssm-to-heroku-env-action
GitHub Action that sets Heroku environment variables from AWS SSM Parameter Store This Action was created to efficiently synchronize when using the same environment variables on AWS and Heroku.
Inputs
Input | Required | Default | Info |
---|---|---|---|
path | Yes | N/A | The path to the environment variable in the AWS SSM Parameter Store that you want to set in Heroku |
Yes | N/A | Heroku email | |
token | Yes | N/A | Heroku token |
app | Yes | N/A | Heroku app name |
And you need to set AWS credentials by using like AWS Credentials for GitHub Actions.
Description
First of all, this actions retrieve environment variables from AWS SSM Parameter Store specifying path
input. This mean when you set like under CLI command, you can retrieve under '/test/'
recursively if you specified path as '/test/'
.
aws ssm put-parameter \
--name "/test/VALUE1" \
--value "test1" \
--type String \
--region "ap-northeast-3"
Authentication…
Screenshots
N/A
Description
This action retrieves environment variables from the AWS SSM Parameter Store using the specified path input. For example, if you have set a parameter with the following CLI command and specified the path as '/test/', the action will retrieve the parameter stored under '/test/'.
aws ssm put-parameter \
--name "/test/VALUE1" \
--value "test1" \
--type String \
--region "ap-northeast-3"
Authentication with Heroku is done by writing the email
and token
in the .netrc
file, as described in Heroku CLI Authentication. You can get your token from here. Additionally, you need to set your app name in the app
input.
Link to Source Code
Permissive License
MIT
Background (What made you decide to build this particular app? What inspired you?)
Honestly, it was mainly about money. 🥺
Initially, I had the application running on AWS, but the cost of maintaining it was a bit high, so I decided to switch to Heroku. However, there was still a possibility that I would use AWS in the future, so I stopped the resources without deleting them. As the application scales, the number of environment variables will grow, and managing them becomes a challenge. Since they were originally managed in the AWS SSM Parameter Store, migrating them would be cumbersome. Therefore, I decided to create an infrastructure with AWS as the master and Heroku as a reference.
How I built it (How did you utilize GitHub Actions or GitHub Codespaces? Did you learn something new along the way? Pick up a new skill?)
I learned how to authenticate Heroku by writing emails and tokens in the .netrc
file and the basics of AWS CLI.
I also learned the application of Interface and Class in TypeScript.
It was difficult to implement a generic interface.
Top comments (0)