• Documentation
  • Pricing
© 2026 Serverless, Inc. All rights reserved.

Framework

  • Overview
  • Documentation
  • Plugins360
  • Pricing

Learn

  • Blog
  • GuidesUpdated
  • Examples240
  • Courses

Resources

  • Support
  • Security
  • Trust Center
  • Status

Community

  • Slack
  • GitHub47k
  • Forum
  • Meetups

Company

  • About
  • Careers
  • Contact
  • Partners

Legal

  • Terms of Service
  • Privacy Policy
  • Trademark
  • DMCA
Serverless Framework Logo

Serverless Framework

Intro
SetupUpgrading To V4ConceptsTutorialAWS CredentialsLicense KeysVerifying Downloads
DeployingPackagingBuildingTestingDev ModeServicesFunctions
OverviewHTTP (API Gateway v2)REST (API Gateway v1)ActiveMQApplication Load BalancerAlexa SkillAlexa Smart HomeCloudWatch EventCloudWatch LogCloudFrontCognito User PoolEventBridge EventIoTIoT Fleet ProvisioningKafkaKinesis & DynamoDBMSKRabbitMQS3ScheduleSNSSQSWebsocket
Layers
OverviewTroubleshooting
Managed InstancesWeb Apps (Lambda Web Functions)Sandboxes (Lambda MicroVMs)MCP ServersAlertsVersion PruningDomainsIAM Function PermissionsParameters
OverviewSelf-reference serverless.ymlServerless CoreEnvironment VariablesCLI OptionsExternal YAML/JSON FilesJavascript propertiesGitDoppler
OverviewS3 ObjectsSSM Parameter Store & Secrets ManagerCloudFormation Stack Outputs
OverviewVaultTerraform State Output
ResourcesComposing ServicesDeployment BucketStateAgent SkillsPython support
OverviewRuntimeGatewayMemoryBrowserCode InterpreterDev Mode
API Gateway Proxy
OverviewGeneral ConfigurationAuthenticationAPI KeysData SourcesResolversPipeline FunctionsSubstitutionsCachingDelta SyncCustom DomainWAFCLI Commands
Deploying SAM/CFN TemplatesWorkflow Tips
OverviewCreating PluginsCLI OutputCustom CommandsCustom VariablesExtending the Configuration schemaExtending and overriding configuration
OverviewDashboardAxiom
Overviewagent docsagent inspectagent setupagent skills installagent skills list / readdeploydeploy functiondeploy listdevdiffinfoinvokeinvoke localloginlogin awslogin aws ssologsmetricspackageplugin installplugin uninstallprintprunereconcileremoverollbackrollback functionusage
OverviewConcepts
OverviewMetricsTracesTroubleshoot
OverviewNode.jsPython
OutputsProviders
OverviewBranch DeploymentsPreview DeploymentsCustom ScriptsTestingPrivate PackagesNotificationsMono ReposDeploy in your own CI/CDBest PracticesTroubleshootingFAQ
OverviewSetupToolsAWS Integration
Serverless.yml Reference
Examples and TutorialsConfiguration Validation
  1. Usage
  2. Cloud Extensions
  3. Overview

Cloud Extensions (AWS Systems Manager Cloud Extensions)

The cloudExtensions key gives Lambda functions AWS Systems Manager Cloud Extensions: a runtime inside each execution environment that answers Parameter Store, Secrets Manager and AWS AppConfig reads from a local cache. For Parameter Store and Secrets Manager, your code keeps its usual AWS SDK client and points it at http://localhost:5333; AppConfig reads are signed HTTP requests to the same address. The Framework creates the Cloud Extensions profiles, their entries and IAM roles, adds the runtime layer and sets the profile variable on each function.

Use Cloud Extensions when functions read the same parameters, secrets or configuration on many invocations and you want those reads cached without writing cache code. Use ${ssm:...} variables instead for values that are fixed at deploy time.

Quick start

Prerequisites:

  • Serverless Framework v4 and AWS credentials that can deploy the resources in IAM permissions to deploy Cloud Extensions.
  • A Region where Cloud Extensions is available (Regions and endpoints).
  • A parameter to read:
aws ssm put-parameter --name /myapp/db-host --type String --value db.example.com

This serverless.yml gives every function the Parameter Store extension, with its own role that may read parameters under /myapp/:

# serverless.yml
service: myapp

