Thursday, October 16, 2025

AWS CDK Set Parameter Store Value

Problem:

There are multiple ways to set a parameter store value. Which one should I use?

Solution:

1. Set parameter at deploy time:

Use this pattern when you want to create or update a plain-text SSM parameter during deployment. Creates an AWS::SSM::Parameter resource that resolves at deploy time.

new ssm.StringParameter(this, 'Param', {
  parameterName: '/my/plain/parameter',
  stringValue: 'my-value',
});

2.   Set parameter with a JSON value:

Use when you need to store structured data (e.g., configuration or mapping) as a JSON string.
The object is serialized with JSON.stringify() before being written to SSM.

new ssm.StringParameter(this, 'JsonParam', {
  parameterName: '/app/config',
  stringValue: JSON.stringify({
    apiUrl: 'https://api.example.com',
    featureFlags: { enableNewUI: true, betaAccess: false },
  }),
});

To read it back, retrieve the value and parse it:.

const config = JSON.parse(ssm.StringParameter
  .fromStringParameterAttributes(this, 'JsonParamRef', {
    parameterName: '/app/config',
  })
  .stringValue);

3.  Set parameter with a lazy value:

Use when the parameter value depends on another construct (e.g., a pipeline name) and must be evaluated dynamically at synth. cdk.Lazy defers the value computation until synthesis.

new ssm.StringParameter(this, 'LazyParam', {
  parameterName: '/pipeline/name',
  stringValue: cdk.Lazy.string({
    produce: () => pipeline.pipeline.pipelineName,
  }),
});

Wednesday, July 2, 2025

VSCode Simple Formatter Setup

Question: What is a simple VSCode formatter setup across projects that require different formatters?

Answer:

VSCode user settings are stored outside the project on local.

VSCode workspace settings are stored in .vscode\settings.json. So in a team environment do set workspace settings and commit to repo. That way the entire team has the same formatter setting.

  • In  File > Preferences > Settings, Enable Format On Save. Simple best/common practice.

  • In  File > Preferences > Settings, Workspace level, set Default Formatter. Different projects are likely to need different formatters. Old projects are probably using old formatters while new projects will want to use new formatters.

Thursday, June 19, 2025

User Guide Mini Crane Scale KLAU Model OCS-L

I purchased this scale and it came with this booklet. However, I couldn't find this guide online so I've copied it here for easy reference.