Skip to content

AWS.GreengrassV2 reference

Source: src/AWS/GreengrassV2/BatchAssociateClientDeviceWithCoreDevice.ts

Runtime binding for greengrass:BatchAssociateClientDeviceWithCoreDevice.

Associates up to 100 client devices with a core device so they can use it as their local MQTT broker — the write half of client-device fleet management. The caller supplies the core device thing name and the client device entries at runtime. Provide the implementation with Effect.provide(AWS.GreengrassV2.BatchAssociateClientDeviceWithCoreDeviceHttp).

BatchAssociateClientDeviceWithCoreDevice: Managing Client Devices

Section titled “BatchAssociateClientDeviceWithCoreDevice: Managing Client Devices”
// init — account-level binding, no resource argument
const associateClientDevices =
yield* AWS.GreengrassV2.BatchAssociateClientDeviceWithCoreDevice();
// runtime
const { errorEntries } = yield* associateClientDevices({
coreDeviceThingName: "MyCore",
entries: [{ thingName: "Sensor1" }, { thingName: "Sensor2" }],
});

BatchDisassociateClientDeviceFromCoreDevice

Section titled “BatchDisassociateClientDeviceFromCoreDevice”

Source: src/AWS/GreengrassV2/BatchDisassociateClientDeviceFromCoreDevice.ts

Runtime binding for greengrass:BatchDisassociateClientDeviceFromCoreDevice.

Removes up to 100 client-device associations from a core device — the cleanup half of client-device fleet management. The caller supplies the core device thing name and the client device entries at runtime. Provide the implementation with Effect.provide(AWS.GreengrassV2.BatchDisassociateClientDeviceFromCoreDeviceHttp).

BatchDisassociateClientDeviceFromCoreDevice: Managing Client Devices

Section titled “BatchDisassociateClientDeviceFromCoreDevice: Managing Client Devices”
// init — account-level binding, no resource argument
const disassociateClientDevices =
yield* AWS.GreengrassV2.BatchDisassociateClientDeviceFromCoreDevice();
// runtime
const { errorEntries } = yield* disassociateClientDevices({
coreDeviceThingName: "MyCore",
entries: [{ thingName: "RetiredSensor" }],
});

Source: src/AWS/GreengrassV2/CancelDeployment.ts

Runtime binding for greengrass:CancelDeployment.

Halts the bound Deployment’s rollout: core devices that already received it keep running its components, but devices that have not yet applied it never will. The deployment id is injected from the binding — the canonical emergency-stop for a bad rollout. Provide the implementation with Effect.provide(AWS.GreengrassV2.CancelDeploymentHttp).

// init — bind the operation to the deployment
const cancelDeployment = yield* AWS.GreengrassV2.CancelDeployment(deployment);
// runtime
yield* cancelDeployment();

Source: src/AWS/GreengrassV2/ComponentVersion.ts

An IoT Greengrass V2 component version created from an inline recipe. Components are software modules that run on Greengrass core devices.

Component versions are immutable in the cloud: any change to the recipe replaces the component version (a new name/version pair is registered and the previous one is deleted). Only tags are mutable in place.

ComponentVersion: Creating Component Versions

Section titled “ComponentVersion: Creating Component Versions”

Component from an inline JSON recipe

import * as GreengrassV2 from "alchemy/AWS/GreengrassV2";
const component = yield* GreengrassV2.ComponentVersion("Hello", {
recipe: JSON.stringify({
RecipeFormatVersion: "2020-01-25",
ComponentName: "com.example.Hello",
ComponentVersion: "1.0.0",
ComponentDescription: "Prints a greeting",
ComponentPublisher: "Example",
Manifests: [
{
Platform: { os: "linux" },
Lifecycle: { run: "echo hello" },
},
],
}),
});

Tagged component version

const component = yield* GreengrassV2.ComponentVersion("Hello", {
recipe,
tags: { team: "edge" },
});

Source: src/AWS/GreengrassV2/DeleteCoreDevice.ts

Runtime binding for greengrass:DeleteCoreDevice.

Deregisters a core device from IoT Greengrass (the backing IoT thing is untouched) — the fleet-decommissioning primitive for automation that retires devices. The caller supplies the core device thing name at runtime. Provide the implementation with Effect.provide(AWS.GreengrassV2.DeleteCoreDeviceHttp).

