OpenControl
Reference doc for the `sst.aws.OpenControl` component.
The OpenControl component lets you create centralized OpenControl servers on AWS. It
deploys OpenControl to AWS Lambda.
Create an OpenControl server
const server = new sst.aws.OpenControl("MyServer", { server: "src/server.handler"});Where the server function might look like this.
import { handle } from "hono/aws-lambda";import { create } from "opencontrol";import { tool } from "opencontrol/tool";
const myTool = tool({ name: "my_tool", description: "Get the most popular greeting", async run() { return "Hello, world!"; },});
const app = create({ key: process.env.OPENCONTROL_KEY, tools: [myTool],});
export const handler = handle(app);Learn more on the OpenControl docs on how to
configure the server function.
Constructor
new OpenControl(name, args, opts?)Parameters
-
namestring -
argsOpenControlArgs -
opts?ComponentResourceOptions
OpenControlArgs
server
Type Input<string | FunctionArgs>
The function that’s running your OpenControl server.
{ server: "src/server.handler"}You can also pass in the full FunctionArgs.
{ server: { handler: "src/server.handler", link: [table] }}Since the server function is a Hono app, you want to export it with the Lambda adapter.
import { handle } from "hono/aws-lambda";import { create } from "opencontrol";
const app = create({ // ...});
export const handler = handle(app);Learn more on the OpenControl docs on how to
configure the server function.
Properties
nodes
nodes.server
Type Output<Function>
The Function component for the server.
url
Type Output<string>
The URL of the OpenControl server.