Skip to content

Commit

Permalink
Merge pull request #1204 from awslabs/bump/2.70.0
Browse files Browse the repository at this point in the history
chore(release): 2.70.0
  • Loading branch information
biffgaut authored Sep 18, 2024
2 parents 636e41d + ed36807 commit c8d3738
Show file tree
Hide file tree
Showing 26 changed files with 648 additions and 119 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.70.0](https://github.com/awslabs/aws-solutions-constructs/compare/v2.69.0...v2.70.0) (2024-09-18)

Built on CDK v2.154.1

### Features

* **aws-constructs-factories:** add cloudwatch alarms to factory output ([#1201](https://github.com/awslabs/aws-solutions-constructs/issues/1201)) ([5e49430](https://github.com/awslabs/aws-solutions-constructs/commit/5e49430c88a6e8a403fd0f35028d1619d03df8ed))

## [2.69.0](https://github.com/awslabs/aws-solutions-constructs/compare/v2.68.0...v2.69.0) (2024-09-11)

Built on CDK v2.154.1
Expand Down
2 changes: 1 addition & 1 deletion source/lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"./patterns/@aws-solutions-constructs/*"
],
"rejectCycles": "true",
"version": "2.69.0"
"version": "2.70.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,16 @@ stateMachineFactory(id: string, props: StateMachineFactoryProps): StateMachineFa
|:-------------|:----------------|-----------------|
|stateMachineProps|[`sfn.StateMachineProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.StateMachineProps.html)|The CDK properties that define the state machine. This property is required and must include a definitionBody or definition (definition is deprecated)|
|logGroup?|[]`logs.LogGroup`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs.LogGroup.html)|An existing LogGroup to which the new state machine will write log entries. Default: none, the construct will create a new log group.|
|createCloudWatchAlarms?|boolean|Whether to create recommended CloudWatch alarms for the State Machine. Default: the alarms are created|
|cloudWatchAlarmsPrefix?|string|Creating multiple State Machines with one Factories construct will result in name collisions as the cloudwatch alarms originally had fixed resource ids. This value was added to avoid collisions while not making changes that would be destructive for existing stacks. Unless you are creating multiple State Machines using factories you can ignore it|

# StateMachineFactoryResponse

| **Name** | **Type** | **Description** |
|:-------------|:----------------|-----------------|
|stateMachineProps|[`sfn.StateMachineProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.StateMachineProps.html)||
|logGroup|[]`logs.LogGroupProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs.LogGroupProps.html)||
|cloudwatchAlarms?|[`cloudwatch.Alarm[]`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.Alarm.html)|The alarms created by the factory (ExecutionFailed, ExecutionThrottled, ExecutionAborted)|

# Default settings

Expand All @@ -187,6 +190,10 @@ Out of the box implementation of the Construct without any override will set the
* Configured to log to the new log group at LogLevel.ERROR
* Amazon CloudWatch Logs Log Group
* Log name is prefaced with /aws/vendedlogs/ to avoid resource policy [issues](https://docs.aws.amazon.com/step-functions/latest/dg/cw-logs.html#cloudwatch-iam-policy). The Log Group name is still created to be unique to the stack to avoid name collisions.
* CloudWatch alarms for:
* 1 or more failed executions
* 1 or more executions being throttled
* 1 or more executions being aborted

# Architecture
![Architecture Diagram](sf-architecture.png)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import * as sqs from 'aws-cdk-lib/aws-sqs';
import * as kms from 'aws-cdk-lib/aws-kms';
import * as logs from 'aws-cdk-lib/aws-logs';
import * as defaults from '@aws-solutions-constructs/core';
import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';

export interface S3BucketFactoryProps {
readonly bucketProps?: s3.BucketProps | any,
Expand All @@ -44,6 +45,22 @@ export interface StateMachineFactoryProps {
* Default: none, the construct will create a new log group.
*/
readonly logGroupProps?: logs.LogGroupProps
/**
* Whether to create recommended CloudWatch alarms
*
* @default - Alarms are created
*/
readonly createCloudWatchAlarms?: boolean,
/**
* Creating multiple State Machines in 1 stack with constructs will
* result in name collisions as the cloudwatch alarms originally had fixed resource ids.
* This value was added to avoid collisions while not making changes that would be
* destructive for existing stacks. Unless you are creating multiple State Machines using constructs
* you can ignore it.
*
* @default - undefined
*/
readonly cloudWatchAlarmsPrefix?: string
}

// Create a response specifically for the interface to avoid coupling client with internal implementation
Expand All @@ -57,6 +74,10 @@ export interface StateMachineFactoryResponse {
* The log group that will receive log messages from the state maching
*/
readonly logGroup: logs.ILogGroup
/*
* The alarms created by the factory (ExecutionFailed, ExecutionThrottled, ExecutionAborted)
*/
readonly cloudwatchAlarms?: cloudwatch.Alarm[];
}

export interface SqsQueueFactoryProps {
Expand Down Expand Up @@ -135,10 +156,16 @@ export class ConstructsFactories extends Construct {
}

public stateMachineFactory(id: string, props: StateMachineFactoryProps): StateMachineFactoryResponse {
const buildStateMachineResponse = defaults.buildStateMachine(this, id, props.stateMachineProps, props.logGroupProps);
const buildStateMachineResponse = defaults.buildStateMachine(this, id, {
stateMachineProps: props.stateMachineProps,
logGroupProps: props.logGroupProps,
createCloudWatchAlarms: props.createCloudWatchAlarms,
cloudWatchAlarmsPrefix: props.cloudWatchAlarmsPrefix
});
return {
stateMachine: buildStateMachineResponse.stateMachine,
logGroup: buildStateMachineResponse.logGroup
logGroup: buildStateMachineResponse.logGroup,
cloudwatchAlarms: buildStateMachineResponse.cloudWatchAlarms
};
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"36.0.0"}
{"version":"36.0.25"}
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "36.0.0",
"version": "36.0.25",
"files": {
"c7ecd4e8eaccb1e7f7416826559ce7fa1c58bb3a5fb8298e571ac6695d1d50b7": {
"c609c27e6e7fc30d831454d0ca67932fbbb0f7d66f09883e3fc1e4a0afe294b6": {
"source": {
"path": "facstp-defaults.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "c7ecd4e8eaccb1e7f7416826559ce7fa1c58bb3a5fb8298e571ac6695d1d50b7.json",
"objectKey": "c609c27e6e7fc30d831454d0ca67932fbbb0f7d66f09883e3fc1e4a0afe294b6.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,69 @@
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"targetExecutionFailedAlarm97DD1630": {
"Type": "AWS::CloudWatch::Alarm",
"Properties": {
"AlarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ",
"ComparisonOperator": "GreaterThanOrEqualToThreshold",
"Dimensions": [
{
"Name": "StateMachineArn",
"Value": {
"Ref": "targetStateMachinetestsm59897C57"
}
}
],
"EvaluationPeriods": 1,
"MetricName": "ExecutionsFailed",
"Namespace": "AWS/States",
"Period": 300,
"Statistic": "Sum",
"Threshold": 1
}
},
"targetExecutionThrottledAlarmCAA85FD5": {
"Type": "AWS::CloudWatch::Alarm",
"Properties": {
"AlarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ",
"ComparisonOperator": "GreaterThanOrEqualToThreshold",
"Dimensions": [
{
"Name": "StateMachineArn",
"Value": {
"Ref": "targetStateMachinetestsm59897C57"
}
}
],
"EvaluationPeriods": 1,
"MetricName": "ExecutionThrottled",
"Namespace": "AWS/States",
"Period": 300,
"Statistic": "Sum",
"Threshold": 1
}
},
"targetExecutionAbortedAlarm70BA06C6": {
"Type": "AWS::CloudWatch::Alarm",
"Properties": {
"AlarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ",
"ComparisonOperator": "GreaterThanOrEqualToThreshold",
"Dimensions": [
{
"Name": "StateMachineArn",
"Value": {
"Ref": "targetStateMachinetestsm59897C57"
}
}
],
"EvaluationPeriods": 1,
"MetricName": "ExecutionsAborted",
"Namespace": "AWS/States",
"Period": 300,
"Statistic": "Maximum",
"Threshold": 1
}
},
"lambdatestServiceRoleF3BDB8FC": {
"Type": "AWS::IAM::Role",
"Properties": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "36.0.0",
"version": "36.0.25",
"files": {
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
"source": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "36.0.0",
"version": "36.0.25",
"testCases": {
"facstp-defaults/Integ/DefaultTest": {
"stacks": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "36.0.0",
"version": "36.0.24",
"artifacts": {
"facstpdefaultsIntegDefaultTestDeployAssertFD717592.assets": {
"type": "cdk:asset-manifest",
Expand Down Expand Up @@ -66,7 +66,7 @@
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/c7ecd4e8eaccb1e7f7416826559ce7fa1c58bb3a5fb8298e571ac6695d1d50b7.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/c609c27e6e7fc30d831454d0ca67932fbbb0f7d66f09883e3fc1e4a0afe294b6.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand Down Expand Up @@ -106,6 +106,24 @@
"data": "targetStateMachinetestsm59897C57"
}
],
"/facstp-defaults/target/ExecutionFailedAlarm/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "targetExecutionFailedAlarm97DD1630"
}
],
"/facstp-defaults/target/ExecutionThrottledAlarm/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "targetExecutionThrottledAlarmCAA85FD5"
}
],
"/facstp-defaults/target/ExecutionAbortedAlarm/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "targetExecutionAbortedAlarm70BA06C6"
}
],
"/facstp-defaults/lambdatest/ServiceRole/Resource": [
{
"type": "aws:cdk:logicalId",
Expand Down
Loading

0 comments on commit c8d3738

Please sign in to comment.