Skip to content
betterstack-alchemyUnofficial

Telemetry.SourceAwsAccount

Kind ResourceType id BetterStack.Telemetry.SourceAwsAccountSource src/Telemetry/SourceAwsAccount.tsOffline only Tested against the offline mock only: the lifecycle runs against the offline mock only (test/Telemetry/SourceAwsAccount.test.ts).

The AWS account connected to an aws Source, through the IAM role from Better Stack’s CloudFormation stack (awsRoleArn + awsExternalId), or by reusing an account another aws source connected (awsAccountId, Better Stack’s own id, not the 12-digit AWS one). Exactly one of awsRoleArn and awsAccountId; awsRoleArn goes with awsExternalId.

There is no create or delete: the resource takes over the source named by sourceId and applies these settings to it. Destroying it only forgets it; nothing changes in Better Stack. The role ARN, external id and account id are never returned, so changes are detected against the previous deploy’s props, never against the live source.

The role from Better Stack’s CloudFormation stack

const aws = yield* BetterStack.Telemetry.Source("aws", { platform: "aws" });
yield* BetterStack.Telemetry.SourceAwsAccount("aws-account", {
sourceId: aws.id,
awsRoleArn: Redacted.make("arn:aws:iam::123456789012:role/better-stack"),
awsExternalId: Redacted.make("external-id-from-the-stack"),
awsAutoSubLogGroups: true,
});

Read the AWS account connection of a source by its id

const existing = BetterStack.Telemetry.SourceAwsAccount.lookup({ sourceId: "123456" });

sourceId string required

The aws source to connect the account to. Changing it manages another source.

awsAccountId string

Better Stack's own ID for an AWS account that another aws source in your organization connected, to reuse that connection. Better Stack's ID differs from the 12-digit AWS account ID. Only for the aws platform.

awsAutoSubLogGroups boolean

Whether to subscribe new CloudWatch log groups automatically when they're discovered. Only for the aws platform. Defaults to true.

awsExternalId string | Redacted<string>

External ID from Better Stack's CloudFormation stack. Only for the aws platform.

awsRoleArn string | Redacted<string>

ARN of the IAM role from Better Stack's CloudFormation stack. Only for the aws platform.

teamId string

Team that owns the resource, such as t123. Defaults to the credentials' team (BETTERSTACK_TEAM_ID, or the profile's team). Changing it replaces the resource.

sourceId string always set

The aws source the account is connected to.

awsAccountId string

Better Stack's id of the connected AWS account, when the props named one. Never returned by the API.

awsAutoSubLogGroups boolean

Whether new CloudWatch log groups are subscribed automatically when they're discovered.

platform string

The source's platform (aws).

teamId string

Team that owns the source, such as t123.

SourceAwsAccount.lookup(props) reads an object this stack does not manage. It is never created, updated or deleted.

sourceId string required

The aws source's id.

teamId string

Team that owns the source, such as t123. Defaults to the credentials' team.