This is a simple demo that showcases a common use case of AWS AppConfig.
The infrastructure is defined as a set of nested CloudFormation templates. Just package and deploy the master template located in templates/main.yaml
. You can do this easily with the AWS CLI:
# Create an S3 bucket for storing the processed templates, if you don't have
# one already (otherwise you can skip this)
aws s3 mb s3://<your-bucket-name>
# Package all the templates
aws cloudformation package \
--template-file ./templates/main.yaml \
--s3-bucket <your-bucket-name> \
--output-template-file ./templates/processed.yaml
# And now deploy them
aws cloudformation deploy \
--stack-name aws-appconfig-demo \
--template-file ./templates/processed.yaml \
--capabilities CAPABILITY_IAM
The stack output includes a link to the ALB endpoint.
The template deploys an ECS service which runs a mock music API. Invoking the ALB (and thus the service) returns a list of music albums:
[
{
"artist": "Michael Jackson",
"title": "Thriller"
},
{
"artist": "Elton John",
"title": "Leather Jackets"
},
{
"artist": "The Beatles",
"title": "Abbey Road"
},
{
"artist": "The Whispers",
"title": "The Whispers"
}
]
Customers have asked that the API also returns the album release year. The development team in charge of this service has already implemented this, but since they work with Feature Toggles (a.k.a. Feature Flags), the API does not yet return that attribute. The last step is to enable the feature.
Instead of deploying a new version of the app (which might take some time, depending on the specifics of it), we'll just update the configuration file containing the flags and propagate them to the instances of the app, which are already running.
The template has created the necessary AppConfig resources. Let's just deploy a new configuration:
- Go to the AppConfig console: https://eu-west-1.console.aws.amazon.com/systems-manager/appconfig/?region=eu-west-1 (ensure that the region is the one where you deployed the CloudFormation stack).
- Click on the
aws-appconfig-demo
app to view its details. - Go to the
Configuration profiles
tab. - Click on the
app
profile. You'll see there a configuration version already deployed (version 1). This was created for you by the CloudFormation template. - Click on
Create
next to the Version dropdown. - Select
JSON
as the content type, and change theincludeReleaseYear
attribute totrue
in the content box (which should have been populated already with the previous configuration). - Click on Create hosted configuration version.
Now let's deploy it:
- Click on Start deployment.
- Select the
prod
environment, version2
, and deployment strategyCustom.Immediate.Bake5Mins
. - Click on Start deployment.
The deployment will begin, and should be instantaneous. The demo app includes a script that runs every minute and checks if there are new configurations available. Wait for a minute and then refresh the app. The response should now include the release year:
[
{
"artist": "Michael Jackson",
"title": "Thriller",
"year": 1982
},
{
"artist": "Elton John",
"title": "Leather Jackets",
"year": 1986
},
{
"artist": "The Beatles",
"title": "Abbey Road",
"year": 1969
},
{
"artist": "The Whispers",
"title": "The Whispers",
"year": 1979
}
]
The demo is still a Work in Progress. Some of the things we're working on:
- Monitors and automated rollbacks.
- Deployments across a large fleet of containers with different strategies.
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.