API Reference
    Preparing search index...

    Module @aws-lambda-powertools/feature-flags

    Powertools for AWS Lambda (TypeScript) - Feature Flags

    Powertools for AWS Lambda (TypeScript) is a developer toolkit to implement Serverless best practices and increase developer velocity.

    The Feature Flags utility evaluates flags against caller-supplied context. Use a local rule engine over a Powertools for Python freeform Flag Document, AWS AppConfig Agent-selected variants, or your own Store. Every evaluation has an explicit fallback for a missing flag or an availability failure.

    Install the core utility for local rules or custom Stores:

    npm install @aws-lambda-powertools/feature-flags
    
    import {
    FeatureFlags,
    ruleEngineStore,
    } from '@aws-lambda-powertools/feature-flags';

    const flags = new FeatureFlags({
    store: ruleEngineStore({
    source: async () => ({
    checkout_v2: {
    default: false,
    rules: {
    premium_customers: {
    when_match: true,
    conditions: [{ action: 'EQUALS', key: 'tier', value: 'premium' }],
    },
    },
    },
    }),
    }),
    });

    export const handler = async () => {
    return flags.evaluate({
    name: 'checkout_v2',
    context: { tier: 'premium' },
    default: false,
    });
    };

    See the Feature Flags documentation for AppConfig installation, IAM permissions, variants, result validation, and testing.

    If you are interested in contributing to this project, please refer to our Contributing Guidelines.

    Follow issue #3754 for Feature Flags implementation progress.

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

    appconfig
    appconfig-agent
    envelope
    errors
    index
    types