// init — account-level binding, no resource argument
const deleteCoreDevice = yield* AWS.GreengrassV2.DeleteCoreDevice();
// runtime
yield* deleteCoreDevice({ coreDeviceThingName: "RetiredCore" });

Source: src/AWS/GreengrassV2/Deployment.ts

An IoT Greengrass V2 continuous deployment that installs a set of component versions on a target IoT thing or thing group.

Updating the deployment’s components or name creates a new deployment revision for the target (the deploymentId attribute changes); the previous revision is canceled and deleted.

Deploy a component to a thing

import * as GreengrassV2 from "alchemy/AWS/GreengrassV2";
import * as IoT from "alchemy/AWS/IoT";
const core = yield* IoT.Thing("Core", {});
const component = yield* GreengrassV2.ComponentVersion("Hello", { recipe });
const deployment = yield* GreengrassV2.Deployment("Rollout", {
targetArn: core.thingArn,
components: {
[component.componentName]: {
componentVersion: component.componentVersion,
},
},
});

Deployment with a configuration update

const deployment = yield* GreengrassV2.Deployment("Rollout", {
targetArn: core.thingArn,
components: {
"com.example.Hello": {
componentVersion: "1.0.0",
configurationUpdate: { merge: JSON.stringify({ interval: 30 }) },
},
},
});

Source: src/AWS/GreengrassV2/DescribeComponent.ts

Runtime binding for greengrass:DescribeComponent.

Reads the bound ComponentVersion’s cloud metadata — publisher, description, lifecycle status (DEPLOYABLE, FAILED, DEPRECATED), platforms, and tags — so a function can audit component health before rolling out a deployment. The component version ARN is injected from the binding. Provide the implementation with Effect.provide(AWS.GreengrassV2.DescribeComponentHttp).

// init — bind the operation to the component version
const describeComponent = yield* AWS.GreengrassV2.DescribeComponent(component);
// runtime
const metadata = yield* describeComponent();
if (metadata.status?.componentState === "DEPRECATED") {
yield* Effect.logWarning(`${metadata.componentName} is deprecated`);
}

Source: src/AWS/GreengrassV2/GetComponent.ts

Runtime binding for greengrass:GetComponent.

Fetches the bound ComponentVersion’s recipe (JSON or YAML, as raw bytes) so a function can inspect or mirror the component definition. The component version ARN is injected from the binding. Provide the implementation with Effect.provide(AWS.GreengrassV2.GetComponentHttp).

// init — bind the operation to the component version
const getComponent = yield* AWS.GreengrassV2.GetComponent(component);
// runtime
const { recipe } = yield* getComponent({ recipeOutputFormat: "JSON" });
const text = new TextDecoder().decode(recipe);

Source: src/AWS/GreengrassV2/GetComponentVersionArtifact.ts

Runtime binding for greengrass:GetComponentVersionArtifact.

Mints a pre-signed download URL for one of the bound ComponentVersion’s artifacts (the same API core devices use to fetch artifacts during installation). The component version ARN is injected from the binding; the caller names the artifact. Provide the implementation with Effect.provide(AWS.GreengrassV2.GetComponentVersionArtifactHttp).

GetComponentVersionArtifact: Reading Components

Section titled “GetComponentVersionArtifact: Reading Components”
// init — bind the operation to the component version
const getArtifact = yield* AWS.GreengrassV2.GetComponentVersionArtifact(component);
// runtime
const { preSignedUrl } = yield* getArtifact({ artifactName: "installer.zip" });

Source: src/AWS/GreengrassV2/GetConnectivityInfo.ts

Runtime binding for greengrass:GetConnectivityInfo.

Reads a core device’s connectivity information — the endpoints and ports where client devices can reach the core’s local MQTT broker (the same data the IoT Greengrass discovery API serves). The caller supplies the core device’s thing name at runtime. Provide the implementation with Effect.provide(AWS.GreengrassV2.GetConnectivityInfoHttp).

GetConnectivityInfo: Managing Client Devices

Section titled “GetConnectivityInfo: Managing Client Devices”
// init — account-level binding, no resource argument
const getConnectivityInfo = yield* AWS.GreengrassV2.GetConnectivityInfo();
// runtime
const { connectivityInfo } = yield* getConnectivityInfo({
thingName: "MyCore",
});

Source: src/AWS/GreengrassV2/GetCoreDevice.ts

