

# Installing the AWS Systems Manager Cloud Extensions runtime

The Cloud Extensions runtime manages extension lifecycle, permissions, updates, and telemetry. AWS Systems Manager Cloud Extensions supports two installation methods: as an AWS Lambda extension, and as a container image from Amazon ECR. The Systems Manager console doesn't install the runtime. You install the runtime yourself, in each Lambda function or container that uses Cloud Extensions.

**Topics**
+ [Install for Lambda functions](#cloud-extensions-runtime-install-for-lambda-functions)
+ [Install for containers](#cloud-extensions-runtime-install-for-containers)
+ [Configuration options](#cloud-extensions-runtime-configuration-options)
+ [Runtime behavior](#cloud-extensions-runtime-runtime-behavior)
+ [Next steps](#cloud-extensions-runtime-next-steps)

## Install for Lambda functions
<a name="cloud-extensions-runtime-install-for-lambda-functions"></a>

AWS Systems Manager Cloud Extensions publishes its Lambda extension ARNs as public parameters in AWS Systems Manager Parameter Store. Use the ARN for your Lambda function's architecture.

### Step 1: Get the extension ARN
<a name="cloud-extensions-runtime-step-1-get-the-extension-arn"></a>

For x86\_64 functions:

```bash
aws ssm get-parameter \
  --name /aws/service/aws-cloudextensions/lambda-extension/amd64/latest \
  --query 'Parameter.Value' \
  --output text
```

For arm64 functions:

```bash
aws ssm get-parameter \
  --name /aws/service/aws-cloudextensions/lambda-extension/arm64/latest \
  --query 'Parameter.Value' \
  --output text
```

### Step 2: Add the extension to your function
<a name="cloud-extensions-runtime-step-2-add-the-extension-to-your-function"></a>

Add the ARN as a layer on your Lambda function:

```bash
aws lambda update-function-configuration \
  --function-name my-function \
  --layers {{extension-arn}}
```

To add it at function creation:

```bash
aws lambda create-function \
  --function-name my-function \
  --runtime python3.12 \
  --role arn:aws:iam::123456789012:role/my-function-role \
  --handler index.handler \
  --zip-file fileb://function.zip \
  --layers {{extension-arn}}
```

### Step 3: Verify the extension is running
<a name="cloud-extensions-runtime-step-3-verify-the-extension-is-running"></a>

After your Lambda function invokes, check the logs for startup messages from the runtime:

```
INFO starting version=1.0.430
INFO serving http addr=localhost:5333
INFO retrieved profile from service profile=my-application profileId=3jzf0v5xs4m
INFO profile loaded extensions=1
```

### Infrastructure as code
<a name="cloud-extensions-runtime-infrastructure-as-code"></a>

**AWS CloudFormation:**

```yaml
Resources:
  MyFunction:
    Type: AWS::Lambda::Function
    Properties:
      FunctionName: my-function
      Runtime: python3.12
      Role: !GetAtt MyFunctionRole.Arn
      Handler: index.handler
      Code:
        ZipFile: |
          def handler(event, context):
            return {"statusCode": 200}
      Layers:
        - !Sub
          - "{{resolve:ssm:/aws/service/aws-cloudextensions/lambda-extension/amd64/latest}}"
          - {}
```

**AWS Cloud Development Kit (AWS CDK):**

```typescript
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as ssm from 'aws-cdk-lib/aws-ssm';
const extensionArn = ssm.StringParameter.valueForStringParameter(
  this,
  '/aws/service/aws-cloudextensions/lambda-extension/amd64/latest'
);
const fn = new lambda.Function(this, 'MyFunction', {
  runtime: lambda.Runtime.PYTHON_3_12,
  handler: 'index.handler',
  code: lambda.Code.fromAsset('lambda'),
  layers: [
    lambda.LayerVersion.fromLayerVersionArn(this, 'CloudExtensionsLayer', extensionArn)
  ],
});
```

## Install for containers
<a name="cloud-extensions-runtime-install-for-containers"></a>

For containerized applications, pull the Cloud Extensions runtime image from Amazon ECR and use it as a base image or sidecar.

### Pull the runtime image
<a name="cloud-extensions-runtime-pull-the-runtime-image"></a>

```bash
docker pull public.ecr.aws/aws-cloudextensions/runtime:1.x
```

The image includes the Cloud Extensions runtime.

### Use as a base image
<a name="cloud-extensions-runtime-use-as-a-base-image"></a>

Add Cloud Extensions to your existing container by using it as a base image:

```
FROM public.ecr.aws/aws-cloudextensions/runtime:1.x AS runtime
FROM your-base-image:latest
# Copy the runtime binary from the Cloud Extensions image
COPY --from=runtime {{runtime-binary-path}} {{runtime-binary-path}}
# Start both the runtime and your application
CMD aws-cloudx-rt run & exec /app/start.sh
```

### Use as a sidecar container
<a name="cloud-extensions-runtime-use-as-a-sidecar-container"></a>

For orchestrators that support sidecar containers, run the runtime alongside your application container:

**Docker Compose example:**

```yaml
services:
  app:
    image: my-app:latest
    depends_on:
      - cloud-extensions-runtime
    environment:
      - CLOUD_EXTENSIONS_ENDPOINT=http://localhost:5333
  cloud-extensions-runtime:
    image: public.ecr.aws/aws-cloudextensions/runtime:1.x
    network_mode: "service:app"
    environment:
      - AWS_REGION=us-east-1
```

## Configuration options
<a name="cloud-extensions-runtime-configuration-options"></a>

The runtime accepts configuration through command-line flags or environment variables.

### HTTP endpoint
<a name="cloud-extensions-runtime-http-endpoint"></a>

Host and port where extensions listen for requests:

```bash
aws-cloudx-rt run --http-host localhost --http-port 5333
```

**Default:** `localhost:5333`. To disable the HTTP endpoint, set `--http-port 0`.

### Profile name
<a name="cloud-extensions-runtime-profile-name"></a>

Name of the Cloud Extensions profile to load:

```bash
aws-cloudx-rt run --profile my-profile
```

**Default:** `$default`

### Poll interval
<a name="cloud-extensions-runtime-poll-interval"></a>

How often the runtime checks for profile updates:

```bash
aws-cloudx-rt run --poll-interval 45000ms
```

**Default:** `45000ms` (45 seconds)

### Log level
<a name="cloud-extensions-runtime-log-level"></a>

Verbosity of runtime logs:

```bash
aws-cloudx-rt run --log-level info
```

**Values:** `debug`, `info`, `warn`, `error`, `none`. **Default:** `info`

### Service region
<a name="cloud-extensions-runtime-service-region"></a>

AWS region for service calls:

```bash
aws-cloudx-rt run --service-region us-west-2
```

**Default:** Determined from instance metadata or AWS configuration.

### Proxy configuration
<a name="cloud-extensions-runtime-proxy-configuration"></a>

Configure an HTTP or HTTPS proxy:

```bash
aws-cloudx-rt run --proxy-url https://proxy.example.com:8080
```

### Request timeout
<a name="cloud-extensions-runtime-request-timeout"></a>

Duration the runtime waits for AWS service responses:

```bash
aws-cloudx-rt run --request-timeout 15000ms
```

**Default:** `15000ms` (15 seconds)

## Runtime behavior
<a name="cloud-extensions-runtime-runtime-behavior"></a>

When the runtime starts:

1. **Profile retrieval** – The runtime retrieves the configured profile from the Cloud Extensions service

1. **Extension loading** – The runtime loads each extension that you configured in the profile

1. **HTTP routes** – The runtime registers HTTP routes for each extension at `localhost:5333/{{extension-path}}`

1. **Polling** – The runtime polls for profile changes every 45 seconds

1. **Automatic updates** – When you add, remove, or update extensions in the profile, the runtime applies the changes automatically

### Profile synchronization
<a name="cloud-extensions-runtime-profile-synchronization"></a>

The runtime checks for profile updates every 45 seconds. When you add or remove an extension from the profile, or update extension configuration, the runtime applies those changes within one poll cycle without restarting.

### Extension hash verification
<a name="cloud-extensions-runtime-extension-hash-verification"></a>

When loading extensions, the runtime verifies the extension hash. If a hash mismatch occurs, the runtime logs a warning, refetches the correct version from the service, and loads the updated extension.

## Next steps
<a name="cloud-extensions-runtime-next-steps"></a>
+ [Getting started with AWS Systems Manager Cloud Extensions](cloud-extensions-getting-started.md)
+ [Working with AWS Systems Manager Cloud Extensions profiles](cloud-extensions-profiles.md)
+ [Monitoring AWS Systems Manager Cloud Extensions](cloud-extensions-monitoring.md)
+ [Installation issues](cloud-extensions-troubleshooting.md#cloud-extensions-troubleshooting-installation-issues)