provider:
  name: aws
  runtime: python3.15
  region: us-east-1
  cloudExtensions:
    aws:parameterstore:
      iam:
        role:
          statements:
            - Effect: Allow
              Action:
                - ssm:GetParameter
                - ssm:GetParameters
              Resource: arn:aws:ssm:${aws:region}:${aws:accountId}:parameter/myapp/*

functions:
  api:
    handler: handler.handler

The handler reads the parameter with the SSM client of the AWS SDK, pointed at the Parameter Store extension:

# handler.py
import boto3

ssm = boto3.client("ssm", endpoint_url="http://localhost:5333/parameterstore")


def handler(event, context):
    parameter = ssm.get_parameter(Name="/myapp/db-host")["Parameter"]
    return {"dbHost": parameter["Value"]}

Deploy and invoke the function:

serverless deploy
serverless invoke --function api

The deploy output lists the extension and the version it runs, and the invocation returns the value:

functions:
  api: myapp-dev-api (313 B)

cloud extensions:
  myapp-dev: aws:parameterstore 1.0.0
{
    "dbHost": "db.example.com"
}

To remove the service with its profile, entry and role, run serverless remove. The parameter isn't part of the service, so delete it separately:

aws ssm delete-parameter --name /myapp/db-host

What the Framework creates for Cloud Extensions

For each deploy of a service with cloudExtensions, the Framework adds these to the CloudFormation stack:

  • Profiles: one Cloud Extensions profile per distinct set of extensions, shared by every function with that set (Profiles and the 25-profile limit). Each profile's description is Managed by Serverless Framework for <service>-<stage>: followed by its functions.
  • Profile entries: one per extension in a profile, with its version policy, approved capabilities and settings.
  • Extension roles: one IAM role per entry whose iam.role is an object, trusted by the functions that use the profile (Who can assume an extension role).
  • On each attached function: the Cloud Extensions runtime layer for the function's architecture (x86_64 or arm64), read at package time from AWS's public parameter /aws/service/aws-cloudextensions/lambda-layer-<architecture>, and the environment variable AWS_CLOUDEXTENSIONS_PROFILE set to the profile name. A function on a profile the Framework creates depends on that profile's entries, so it never starts before its profile exists.
  • On function roles the Framework creates: cloudextensions:SyncState on *, which the runtime uses to read its profile. Function roles get no sts:AssumeRole permission.

Stack tags reach the profiles and entries. The runtime writes its log lines to the function's log group, as JSON: on each cold start, a few lines at INFO as it starts and loads each extension, before the function's own output. They appear in serverless logs and serverless invoke --log.

Cold starts and memory

The runtime starts in every execution environment of an attached function, so cold starts take longer. In a test in December 2026 with a Python 3.12 function at 256 MB, initialization took 1.0 to 1.3 seconds with the runtime and 0.37 seconds without it, and the environment used 39 to 65 MB more memory (106 and 132 MB against 67 MB). A warm read answered from the cache took about 20 ms through the AWS SDK. Set cloudExtensions: false on functions that read nothing through the extensions (Turn extensions off for a function).

Cost of Cloud Extensions

AWS charges nothing extra for Cloud Extensions, the runtime or the extensions. The services the extensions call bill as usual: a cache miss in the Parameter Store extension is a Parameter Store API call (pricing).

Read values through the extensions

The runtime serves each extension at http://localhost:5333/<extension>. Requests are signed with the function's own credentials, which the AWS SDK does by default. Each execution environment has its own runtime and its own cache.

ExtensionCapability to approveLocal endpointOperations served
aws:parameterstoreparameterStoreReadhttp://localhost:5333/parameterstoreGetParameter, GetParameters
aws:secretsmanagersecretsmanagerhttp://localhost:5333/secretsmanagerGetSecretValue
aws:appconfigappconfigdatahttp://localhost:5333/appconfig/GetConfiguration, GetFlag (HTTP)

Any other operation sent to a local endpoint answers No operation matches the request. Keep a second client with the default endpoint for writes and for reads such as GetParametersByPath. Don't set AWS_ENDPOINT_URL_SSM or AWS_ENDPOINT_URL_SECRETS_MANAGER for this: those variables send every call of that service to the extension.

Parameter Store and Secrets Manager with the AWS SDK

To read through the Parameter Store or Secrets Manager extension, set the client's endpoint and call the SDK as usual. In Python:

import boto3

ssm = boto3.client("ssm", endpoint_url="http://localhost:5333/parameterstore")
secrets = boto3.client("secretsmanager", endpoint_url="http://localhost:5333/secretsmanager")

db_host = ssm.get_parameter(Name="/myapp/db-host")["Parameter"]["Value"]
stripe_key = secrets.get_secret_value(SecretId="billing/stripe-key")["SecretString"]

In Node.js, with the AWS SDK for JavaScript v3 (add @aws-sdk/client-ssm and @aws-sdk/client-secrets-manager to package.json):

// handler.mjs
import { SSMClient, GetParameterCommand } from '@aws-sdk/client-ssm'
import {
  SecretsManagerClient,
  GetSecretValueCommand,
} from '@aws-sdk/client-secrets-manager'

const ssm = new SSMClient({ endpoint: 'http://localhost:5333/parameterstore' })
const secrets = new SecretsManagerClient({
  endpoint: 'http://localhost:5333/secretsmanager',
})

export const handler = async () => {
  const { Parameter } = await ssm.send(
    new GetParameterCommand({ Name: '/myapp/db-host' }),
  )
  const { SecretString } = await secrets.send(
    new GetSecretValueCommand({ SecretId: 'billing/stripe-key' }),
  )
  return { dbHost: Parameter.Value, hasKey: SecretString.length > 0 }
}

In other AWS SDKs, set the client's endpoint override to the same URL. GetParameter with WithDecryption returns a decrypted SecureString. If the SecureString uses a customer managed key, the role the extension calls AWS with also needs kms:Decrypt on that key.

AppConfig with a signed request

The AppConfig extension has no AWS SDK client: code sends a SigV4-signed POST to http://localhost:5333/appconfig/ with the header X-Amz-Target: AppConfig.GetConfiguration (or AppConfig.GetFlag), signed for the service appconfig with the function's credentials. The response's content is the configuration, base64-encoded.

In Node.js, add @smithy/signature-v4 and @aws-crypto/sha256-js to package.json:

// handler.mjs
import { SignatureV4 } from '@smithy/signature-v4'
import { Sha256 } from '@aws-crypto/sha256-js'

const ENDPOINT = 'http://localhost:5333/appconfig/'

// Signs with the function's own credentials, which Lambda sets in the environment
const signer = new SignatureV4({
  service: 'appconfig',
  region: process.env.AWS_REGION,
  credentials: {
    accessKeyId: process.env.AWS_ACCESS_KEY_ID,
    secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
    sessionToken: process.env.AWS_SESSION_TOKEN,
  },
  sha256: Sha256,
})

const getConfiguration = async (params) => {
  const body = JSON.stringify(params)
  const { headers } = await signer.sign({
    method: 'POST',
    protocol: 'http:',
    hostname: 'localhost',
    port: 5333,
    path: '/appconfig/',
    headers: {
      host: 'localhost:5333',
      'content-type': 'application/x-amz-json-1.1',
      'x-amz-target': 'AppConfig.GetConfiguration',
    },
    body,
  })
  const response = await fetch(ENDPOINT, { method: 'POST', headers, body })
  const result = await response.json()
  if (!response.ok) throw new Error(`${result.__type}: ${result.message}`)
  return JSON.parse(Buffer.from(result.content, 'base64').toString())
}

export const handler = async () => {
  const settings = await getConfiguration({
    application: 'myapp',
    environment: 'dev',
    configuration: 'settings',
  })
  return { greeting: settings.greeting }
}

In Python, botocore signs the request:

# handler.py
import base64
import json
import os
import urllib.request

import boto3
from botocore.auth import SigV4Auth
from botocore.awsrequest import AWSRequest

ENDPOINT = "http://localhost:5333/appconfig/"
session = boto3.Session()


def get_configuration(params):
    body = json.dumps(params)
    request = AWSRequest(
        method="POST",
        url=ENDPOINT,
        data=body,
        headers={
            "Content-Type": "application/x-amz-json-1.1",
            "X-Amz-Target": "AppConfig.GetConfiguration",
        },
    )
    # Signs with the function's own credentials
    credentials = session.get_credentials().get_frozen_credentials()
    SigV4Auth(credentials, "appconfig", os.environ["AWS_REGION"]).add_auth(request)
    signed = urllib.request.Request(
        ENDPOINT, data=body.encode(), headers=dict(request.headers), method="POST"
    )
    with urllib.request.urlopen(signed) as response:
        result = json.load(response)
    return json.loads(base64.b64decode(result["content"]))


def handler(event, context):
    settings = get_configuration(
        {"application": "myapp", "environment": "dev", "configuration": "settings"}
    )
    return {"greeting": settings["greeting"]}

The AppConfig extension's role needs appconfig:StartConfigurationSession and appconfig:GetLatestConfiguration on the configuration:

provider:
  cloudExtensions:
    aws:appconfig:
      iam:
        role:
          statements:
            - Effect: Allow
              Action:
                - appconfig:StartConfigurationSession
                - appconfig:GetLatestConfiguration
              Resource: arn:aws:appconfig:${aws:region}:${aws:accountId}:application/*

For GetFlag and the request and response fields, see HTTP client examples for the AWS AppConfig extension.

Configure extensions per function

provider.cloudExtensions lists the extensions every function runs. functions.<name>.cloudExtensions changes that set for one function. Extension IDs such as aws:parameterstore sit directly under cloudExtensions.

The merge rules for a function's cloudExtensions:

  • Omitted: the function runs the provider's extensions.
  • A new extension ID: added to the provider's extensions.
  • An extension ID the provider also lists: merged field by field. Each of version, approve, settings and iam that the function sets replaces the provider's value; the others are inherited.
  • An extension ID set to false: drops that one extension.
  • cloudExtensions: false: drops every extension. The function gets no runtime layer, no variable and no cold-start cost.
  • profile: attaches an existing profile instead (Attach an existing profile).

This service shows every rule:

# serverless.yml
service: myapp

provider:
  name: aws
  runtime: python3.15
  cloudExtensions:
    aws:parameterstore:
      version: 1.x.x
      iam:
        role:
          statements:
            - Effect: Allow
              Action:
                - ssm:GetParameter
                - ssm:GetParameters
              Resource: arn:aws:ssm:${aws:region}:${aws:accountId}:parameter/myapp/*

functions:
  api:
    handler: api.handler
  billing:
    handler: billing.handler
    cloudExtensions:
      aws:secretsmanager:
        settings:
          security:
            ssrfToken: ${ssm:/myapp/ssrf-token}
        iam:
          role:
            statements:
              - Effect: Allow
                Action: secretsmanager:GetSecretValue
                Resource: arn:aws:secretsmanager:${aws:region}:${aws:accountId}:secret:billing/*
  legacy:
    handler: legacy.handler
    cloudExtensions:
      aws:parameterstore:
        version: 1.0.0
  report:
    handler: report.handler
    cloudExtensions:
      profile: platform-shared
  nightly:
    handler: nightly.handler
    cloudExtensions: false

For the billing function, the Framework reads the SSRF token from the Parameter Store parameter /myapp/ssrf-token at deploy time, so that parameter must exist before the deploy (The Secrets Manager SSRF token), and the profile platform-shared must exist for report to attach it.

The five functions use three profiles the Framework creates and one it attaches:

FunctionExtensionsProfile
apiaws:parameterstore from providermyapp-dev
billingaws:parameterstore from provider, plus aws:secretsmanagermyapp-dev-billing
legacyaws:parameterstore pinned at 1.0.0, with the provider's iammyapp-dev-legacy
reportWhatever platform-shared holdsplatform-shared
nightlyNoneNone

Turn extensions off for a function

To keep a function off the runtime, set cloudExtensions: false on it. To drop one inherited extension and keep the others, set that extension ID to false:

functions:
  worker:
    handler: worker.handler
    cloudExtensions:
      aws:parameterstore: false

Functions with a cloudFront event (Lambda@Edge) never get extensions, because Lambda@Edge takes no layers or environment variables. The only cloudExtensions value such a function takes is false; any other value stops the deploy (Troubleshooting Cloud Extensions). Web Apps under webApps don't take cloudExtensions.

Profiles and the 25-profile limit

AWS allows 25 Cloud Extensions profiles per account and Region, a quota it doesn't raise (quotas). The Framework therefore creates one profile per distinct merged set of extensions, and every function with the same set shares it:

  • The provider's set is the profile <service>-<stage>, such as myapp-dev.
  • Any other set is the profile <service>-<stage>-<function>, named after the alphabetically first function that uses the set, such as myapp-dev-billing.
  • Names are lowercased, each run of characters other than letters and digits becomes -, and leading and trailing dashes are removed. When the first part is a single character, the dash after it is dropped: service x-api at stage dev gives xapi-dev.
  • Profile names are at most 32 characters. A longer name is cut to 25 characters followed by - and a 6-character hash, so a long service and stage name gives hashed names. For service inventory-service at stage feature-1234, the provider's profile inventory-service-feature-1234 fits, and the profile of a billing function's set becomes inventory-service-feature-8d1877.
  • When two sets' names come out alike, such as owner functions a_b and a-b, the provider's set or else the alphabetically first owner keeps the name, and the other gets the first 25 characters followed by - and a 6-character hash of its owner function's name.
  • No profile is created for a set that no function uses, such as the provider's set when every function overrides it.

serverless info prints the name of each deployed profile of the service and of each profile it attaches by name (View extension versions with serverless info).

Two sets are the same when every extension has the same version, approve (in any order), settings and iam. To stay under the limit, give functions the same cloudExtensions, or attach one existing profile with profile.

When the function a profile is named after leaves the set, or an alphabetically earlier function joins it, the next deploy replaces the profile, its entries and its roles with ones named after the new first function. Leave iam.role.name unset on extension roles: a fixed role name is still taken by the old role while CloudFormation creates the new one, and the deploy stops.

The AWS_CLOUDEXTENSIONS_PROFILE variable

The Framework sets AWS_CLOUDEXTENSIONS_PROFILE on each attached function to its profile's name; the runtime loads that profile. Don't set the variable yourself. A value you set, on the function or in provider.environment, is accepted when it equals the profile name and stops the deploy otherwise. ${self:service}-${sls:stage} doesn't always equal the profile name, because the Framework normalizes profile names: a service named MyApp gets the profile myapp-dev. Functions without extensions keep any value you set.

Choose the extension version

version selects which releases of an extension the runtime runs:

  • A range such as 1.x.x, 1.x, 1 or 1.2.x: the runtime moves to new releases in that range on its own. The range must match a released version when you deploy: AWS refuses a range for future releases only, and the Framework stops at package time with Cloud Extensions lists no release of ... that matches version ....
  • An exact version such as 1.2.3: the runtime stays on that release.
  • Omitted: a new entry gets AWS's default, the newest major version with automatic updates. Removing version from an existing entry keeps the policy it was deployed with; write a range to switch a pinned entry back to automatic updates. To return to AWS's default, write version: 1.x.x.

version is a string. Quote a version that looks like a number, such as version: '1.10': unquoted, YAML reads 1.10 as the number 1.1, and the Framework stops with ... .version must be a string. A version set with a CloudFormation intrinsic needs approve: without it, the Framework can't read which capabilities that version requires, and stops with ... .version is set with a CloudFormation intrinsic.

The major version is always a number: there is no selector for any version. serverless info shows the version each entry runs.

Approve capabilities

An extension can use a capability, such as calling Parameter Store, only after you approve it. When approve is omitted, the Framework reads the extension's newest release that matches version at package time and approves the capabilities that release requires. With approve, the Framework sends exactly that list, which replaces the approvals stored on the entry, and checks at package time only that a release matches version:

provider:
  cloudExtensions:
    aws:parameterstore:
      approve:
        - parameterStoreRead

A list without a required capability, or with an unknown one, stops the deploy with AWS's error and a hint naming the capability (Troubleshooting Cloud Extensions). To list an extension's capabilities, run aws cloudextensions get-extension --identifier aws:parameterstore --query 'configuration.capabilities'.

Extension settings

settings passes an extension's settings to its profile entry as written. Removing settings from an existing entry resets them to the extension's defaults. Each extension's settings are listed in AWS's guides for the Parameter Store, Secrets Manager and AppConfig extensions.

Setting types through CloudFormation

As of December 2026, Cloud Extensions receives every setting that CloudFormation passes to a profile entry as a string, and rejects a string for a number or boolean setting with type(integer) or type(boolean). String settings, and lists of objects with string values such as the AppConfig extension's prefetchList, deploy as written. For a number or boolean setting, such as the Parameter Store extension's ttlSeconds:

  • leave it out, to use the extension's default, or
  • set it on the deployed entry with the AWS CLI. Find the entry ID with aws cloudextensions list-profile-entries --profile-identifier myapp-dev, then run aws cloudextensions update-profile-entry --profile-identifier myapp-dev --identifier ENTRY_ID --settings '{"ttlSeconds":30}'.

A setting set with the AWS CLI stays through later deploys, including ones that change the entry's version or approve, as long as the entry's settings in serverless.yml stay the same. A deploy that changes or removes those settings sends the entry's settings again and resets the ones set with the AWS CLI; set them again after such a deploy.

The Secrets Manager SSRF token

The Secrets Manager extension requires settings.security.ssrfToken, and a deploy without it, or without settings at all, stops with AWS's error and a hint (Troubleshooting Cloud Extensions). The token guards Secrets Manager's raw HTTP routes; reads through the AWS SDK don't use it. AWS stores the token in plain text in the profile entry, so use a value that is not another secret:

provider:
  cloudExtensions:
    aws:secretsmanager:
      settings:
        security:
          ssrfToken: ${ssm:/myapp/ssrf-token}

The ${ssm:/myapp/ssrf-token} variable reads the token from Parameter Store at deploy time, so create the parameter first:

aws ssm put-parameter --name /myapp/ssrf-token --type String --value "$(openssl rand -hex 16)"

The ssrfHeadersEnabled setting that turns the token check off is a boolean, so it can't be set through CloudFormation (Setting types through CloudFormation).

IAM for Cloud Extensions

Two roles take part in each read: the function's role, which the runtime runs as, and the role the extension calls AWS with. The extension's iam decides the second one.

Give an extension its own role

When iam.role is an object, the Framework creates a role for the extension's entry. The object takes the keys of provider.iam.role: statements, managedPolicies, permissionsBoundary, path, name and tags. Grant the actions on the resources the code reads, as in the quick start. The function's role needs no permission for those services.

Removing iam from an existing entry clears the entry's role, and the extension then calls AWS with the function's role.

Let the extension use the function's role

Without iam, the extension calls AWS with the function's role. Grant that role the reads in provider.iam.role.statements or the function's own iam.role.statements, as for any other AWS call. The Framework doesn't add them:

provider:
  name: aws
  runtime: nodejs26.x
  iam:
    role:
      statements:
        - Effect: Allow
          Action:
            - ssm:GetParameter
            - ssm:GetParameters
          Resource: arn:aws:ssm:${aws:region}:${aws:accountId}:parameter/myapp/*
  cloudExtensions:
    aws:parameterstore: {}

Without that statement, each read answers AccessDeniedException.

Who can assume an extension role

The runtime assumes an extension role for the function it runs in. A role the Framework creates trusts callers in the deploying account whose request comes from one of the profile's functions, in the first of these forms that fits IAM's limit of 2,048 characters for a trust policy:

  1. The functions: each function of the profile, by its ARN. Calls through aliases and versions count as the function. Functions with names of usual length fit up to about 15 to 30 per profile.
  2. The function roles: any Lambda function in the account and Region that runs with one of the roles the profile's functions use, listed by ARN.
  3. A role pattern: as form 2, with the roles the Framework names <service>-<stage>-... (the default role and per-function roles) matched by the pattern role<path><service>-<stage>-*, where the path is the roles' IAM path (/ unless set), so by default role/myapp-dev-*. The Framework uses this form only when form 2 doesn't fit, which takes many generated roles on one profile, such as provider.iam.role.mode: perFunction.

In every form, a caller outside Lambda, such as an administrator's session, can't assume the role.

Note: The role pattern of form 3 also matches roles of another service or stage whose <service>-<stage> starts with this one's followed by -: stage dev-eu next to stage dev, or a service named api-dev next to service api at stage dev. Lambda functions in the same account and Region running with such a role can then use the extension role. Creating such a role takes iam:CreateRole or iam:PassRole. To avoid the overlap, use service and stage names that don't extend each other, or put fewer functions with their own roles on one profile.

A function whose FunctionName, set in resources.extensions, refers to another resource of the template, such as a Ref to a parameter-free resource, isn't listed in form 1, so the role uses form 2 or 3 and never waits for the function. Names built from parameters and pseudo parameters are listed.

Forms 2 and 3 name a custom role in resources by its ARN when the role sets RoleName, and through Fn::GetAtt when it doesn't, so the extension role then waits for that role. If that role in turn depends on the profile, for example through a policy that names one of the profile's functions, CloudFormation reports a circular dependency that names both roles before it changes the stack. Set RoleName on that role.

When even form 3 doesn't fit, because the profile's functions use many different custom roles, the deploy stops before CloudFormation with an error that names the functions.

Use an existing role

When iam.role is an ARN, the logical ID of a role in resources, or a CloudFormation reference (Fn::GetAtt, Fn::ImportValue or Fn::Sub), the entry uses that role as it is. The Framework creates no role and doesn't change the role's trust. The role needs:

  • permissions for what the extension reads;
  • a trust policy that lets the roles of the attached functions assume it, by ARN.

This role in resources trusts the default function role of the service:

provider:
  cloudExtensions:
    aws:parameterstore:
      iam:
        role: !GetAtt ParameterStoreReaderRole.Arn

resources:
  Resources:
    ParameterStoreReaderRole:
      Type: AWS::IAM::Role
      Properties:
        AssumeRolePolicyDocument:
          Version: '2012-10-17'
          Statement:
            - Effect: Allow
              Principal:
                AWS: !GetAtt IamRoleLambdaExecution.Arn
              Action: sts:AssumeRole
        Policies:
          - PolicyName: read-parameters
            PolicyDocument:
              Version: '2012-10-17'
              Statement:
                - Effect: Allow
                  Action:
                    - ssm:GetParameter
                    - ssm:GetParameters
                  Resource: !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/myapp/*

IamRoleLambdaExecution exists only when the service uses the default role. With per-function roles or custom roles, list each function's role instead. An existing role suits a role that several services share: list the function roles of every service that uses it.

The SyncState permission on function roles

The runtime reads its profile with the function's role, which needs cloudextensions:SyncState on *. The Framework adds it to the default role when at least one attached function runs with that role in the final template, after resources.extensions, and to the role it creates for each attached function that gets a role of its own, through iam.role settings on the function or provider.iam.role.mode: perFunction. A custom role, an imported role or a role made by a plugin needs it added by you:

resources:
  Resources:
    MyFunctionRole:
      Type: AWS::IAM::Role
      Properties:
        # ... trust policy and other statements
        Policies:
          - PolicyName: cloud-extensions-runtime
            PolicyDocument:
              Version: '2012-10-17'
              Statement:
                - Effect: Allow
                  Action: cloudextensions:SyncState
                  Resource: '*'

Without it the function starts, and every read through an extension answers BadGatewayException (Troubleshooting Cloud Extensions).

IAM permissions to deploy Cloud Extensions

Besides what every deploy needs, the identity that deploys a service with cloudExtensions needs:

  • ssm:GetParameter on arn:aws:ssm:<region>::parameter/aws/service/aws-cloudextensions/*, to read the runtime layer (also for serverless package).
  • cloudextensions:ListExtensionVersions and cloudextensions:GetExtension, for entries without approve (also for serverless package). For an entry with both approve and version, the Framework uses them to check that a release matches version, and skips that check when the identity lacks them.
  • cloudextensions:CreateProfile, GetProfile, UpdateProfile, DeleteProfile, CreateProfileEntry, GetProfileEntry, UpdateProfileEntry, DeleteProfileEntry, TagResource, UntagResource and ListTagsForResource.
  • iam:PassRole on the extension roles, and the IAM permissions to create the roles the Framework makes.
  • cloudextensions:ListProfileEntries, for the serverless info section and the profile check of serverless deploy function, which also reads the stack's resources with cloudformation:ListStackResources when a profile is missing.

With provider.iam.deploymentRole set, CloudFormation makes the profile and entry calls with that role, so grant them to it.

Attach an existing profile

profile attaches a profile that already exists, by name or ID, instead of a set of extensions. On provider, it attaches every function that sets neither false nor its own profile:

provider:
  cloudExtensions:
    profile: platform-shared

profile can't sit beside extension IDs at the same level, and with provider.cloudExtensions.profile, a function can't list extension IDs: a function reads one profile, and the Framework can't add extensions to a profile it didn't create. To give one function other extensions, attach another profile with functions.<name>.cloudExtensions.profile.

For an attached profile, the Framework adds only the runtime layer, the variable and cloudextensions:SyncState. The profile's owner decides who can use its extension roles:

  • A profile another Framework service created trusts only that service's functions, so reads from your functions are refused with a generic error such as Error connecting to the service.
  • To share one profile across services, its owner gives each entry an existing role that trusts the function roles of every service that attaches it, or no role, so each extension calls AWS with the calling function's role.

Container image functions

Functions deployed from a container image (image) get the profile, the variable, cloudextensions:SyncState and the trust like any other function, but no layer: Lambda doesn't add layers to images. Copy the runtime into the image with this Dockerfile line:

COPY --from=public.ecr.aws/aws-cloudextensions/cloudextensions-runtime:latest /usr/local/bin/aws-cloudx-rt /opt/extensions/aws-cloudx-rt

The image public.ecr.aws/aws-cloudextensions/cloudextensions-runtime is published for x86_64 and arm64. An image keeps the runtime it was built with until you rebuild it; the extensions still follow their version. The Framework can't see inside the image, so an image without the runtime deploys, and its reads can't connect to localhost:5333 (Connection refused). Image functions that read nothing through the extensions should set cloudExtensions: false.

Functions in a VPC

The runtime reads its profile from cloudextensions.<region>.api.aws, and the extensions call Parameter Store, Secrets Manager or AppConfig, and AWS STS to assume an extension role. A function in a VPC needs a route to those endpoints: a NAT gateway, or interface VPC endpoints such as com.amazonaws.<region>.cloudextensions for Cloud Extensions (network security). Without a route, the runtime gives up after about 2 seconds, the function starts, and reads answer The runtime couldn't retrieve its profile. The runtime will retry.

Managed Instances

Functions with a capacityProvider (Managed Instances) are attached like any other function. As of December 2026, Lambda Managed Instances don't accept the event registration the Cloud Extensions runtime makes, so the function doesn't initialize and the deploy stops with FunctionError.ExtensionInitError and a hint. Set cloudExtensions: false on functions with a capacityProvider, or run them without one.

Run functions locally

serverless dev and serverless invoke local run your handler on your machine, where no runtime listens on port 5333. With --docker, serverless invoke local packages the service first, so the container gets the runtime layer and the variable, with your local AWS credentials instead of the function's role:

  • The container runs the Docker daemon's architecture, so it gets the runtime layer for that architecture, whatever the function's architecture: an arm64 function runs with the x86_64 runtime on an x86_64 daemon. The daemon is usually your machine; with a remote DOCKER_HOST, it is that host. If the daemon doesn't report its architecture, the Framework uses your machine's. When DOCKER_DEFAULT_PLATFORM is set, for example to linux/arm64, Docker runs the container for that platform, and the container gets the runtime layer for it.
  • An extension role the Framework creates trusts only calls from the service's Lambda functions, so reads through an extension with iam can't assume it there, and the code gets InternalFailure: Error connecting to the service (Troubleshooting Cloud Extensions).
  • Behind a proxy that inspects TLS traffic, the runtime in the container can't reach AWS until it trusts the proxy's certificate authority (Troubleshooting Cloud Extensions).

To run the same code in Lambda and locally, use the local endpoint only when the runtime listens, and call the services directly otherwise. In Node.js:

// handler.mjs
import net from 'node:net'
import { SSMClient, GetParameterCommand } from '@aws-sdk/client-ssm'

// In Lambda, the runtime listens on port 5333 before the handler loads
const runtimeListens = () =>
  new Promise((resolve) => {
    const socket = net.connect(5333, 'localhost')
    socket.once('connect', () => {
      socket.end()
      resolve(true)
    })
    socket.once('error', () => resolve(false))
  })

const ssm = new SSMClient(
  (await runtimeListens())
    ? { endpoint: 'http://localhost:5333/parameterstore' }
    : {},
)

export const handler = async () => {
  const { Parameter } = await ssm.send(
    new GetParameterCommand({ Name: '/myapp/db-host' }),
  )
  return { dbHost: Parameter.Value }
}

In Python:

# handler.py
import socket

import boto3


def runtime_listens():
    try:
        socket.create_connection(("localhost", 5333), timeout=0.2).close()
        return True
    except OSError:
        return False


ssm = boto3.client(
    "ssm",
    **({"endpoint_url": "http://localhost:5333/parameterstore"} if runtime_listens() else {}),
)

Called directly, the services see the credentials of the local run: in Dev Mode the function's role, with invoke local your own. Those credentials need the read permissions that the extension role holds in AWS.

Deploy a single function

serverless deploy function sets the runtime layer and AWS_CLOUDEXTENSIONS_PROFILE on the function it deploys, as a full deploy computes them. It never creates or changes profiles, entries or roles, so a change to a function's cloudExtensions that changes its set needs serverless deploy. Before it changes the function, deploy function checks that the function's profile exists, and stops when it doesn't, naming the recovery: serverless deploy for a profile the stack doesn't hold yet (Troubleshooting Cloud Extensions), two deploys for a profile deleted outside the stack (Troubleshooting Cloud Extensions). The check takes cloudextensions:ListProfileEntries; when the deploying identity lacks it, deploy function skips the check. When the function's layers, its own or provider.layers, include a CloudFormation intrinsic, such as Ref, deploy function keeps the layers the last full deploy set.

deploy function adds the runtime layer for the architecture of the deployed function, which it doesn't change. For a function that doesn't use Cloud Extensions yet, it stops before the update when the function runs with a role the Framework manages, which first needs cloudextensions:SyncState, or when its environment holds a CloudFormation intrinsic, which deploy function doesn't apply, so the profile variable wouldn't reach the function. This includes container image functions, which get no layer. Run serverless deploy for that first attachment (Troubleshooting Cloud Extensions).

View extension versions with serverless info

serverless info and serverless deploy print a cloud extensions section with one line per extension of each deployed profile the stack created and each profile the service attaches by name or ID: the profile, the extension ID, the version it runs and, when a newer release exists, the latest version. A profile the stack created and a function also attaches by name or ID is listed once. A profile attached with a CloudFormation intrinsic isn't listed.

cloud extensions:
  myapp-dev: aws:parameterstore 1.0.0
  myapp-dev-billing: aws:parameterstore 1.0.0
  myapp-dev-billing: aws:secretsmanager 1.0.0
  platform-shared: not readable (AccessDeniedException)

A profile the command can't read gets not readable with the AWS error code. Reading the section takes cloudextensions:ListProfileEntries, besides the cloudformation:ListStackResources that serverless info already uses. The section isn't part of serverless info --json.

Configuration reference

provider.cloudExtensions

The extensions every function runs, or an existing profile to attach. Optional; no default. An object whose keys are either:

  • extension IDs, <namespace>:<name> such as aws:parameterstore, aws:secretsmanager or aws:appconfig, each set to an extension object. An extension ID with an empty value (aws:parameterstore: with nothing after it) means default settings, as {} does; or
  • profile: an existing profile's name (2 to 32 characters, lowercase letters, digits, - and _, starting with a letter) or ID, or a CloudFormation intrinsic. Not with extension IDs.

Any other key stops the deploy with ... is not an extension ID.

Applies to every function in functions except Lambda@Edge functions.

functions.<name>.cloudExtensions

This function's extensions, merged into provider.cloudExtensions by extension ID. Optional; default: the provider's extensions. Takes the same keys as provider.cloudExtensions, and also:

  • false as the whole value: no extensions for this function.
  • false for one extension ID: drops that inherited extension.

Only false is allowed on a function with a cloudFront event.

Extension object

The settings of one extension, all optional; {} uses the defaults, except for an extension with required settings, such as the Secrets Manager extension's settings.security.ssrfToken (The Secrets Manager SSRF token):

  • version: string, quoted when it looks like a number; a range (1, 1.x, 1.x.x, 1.2, 1.2.x, * in place of x) that matches a released version, or an exact version (1.2.3). Default: AWS's, the newest major version with automatic updates (Choose the extension version).
  • approve: list of 1 to 100 capability IDs, sent exactly as listed. Default: the capabilities the matching release requires (Approve capabilities).
  • settings: object, passed to the entry as written. Default: the extension's defaults (Extension settings).
  • iam.role: required inside iam. An object with statements, managedPolicies, permissionsBoundary, path, name and tags, for a role the Framework creates; or, for an existing role, an ARN, the logical ID of a role in resources, or Fn::GetAtt, Fn::ImportValue or Fn::Sub. Default: no role, so the extension uses the function's role (IAM for Cloud Extensions).

Troubleshooting Cloud Extensions

Deploy errors and failed reads, each with its cause and fix, are listed on Troubleshooting Cloud Extensions.

Related

  • Layers: the function layers list the runtime layer joins.
  • IAM Permissions for Functions: function roles, per-function roles and custom roles.
  • SSM Parameter Store and Secrets Manager Variables: read values at deploy time instead.
  • Connecting AWS Lambda functions to Cloud Extensions in the AWS Systems Manager User Guide.
Edit this page
Prev LayersNextTroubleshooting

Contents

  • Cloud Extensions (AWS Systems Manager Cloud Extensions)
  • Quick start
  • What the Framework creates for Cloud Extensions
  • Cold starts and memory
  • Cost of Cloud Extensions
  • Read values through the extensions
  • Parameter Store and Secrets Manager with the AWS SDK
  • AppConfig with a signed request
  • Configure extensions per function
  • Turn extensions off for a function
  • Profiles and the 25-profile limit
  • The AWS_CLOUDEXTENSIONS_PROFILE variable
  • Choose the extension version
  • Approve capabilities
  • Extension settings
  • Setting types through CloudFormation
  • The Secrets Manager SSRF token
  • IAM for Cloud Extensions
  • Give an extension its own role
  • Let the extension use the function's role
  • Who can assume an extension role
  • Use an existing role
  • The SyncState permission on function roles
  • IAM permissions to deploy Cloud Extensions
  • Attach an existing profile
  • Container image functions
  • Functions in a VPC
  • Managed Instances
  • Run functions locally
  • Deploy a single function
  • View extension versions with serverless info
  • Configuration reference
  • provider.cloudExtensions
  • functions.<name>.cloudExtensions
  • Extension object
  • Troubleshooting Cloud Extensions
  • Related

Related

GuidesPluginsExamplesSlack CommunitySupport