Cost Allocation Tags – tracking costs of your EC2 instances

AWS provides Cost Allocation Tags to track costs of instances so you can separately track costs in different Stacks / Environments – e.g. Development and Production

See also here on Activating these Tags:

Jinja Templates and JSON with Python

  1. Loading up a Jinja Template and some JSON using Python then outputting that JSON in the template:

import jinja2, yaml, json

templateFilePath = jinja2.FileSystemLoader('./')
jinjaEnv = jinja2.Environment(loader=templateFilePath)
jTemplate = jinjaEnv.get_template("template.j2")

with open('api.json') as f:
    json_out = json.load(f)

print jTemplate.render(json_out=json_out)


{{ json_out }}



2. Outputting the value of api when done is true




{% if json_out['done'] == 'true' %}
{{ json_out['api'] }}
{% endif %}

See also: