Skip to main content

Builds Amazon Web Services CloudFormation parameters

Project description

cfp

CircleCI codecov

cfp is a Python package for building Amazon Web Services CloudFormation stack parameters.

In particular, cfp helps to efficiently reference parameter values in Parameter Store, even across accounts and regions.

The output is compatible with boto3.

Examples

from cfp import StackParameters

sp = StackParameters()
sp.add("ParameterA", "Value A")
sp.add("ParameterB", "Value B")

print(sp.api_parameters)
[{'ParameterKey': 'ParameterA', 'ParameterValue': 'Value A'}, {'ParameterKey': 'ParameterB', 'ParameterValue': 'Value B'}]

The api_parameters property can be passed directly to boto3:

from cfp import StackParameters
from boto3.session import Session

sp = StackParameters()
sp.add("ParameterA", "Value A")
sp.add("ParameterB", "Value B")

client = session.client("cloudformation")
client.create_change_set(
    StackName="MyStack",
    ChangeSetName="MyChangeSet",
    ChangeSetType="UPDATE,
    Parameters=sp.api_parameters,
    TemplateBody="...",
)

To look-up a value in Systems Manager Parameter Store, set the parameter's value to a .FromParameterStore instance:

from cfp import FromParameterStore, StackParameters

sp = StackParameters()
sp.add("ParameterA", FromParameterStore("/cfp/example1"))
sp.add("ParameterB", FromParameterStore("/cfp/example2"))

print(sp.api_parameters)
[{'ParameterKey': 'ParameterA', 'ParameterValue': 'foo'}, {'ParameterKey': 'ParameterB', 'ParameterValue': 'bar'}]

Read the full documentation at cariad.github.io/cfp.

👋 Hello!

Hello! I'm Cariad Eccleston and I'm an independent/freelance software engineer. If my work has value to you, please consider sponsoring.

If you ever raise a bug, request a feature or ask a question then mention that you're a sponsor and I'll respond as a priority. Thank you!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

cfp-1.0.0a5-py3-none-any.whl (12.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page