Skip to content

aws-samples/aws-appconfig-feature-flags

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

AWS AppConfig Feature Flags example

Description

AWS AppConfig Feature Flags provide customers with the control to roll out new features at the rate that they want to introduce the change to their application. Customers can validate these changes to make sure that they are free of errors and match the expected input of their application. While deploying new values gradually, in case there is an error, AWS AppConfig can roll back the changes automatically to prevent any application outages.

To introduce you to AWS AppConfig Feature Flags, we’ll build a sample application that takes advantage of feature flags and show how the new managed experience works.

Read more in the blog post Introducing AWS AppConfig Feature Flags In Preview: https://aws.amazon.com/blogs/mt/introducing-aws-appconfig-feature-flags-in-preview/

Install the backend application

  1. Clone the repo onto your local development machine.
git clone https://github.com/aws-samples/aws-appconfig-feature-flags.git
  1. Run the following commands to change to the backend directory and install dependencies.
cd aws-appconfig-feature-flags
cd backend
npm install
  1. Process and build your application using the AWS SAM template file.
sam build
  1. Deploy the backend application using the following command and follow the prompts.
sam deploy --guided
  1. Add the IDs of the AppConfig Application, Environment, and Configuration Profile when prompted, and confirm all of the deployment prompts.
  2. In the output of the deployment, note the DynamoDBTableName key and the HTTPApiUrl key. You will get the output similar to the following:
Key DynamoDBTableName Description The name of your DynamoDB table Value sam-app-DynamoDBTable-XXXXXXXXXXX
Key HttpApiUrl Description URL of your API endpoint Value https://XXXXXXXX.execute-api.XX-XXXXXXXX-1.amazonaws.com

Populate DynamoDB table with sample data

  1. Open the template file dynamodb.json.template and replace YOUR_DYNAMODB_TABLE_NAME with the DynamoDBTableName key from sam deploy output. Save the file as dynamodb.json.
  2. Run the following command to populate the DynamoDB table with sample data:
aws dynamodb batch-write-item --request-items file://dynamodb.json
  1. You will get the following output:
{
"UnprocessedItems": {}
}

Install the front-end application

  1. Change to the frontend directory and install the dependencies using
cd frontend
npm install
  1. Open the template file config.json.template in the folder src and replace YOUR_API_ENDPOINT with the HTTPApiUrl key from sam deploy output. Save the file as config.json.
  2. Start the local development server.
npm start
  1. Open http://localhost:3000/ in your browser to view the web application.

Remove the sample application

Delete the CloudFormation stack via CLI:

aws cloudformation delete-stack --stack-name YOUR-STACK-NAME

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.