x-ssm_parameter

Syntax reference
x-ssm_paramter:
  parameter-name:
    Properties: {}
    MacroParameters: {}
    Settings: {}
    Services: {}
    Lookup: {}

Create new SSM Parameters, including from local files with optional transformations.

Services

Define services
Services:
  serviceA:
    Access: RW
  serviceB:
    Access: RO

IAM Permissions

ECS Compose-X defined access names:

  • RW : Allow read/write to the parameter including by path

  • RWStrict: Similarly to RW, without ByPath support

  • RO: Allow read only to the parameter including by path

  • ROStrict: Similarly to RO, without ByPath support

Properties

Refer to AWS CFN SSM Parameter Documentation . We support all of the definition and test with the documentation examples.

Simple examples for x-ssm_parameter
---
# Blog applications

version: '3.8'

x-ssm_parameter:
  parameterA:
    Properties:
      DataType: text
      Description: Something
      Name: /some/parameter
      Type: String
      Value: ABCD

  parameterB:
    Properties:
      DataType: text
      Description: Something
      Name: /some/other-parameter
      Type: String
      Value: ABCD

    Services:
      - name: bignicefamily
        access: RW

  parameterC:
    Properties:
      Name: /some/yet-other-parameter
      Type: String
    MacroParameters:
      FromFile: ./use-cases/ssm/test_json.json
      ValidateJson: true
      MinimizeJson: true
    Services:
      - name: rproxy
        access: RO
      - name: youtoo
        access: SSMParameterReadPolicy

  parameterD:
    Properties:
      Name: /some/yet-other-parameter
      Type: String
    MacroParameters:
      FromFile: ./use-cases/ssm/test_yaml.yaml
      ValidateYaml: true
    Services:
      - name: rproxy
        access: RO
      - name: youtoo
        access: SSMParameterReadPolicy

  parameterS:
    Properties:
      Name: /some/yet-other-parameter
      Type: String
    MacroParameters:
      FromFile: ./use-cases/ssm/test_yaml.yaml
      ValidateYaml: true
      RenderToJson: true
    Services:
      - name: rproxy
        access: RO
      - name: youtoo
        access: SSMParameterReadPolicy

  parameterENCODED:
    Properties:
      Name: /some/yet-other-parameter
      Type: String
    MacroParameters:
      FromFile: ./use-cases/ssm/test_yaml_jinja2.yaml
      EncodeToBase64: true
    Services:
      - name: rproxy
        access: RO
      - name: youtoo
        access: SSMParameterReadPolicy

MacroParameters

MacroParameters:
    FromFile: path/to/file/from/command_exec
    ValidateJson: true|false
    MinimizeJson: true|false
    IgnoreInvalidJson: true|false
    ValidateYaml: true|false
    IgnoreInvalidYaml: true|false
    RenderToJson: true|false

FromFile

Path to file that you want to read the content of as the value for the SSM Parameter.

Warning

Do not use binary type content, only text should be used

ValidateJson

If the input is a file and you expect it to be a valid JSON, this will validate whether the value is correct. Fails the execution if is not

IgnoreInvalidJson

Allows to ignore the JSON validation errors

MinimizeJson

If your input is nicely indented etc, this allows to compact it into a minimize JSON

ValidateYaml

When using a file, allows to ensure that the structure and content is a valid YAML

IgnoreInvalidYaml

Allows to ignore the YAML validation errors

RenderToJson

This allows to render a content written in YAML for human friendly-ness, into a minimized JSON

Warning

This will require that the input is valid YAML and will ignore if not.

Settings

See the Settings for more details.

Hint

Given AWS SSM Parameter is serverless, there is no Subnets override.

Lookup

For more details, see the Lookup .

Lookup DynamoDB Table example
x-ssm_parameter:
  parameterA:
    Lookup:
      Tags:
        - owner: myself
        - costallocation: 123
    Services:
      - name: serviceA
        access: SSMParameterReadPolicy

JSON Schema

Model

x-ssm_parameter

x-ssm_parameter.spec.json

x-ssm_parameter specification

type

object

properties

  • Lookup

x-resources.common.spec.json#/definitions/Lookup

  • Use

type

string

  • Properties

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html

type

object

  • Settings

x-resources.common.spec.json#/definitions/Settings

  • MacroParameters

type

object

properties

  • FromFile

Path to the file to read the content of and set as Value

type

string

  • ValidateJson

Whether or not the content should be a valid JSON

type

boolean

  • MinimizeJson

When set to yes, will load are dump JSON string without indentation

type

boolean

default

True

  • IgnoreInvalidJson

If the JSON encoding failed, allows to ignore and use default content

type

boolean

default

False

  • ValidateYaml

Whether or not the content should be a valid Yaml

type

boolean

  • RenderToJson

When set to yes, will transform the object loaded in YAML and set it into JSON

type

boolean

default

True

  • IgnoreInvalidYaml

If the Yaml encoding failed, allows to ignore and use default content

type

boolean

default

False

  • EncodeToBase64

Whether the content should be encoded to base64

type

boolean

default

False

additionalProperties

False

  • Services

x-resources.common.spec.json#/definitions/Services

Definition

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "id": "x-ssm_parameter.spec.json",
  "$id": "x-ssm_parameter.spec.json",
  "title": "x-ssm_parameter",
  "description": "x-ssm_parameter specification",
  "type": "object",
  "properties": {
    "Lookup": {
      "$ref": "x-resources.common.spec.json#/definitions/Lookup"
    },
    "Use": {
      "type": "string"
    },
    "Properties": {
      "type": "object",
      "description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html"
    },
    "Settings": {
      "$ref": "x-resources.common.spec.json#/definitions/Settings"
    },
    "MacroParameters": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "FromFile": {
          "type": "string",
          "description": "Path to the file to read the content of and set as Value"
        },
        "ValidateJson": {
          "type": "boolean",
          "description": "Whether or not the content should be a valid JSON"
        },
        "MinimizeJson": {
          "type": "boolean",
          "default": true,
          "description": "When set to yes, will load are dump JSON string without indentation"
        },
        "IgnoreInvalidJson": {
          "type": "boolean",
          "default": false,
          "description": "If the JSON encoding failed, allows to ignore and use default content"
        },
        "ValidateYaml": {
          "type": "boolean",
          "description": "Whether or not the content should be a valid Yaml"
        },
        "RenderToJson": {
          "type": "boolean",
          "default": true,
          "description": "When set to yes, will transform the object loaded in YAML and set it into JSON"
        },
        "IgnoreInvalidYaml": {
          "type": "boolean",
          "default": false,
          "description": "If the Yaml encoding failed, allows to ignore and use default content"
        },
        "EncodeToBase64": {
          "type": "boolean",
          "description": "Whether the content should be encoded to base64",
          "default": false
        }
      }
    },
    "Services": {
      "$ref": "x-resources.common.spec.json#/definitions/Services"
    }
  }
}

Test files

You can find the test files here to use as reference for your use-case.