Runtime binding for greengrass:GetCoreDevice.

Reads one core device’s metadata — status (HEALTHY / UNHEALTHY), nucleus version, platform, and last status-update timestamp. Core devices register themselves (they are not Alchemy resources), so the caller supplies the core device thing name at runtime. Provide the implementation with Effect.provide(AWS.GreengrassV2.GetCoreDeviceHttp).

// init — account-level binding, no resource argument
const getCoreDevice = yield* AWS.GreengrassV2.GetCoreDevice();
// runtime
const device = yield* getCoreDevice({ coreDeviceThingName: "MyCore" });
yield* Effect.log(`${device.coreDeviceThingName} is ${device.status}`);

Source: src/AWS/GreengrassV2/GetDeployment.ts

Runtime binding for greengrass:GetDeployment.

Reads the bound Deployment’s full detail — status (ACTIVE, COMPLETED, CANCELED, FAILED), component specs, IoT job linkage, and whether it is still the latest revision for its target — so a function can monitor a rollout. The deployment id is injected from the binding. Provide the implementation with Effect.provide(AWS.GreengrassV2.GetDeploymentHttp).

// init — bind the operation to the deployment
const getDeployment = yield* AWS.GreengrassV2.GetDeployment(deployment);
// runtime
const detail = yield* getDeployment();
yield* Effect.log(`rollout is ${detail.deploymentStatus}`);

Source: src/AWS/GreengrassV2/ListClientDevicesAssociatedWithCoreDevice.ts

Runtime binding for greengrass:ListClientDevicesAssociatedWithCoreDevice.

Enumerates the client devices associated with a core device (the IoT things allowed to connect to the core’s local MQTT broker). The caller supplies the core device thing name at runtime. Provide the implementation with Effect.provide(AWS.GreengrassV2.ListClientDevicesAssociatedWithCoreDeviceHttp).

ListClientDevicesAssociatedWithCoreDevice: Managing Client Devices

Section titled “ListClientDevicesAssociatedWithCoreDevice: Managing Client Devices”
// init — account-level binding, no resource argument
const listClientDevices =
yield* AWS.GreengrassV2.ListClientDevicesAssociatedWithCoreDevice();
// runtime
const { associatedClientDevices } = yield* listClientDevices({
coreDeviceThingName: "MyCore",
});

Source: src/AWS/GreengrassV2/ListComponents.ts

Runtime binding for greengrass:ListComponents.

Enumerates the account’s component definitions (latest version of each), optionally scoped to PRIVATE or PUBLIC components — the entry point for fleet-software inventory tooling. Provide the implementation with Effect.provide(AWS.GreengrassV2.ListComponentsHttp).

// init — account-level binding, no resource argument
const listComponents = yield* AWS.GreengrassV2.ListComponents();
// runtime
const { components } = yield* listComponents({ scope: "PRIVATE" });

Source: src/AWS/GreengrassV2/ListComponentVersions.ts

Runtime binding for greengrass:ListComponentVersions.

Enumerates every registered version of a component, newest first. The caller supplies the component’s base ARN (arn:aws:greengrass:…:components:{name}, without the :versions: suffix). Provide the implementation with Effect.provide(AWS.GreengrassV2.ListComponentVersionsHttp).

// init — account-level binding, no resource argument
const listComponentVersions = yield* AWS.GreengrassV2.ListComponentVersions();
// runtime
const { componentVersions } = yield* listComponentVersions({
arn: componentBaseArn,
});

Source: src/AWS/GreengrassV2/ListCoreDevices.ts

Runtime binding for greengrass:ListCoreDevices.

Enumerates the account’s Greengrass core devices, optionally filtered by status (HEALTHY / UNHEALTHY), thing group, or nucleus runtime — the entry point for fleet-health dashboards. Provide the implementation with Effect.provide(AWS.GreengrassV2.ListCoreDevicesHttp).

// init — account-level binding, no resource argument
const listCoreDevices = yield* AWS.GreengrassV2.ListCoreDevices();
// runtime
const { coreDevices } = yield* listCoreDevices({ status: "UNHEALTHY" });

Source: src/AWS/GreengrassV2/ListDeployments.ts

Runtime binding for greengrass:ListDeployments.

