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

If you're not sure about the file name format, learn more about wheel file names.

cfp-1.0.0a3-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file cfp-1.0.0a3-py3-none-any.whl.

File metadata

  • Download URL: cfp-1.0.0a3-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for cfp-1.0.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 3df95650e5e3b49857ccd49e932ab26b393ebbd608c81d7d455fef37e3468f93
MD5 f8d58d94ef65e3e3ff50715e0e0e3c2f
BLAKE2b-256 f29e6283bbf21ab4b7de08b80c18b4c26ef0c9141242cb731d01192249d3821d

See more details on using hashes here.

Supported by

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