Skip to content

CreateWebLoginToken

Source: src/AWS/MWAA/CreateWebLoginToken.ts

Runtime binding for airflow:CreateWebLoginToken.

Bind an Environment inside a function runtime to mint short-lived Apache Airflow web login tokens — exchange the token against https://{WebServerHostname}/aws_mwaa/aws-console-sso to open an authenticated Airflow UI session. The IAM grant is scoped to the Airflow RBAC role the session is mapped to (Admin by default — pass { airflowRole } to scope it down). The WebToken is Redacted — unwrap it with Redacted.value. Provide the implementation with Effect.provide(AWS.MWAA.CreateWebLoginTokenHttp).

Mint a Web Login Token

// init — bind the operation to the environment (Admin session)
const createWebLoginToken = yield* AWS.MWAA.CreateWebLoginToken(environment);
// runtime — mint a token and build the SSO login URL
const token = yield* createWebLoginToken();
const loginUrl =
`https://${token.WebServerHostname}/aws_mwaa/aws-console-sso` +
`?login=true#${Redacted.value(token.WebToken!)}`;

Scope the Session to a Read-Only Airflow Role

const createViewerToken = yield* AWS.MWAA.CreateWebLoginToken(environment, {
airflowRole: "Viewer",
});