Enumerates the account’s deployments, optionally filtered to one target thing/thing group or to the latest revision per target — a fleet-wide view of what is rolling out where. Provide the implementation with Effect.provide(AWS.GreengrassV2.ListDeploymentsHttp).

// init — account-level binding, no resource argument
const listDeployments = yield* AWS.GreengrassV2.ListDeployments();
// runtime
const { deployments } = yield* listDeployments({
historyFilter: "LATEST_ONLY",
});

Source: src/AWS/GreengrassV2/ListEffectiveDeployments.ts

Runtime binding for greengrass:ListEffectiveDeployments.

Enumerates the deployments that apply to a core device, with each one’s per-device execution status (SUCCEEDED, FAILED, IN_PROGRESS, …) — how a rollout monitor tracks a deployment landing on real hardware. The caller supplies the core device thing name at runtime. Provide the implementation with Effect.provide(AWS.GreengrassV2.ListEffectiveDeploymentsHttp).

ListEffectiveDeployments: Managing Core Devices

Section titled “ListEffectiveDeployments: Managing Core Devices”
// init — account-level binding, no resource argument
const listEffectiveDeployments = yield* AWS.GreengrassV2.ListEffectiveDeployments();
// runtime
const { effectiveDeployments } = yield* listEffectiveDeployments({
coreDeviceThingName: "MyCore",
});

Source: src/AWS/GreengrassV2/ListInstalledComponents.ts

Runtime binding for greengrass:ListInstalledComponents.

Enumerates the components actually installed on a core device (name, version, lifecycle state such as RUNNING or BROKEN, and last status report) — the ground truth for “what is this device really running”. The caller supplies the core device thing name at runtime. Provide the implementation with Effect.provide(AWS.GreengrassV2.ListInstalledComponentsHttp).

ListInstalledComponents: Managing Core Devices

Section titled “ListInstalledComponents: Managing Core Devices”
// init — account-level binding, no resource argument
const listInstalledComponents = yield* AWS.GreengrassV2.ListInstalledComponents();
// runtime
const { installedComponents } = yield* listInstalledComponents({
coreDeviceThingName: "MyCore",
});

Source: src/AWS/GreengrassV2/ResolveComponentCandidates.ts

Runtime binding for greengrass:ResolveComponentCandidates.

Resolves a set of component candidates against a target platform, returning the exact component versions (and their recipes) that satisfy the version requirements — the same dependency-resolution API the Greengrass nucleus calls during a deployment. Provide the implementation with Effect.provide(AWS.GreengrassV2.ResolveComponentCandidatesHttp).

NOTE: per the AWS API reference, this operation must be called through the Greengrass data plane endpoint authenticated with an AWS IoT device certificate. Calls signed with plain IAM credentials (e.g. from a Lambda role) are rejected with a typed AccessDeniedException even when the greengrass:ResolveComponentCandidates permission is granted — use this binding only from device-credentialed contexts.

ResolveComponentCandidates: Reading Components

Section titled “ResolveComponentCandidates: Reading Components”
// init — account-level binding, no resource argument
const resolveComponentCandidates =
yield* AWS.GreengrassV2.ResolveComponentCandidates();
// runtime
const { resolvedComponentVersions } = yield* resolveComponentCandidates({
platform: { attributes: { os: "linux", architecture: "amd64" } },
componentCandidates: [
{ componentName: "com.example.Hello", versionRequirements: { req: ">=1.0.0" } },
],
});

Source: src/AWS/GreengrassV2/UpdateConnectivityInfo.ts

Runtime binding for greengrass:UpdateConnectivityInfo.

Replaces a core device’s connectivity information — the endpoints and ports client devices use to reach the core’s local MQTT broker. Typically driven by automation that knows the core’s current IP (e.g. reacting to a DHCP change). The caller supplies the core device’s thing name and the new endpoint list at runtime. Provide the implementation with Effect.provide(AWS.GreengrassV2.UpdateConnectivityInfoHttp).

UpdateConnectivityInfo: Managing Client Devices

Section titled “UpdateConnectivityInfo: Managing Client Devices”
// init — account-level binding, no resource argument
const updateConnectivityInfo = yield* AWS.GreengrassV2.UpdateConnectivityInfo();
// runtime
yield* updateConnectivityInfo({
thingName: "MyCore",
connectivityInfo: [
{ id: "lan", hostAddress: "192.168.1.20", portNumber: 8883 },
],
});