

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# aws 事件規則步驟功能
<a name="aws-events-rule-step-function"></a>

![](http://docs.aws.amazon.com/zh_tw/solutions/latest/constructs/images/experimental.png)


 所有類都在積極開發中，並且在任何未來版本中都會受到非向後兼容的更改或刪除。這些不受[語義版本](https://semver.org/)模型。這意味著，雖然您可以使用它們，但在升級到此軟件包的較新版本時，您可能需要更新源代碼。

**請注意：** 為了確保功能正確，專案中的 AWS 解決方案建構套件和 AWS CDK 套件必須是相同的版本。


|  **語言**  |  **套件**  | 
| --- | --- | 
|  ![](http://docs.aws.amazon.com/zh_tw/solutions/latest/constructs/images/python.png) Python  |  aws\_solutions\_constructs.aws\_events\_rule\_step\_function  | 
|  ![](http://docs.aws.amazon.com/zh_tw/solutions/latest/constructs/images/typescript.png) 打字稿  |  @aws-solutions-constructs/aws-events-rule-step-function  | 
|  ![](http://docs.aws.amazon.com/zh_tw/solutions/latest/constructs/images/java.png) Java  |  software.amazon.awsconstructs.services.eventsrulestepfunction  | 

## Overview
<a name="overview-10"></a>

 此 AWS 解決方案建構實作 AWS 事件規則和 AWS 步驟函數。

 下面是 TypeScript 中的最小可部署模式定義：

```
import { EventsRuleToStepFunction, EventsRuleToStepFunctionProps } from '@aws-solutions-constructs/aws-events-rule-step-function';

const startState = new stepfunctions.Pass(this, 'StartState');

const props: EventsRuleToStepFunctionProps = {
    stateMachineProps: {
      definition: startState
    },
    eventRuleProps: {
      schedule: events.Schedule.rate(Duration.minutes(5))
    }
};

new EventsRuleToStepFunction(this, 'test-events-rule-step-function-stack', props);
```

## Initializer
<a name="initializer-10"></a>

```
new EventsRuleToStepFunction(scope: Construct, id: string, props: EventsRuleToStepFunctionProps);
```

 *參數* 
+  scope[https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_core.Construct.html](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_core.Construct.html) 
+  id`string` 
+  提案[`EventsRuleToStepFunctionProps`](#pattern-construct-props-10) 

## 模式建立道具
<a name="pattern-construct-props-10"></a>


|  **名稱**  |  **類型**  |  **描述**  | 
| --- | --- | --- | 
|  斯塔特阿奇內道具  |  [https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-stepfunctions.StateMachineProps.html](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-stepfunctions.StateMachineProps.html)  |  可選的用戶提供的道具來覆蓋 Sfn.Statemachine 的默認道具  | 
|  事件規則  |  [https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-events.RuleProps.html](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-events.RuleProps.html)  |  使用者提供的事件規則來覆寫預設值  | 
|  創建雲端觀察器  |  boolean  |  是否要建立建議的警報。 | 
|  記錄群組道具？  |  [https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-logs.LogGroupProps.html](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-logs.LogGroupProps.html)  |  可選用的使用者提供的道具，用於覆寫 CloudWatch Logs 日誌群組的預設道具。 | 

## 模式性質
<a name="pattern-properties-10"></a>


|  **名稱**  |  **類型**  |  **描述**  | 
| --- | --- | --- | 
|  CloudWatch? |  [https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudwatch.Alarm.html](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudwatch.Alarm.html)  |  傳回模式建立的一或多個 CloudWatch 警示的清單。 | 
|  事件規則  |  [https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-events.Rule.html](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-events.Rule.html)  |  傳回模式所建立之事件規則的實體。 | 
|  StateMachine  |  [https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-stepfunctions.StateMachine.html](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-stepfunctions.StateMachine.html)  |  返回由模式創建的狀態機的實例。 | 
|  台北市內洛集團  |  [https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-logs.LogGroup.html](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-logs.LogGroup.html)  |  傳回狀態機器模式所建立之日誌群組的執行個體。 | 

## 預設設定
<a name="default-settings-10"></a>

 此模式的開箱即用實現沒有任何覆蓋將設置以下默認值：

### Amazon CloudWatch Events
<a name="amazon-cloudwatch-events-rule-1"></a>
+  授與最低權限權限給 CloudWatch 事件以觸發 Lambda 函數 

### AWS Step Function
<a name="aws-step-function"></a>
+  啟用 API Gateway 的 CloudWatch 日誌 
+  針對步驟功能部署最佳實務 CloudWatch 警示 

## Architecture
<a name="architecture-10"></a>

![](http://docs.aws.amazon.com/zh_tw/solutions/latest/constructs/images/aws-events-rule-step-function.png)


## GitHub
<a name="github-10"></a>


<table>
<thead>
  <tr><th colspan="2"> 要查看此模式的代碼，創建/查看問題和提取請求，以及更多： </th></tr>
</thead>
<tbody>
  <tr><td> ![](http://docs.aws.amazon.com/zh_tw/solutions/latest/constructs/images/GitHub-Mark-32px.png) </td><td> [@aws-解決方案-構造/aw-事件-規則-步驟函數](https://github.com/awslabs/aws-solutions-constructs/tree/master/source/patterns/%40aws-solutions-constructs/aws-events-rule-step-function) </td></tr>
</tbody>
</table>
