

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# AWS::Serverless::StateMachine
<a name="sam-resource-statemachine"></a>

 AWS Lambda 함수 및 기타 AWS 리소스를 오케스트레이션하여 복잡하고 강력한 워크플로를 구성하는 데 사용할 수 있는 AWS Step Functions 상태 시스템을 생성합니다.

계단 함수에 대한 자세한 내용은 [AWS Step Functions 개발자 가이드](https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html)를 참조하세요.

**참고**  
에 배포하면가 AWS SAM 리소스를 CloudFormation 리소스로 AWS CloudFormation AWS SAM 변환합니다. 자세한 내용은 [에 대해 생성된 CloudFormation 리소스 AWS SAM](sam-specification-generated-resources.md) 단원을 참조하십시오.

## 구문
<a name="sam-resource-statemachine-syntax"></a>

 AWS Serverless Application Model (AWS SAM) 템플릿에서이 개체를 선언하려면 다음 구문을 사용합니다.

### YAML
<a name="sam-resource-statemachine-syntax.yaml"></a>

```
Type: AWS::Serverless::StateMachine
Properties:
  AutoPublishAlias: String
  UseAliasAsEventTarget: Boolean
  [Definition](#sam-statemachine-definition): Map
  [DefinitionSubstitutions](#sam-statemachine-definitionsubstitutions): Map
  [DefinitionUri](#sam-statemachine-definitionuri): String | [S3Location](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-definitions3location)
  DeploymentPreference: [DeploymentPreference](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stepfunctions-statemachinealias-deploymentpreference.html)
  [Events](#sam-statemachine-events): EventSource
  [Logging](#sam-statemachine-logging): [LoggingConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-loggingconfiguration)
  [Name](#sam-statemachine-name): String
  [PermissionsBoundary](#sam-statemachine-permissionsboundary): String
  [Policies](#sam-statemachine-policies): String | List | Map
  PropagateTags: Boolean
  [RolePath](#sam-statemachine-rolepath): String
  [Role](#sam-statemachine-role): String
  [Tags](#sam-statemachine-tags): Map
  [Tracing](#sam-statemachine-tracing): [TracingConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-tracingconfiguration)
  [Type](#sam-statemachine-type): String
```

## 속성
<a name="sam-resource-statemachine-properties"></a>

 `AutoPublishAlias`   <a name="sam-statemachine-autopublishalias"></a>
상태 기기 별칭의 이름입니다. 계단 함수 상태 기기 별칭을 사용하는 방법에 대해 자세히 알아보려면 [ 개발자 가이드](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-cd-aliasing-versioning.html)의 *AWS Step Functions 버전 및 별칭을 사용한 지속적 배포 관리*를 참조하세요.   
별칭에 대한 배포 기본 설정을 구성하는데 `DeploymentPreference`을 사용합니다. 를 지정하지 않으면 `DeploymentPreference` AWS SAM 는 트래픽을 최신 상태 시스템 버전으로 한 번에 전환하도록 구성합니다.  
AWS SAM 는 `Retain` 기본적으로 버전의 `DeletionPolicy` 및를 `UpdateReplacePolicy`로 설정합니다. 이전 버전은 자동으로 삭제되지 않습니다.  
*유형*: 문자열  
*필수 항목 여부*: 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::StepFunctions::StateMachineAlias` 리소스의 ` [ Name](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachinealias.html#cfn-stepfunctions-statemachinealias-name)` 속성으로 직접 전달됩니다.

 `UseAliasAsEventTarget`   <a name="sam-statemachine-usealiasaseventtarget"></a>
`AutoPublishAlias` 속성을 사용하여 생성된 별칭을 [이벤트](#sam-statemachine-events)로 정의된 이벤트 소스의 대상에 전달할지 여부를 지정합니다.  
별칭을 이벤트의 대상으로 사용하려면 `True`를 지정합니다.  
*유형*: 부울  
*필수 항목 여부*: 아니요  
*기본값*: `False`  
*CloudFormation 호환성*:이 속성은에 고유 AWS SAM 하며 CloudFormation 동등한 속성이 없습니다.

 `Definition`   <a name="sam-statemachine-definition"></a>
상태 시스템 정의는 객체로, 객체의 형식이 JSON 또는 YAML과 같은 AWS SAM 템플릿 파일의 형식과 일치합니다. 상태 기기 정의는 [Amazon States Language](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html)를 따릅니다.  
인라인 스테이트 기기 정의의 예는 [예제](#sam-resource-statemachine--examples)을 참조하세요.  
`Definition` 또는 `DefinitionUri`를 제공해야 합니다.  
*유형*: 맵  
*필수 항목 여부*: 조건부  
*CloudFormation 호환성*:이 속성은에 고유 AWS SAM 하며 CloudFormation 동등한 속성이 없습니다.

 `DefinitionSubstitutions`   <a name="sam-statemachine-definitionsubstitutions"></a>
상태 시스템 정의의 자리 표시자 변수에 대한 매핑을 지정하는 문자열-문자열 맵입니다. 이를 통해 런타임에 얻은 값(예: 내장 함수)을 상태 기기 정의에 삽입할 수 있습니다.  
*유형*: 맵  
*필수 항목 여부*: 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::StepFunctions::StateMachine` 리소스의 `[DefinitionSubstitutions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-definitionsubstitutions)` 속성과 유사합니다. 인라인 상태 시스템 정의에 내장 함수가 지정된 경우는이 속성에 항목을 AWS SAM 추가하여 상태 시스템 정의에 주입합니다.

 `DefinitionUri`   <a name="sam-statemachine-definitionuri"></a>
Amazon Simple Storage Service(S3) URI 또는 [Amazon States Language](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html) 내 기재된 상태 기기 정의의 로컬 파일 경로입니다.  
로컬 파일 경로를 제공하는 경우 템플릿은 `sam deploy` 또는 `sam package` 명령이 포함된 워크플로를 거쳐야 정의를 올바르게 변환할 수 있습니다. 이렇게 하려면 AWS SAM CLI의 버전 0.52.0 이상을 사용해야 합니다.  
`Definition` 또는 `DefinitionUri`를 제공해야 합니다.  
*유형*: 문자열 \$1 [S3Location](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-definitions3location)  
*필수 항목 여부*: 조건부  
*CloudFormation 호환성*:이 속성은 `AWS::StepFunctions::StateMachine` 리소스의 `[DefinitionS3Location](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-definitions3location)` 속성으로 직접 전달됩니다.

 `DeploymentPreference`   <a name="sam-statemachine-deploymentpreference"></a>
점진적 상태 기기 배포를 활성화하고 구성하는 설정입니다. 계단 함수의 점진적 배포에 대해 자세히 알아보려면 [ 개발자 가이드](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-cd-aliasing-versioning.html)의 *AWS Step Functions 버전 및 별칭을 사용한 지속적 배포 관리*를 참조하세요.   
이 속성을 구성하기 전에 `AutoPublishAlias`을 지정하십시오. `DeploymentPreference` 설정이 `AutoPublishAlias`와 함께 지정된 별칭에 적용됩니다.  
를 지정하면가 `StateMachineVersionArn` 하위 속성 값을 자동으로 `DeploymentPreference` AWS SAM 생성합니다.  
*유형*: [DeploymentPreference](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stepfunctions-statemachinealias-deploymentpreference.html)  
*필수 항목 여부*: 아니요  
*CloudFormation compatibility*: AWS SAM generate 속성 `StateMachineVersionArn` 값을 `AWS::StepFunctions::StateMachineAlias` 리소스의 `[DeploymentPreference](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachinealias.html#cfn-stepfunctions-statemachinealias-deploymentpreference)` 속성에 연결하고 `DeploymentPreference` `DeploymentPreference` 전달합니다.

 `Events`   <a name="sam-statemachine-events"></a>
이 상태 기기를 촉발하는 이벤트를 지정합니다. 이벤트는 유형 및 각 유형에 따라 달라지는 속성 집합으로 구성됩니다.  
*유형*: [EventSource](sam-property-statemachine-statemachineeventsource.md)  
*필수 항목 여부*: 아니요  
*CloudFormation 호환성*:이 속성은에 고유 AWS SAM 하며 CloudFormation 동등한 속성이 없습니다.

 `Logging`   <a name="sam-statemachine-logging"></a>
어떤 실행 기록 이벤트가 로그되는지, 또한 어디에서 로그되는지 정의합니다.  
*유형*: [LoggingConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-loggingconfiguration)  
*필수 항목 여부*: 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::StepFunctions::StateMachine` 리소스의 `[LoggingConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-loggingconfiguration)` 속성으로 직접 전달됩니다.

 `Name`   <a name="sam-statemachine-name"></a>
상태 기기의 이름입니다.  
*유형*: 문자열  
*필수 항목 여부*: 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::StepFunctions::StateMachine` 리소스의 `[StateMachineName](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-statemachinename)` 속성으로 직접 전달됩니다.

 `PermissionsBoundary`   <a name="sam-statemachine-permissionsboundary"></a>
이 상태 기기의 실행 역할에 사용할 권한 경계의 ARN. 이 속성은 역할이 자동으로 생성된 경우에만 작동합니다.  
*유형*: 문자열  
*필수 항목 여부*: 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::IAM::Role` 리소스의 `[PermissionsBoundary](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html#cfn-iam-role-permissionsboundary)` 속성으로 직접 전달됩니다.

 `Policies`   <a name="sam-statemachine-policies"></a>
이 상태 기기의 권한 정책입니다. 정책은 상태 시스템의 기본 AWS Identity and Access Management (IAM) 실행 역할에 추가됩니다.  
이 속성은 단일 값 또는 값 목록을 허용합니다. 허용되는 값은 다음과 같습니다.  
+ [AWS SAM정책 템플릿](serverless-policy-templates.md).
+ ARN 관리형 정책 [AWS](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#aws-managed-policies) 또는 [고객 관리형 정책](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#customer-managed-policies)의.
+ 다음 [ 목록에](https://github.com/aws/serverless-application-model/blob/develop/samtranslator/internal/data/aws_managed_policies.json) 있는 AWS 관리형 정책의 이름입니다.
+ [ 맵 형식](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#inline-policies)의 YAML 인라인 IAM 정책입니다.
`Role` 속성을 설정하면 이 속성은 무시됩니다.
*유형*: 문자열 \$1 목록 \$1 맵  
*필수 항목 여부*: 아니요  
*CloudFormation 호환성*:이 속성은에 고유 AWS SAM 하며 CloudFormation 동등한 속성이 없습니다.

`PropagateTags`  <a name="sam-statemachine-propagatetags"></a>
`Tags`속성의 태그를 [AWS::Serverless::StateMachine](sam-specification-generated-resources-statemachine.md) 생성된 리소스로 전달할지 여부를 지정합니다. 귀하의 생성된 리소스에 태그를 전파하도록 `True`을 지정합니다.  
*유형*: 부울  
*필수 항목 여부*: 아니요  
*기본값*: `False`  
*CloudFormation 호환성*:이 속성은에 고유 AWS SAM 하며 CloudFormation 동등한 속성이 없습니다.

 `Role`   <a name="sam-statemachine-role"></a>
이 상태 기기의 실행 역할로 사용할 IAM 역할의 ARN.  
*유형*: 문자열  
*필수 항목 여부*: 조건부  
*CloudFormation 호환성*:이 속성은 `AWS::StepFunctions::StateMachine` 리소스의 `[ RoleArn](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-rolearn)` 속성으로 직접 전달됩니다.

 `RolePath`   <a name="sam-statemachine-rolepath"></a>
상태 기기의 IAM 실행 역할 경로입니다.  
역할이 자동으로 생성될 때 이 속성을 사용하십시오. `Role` 속성에 역할이 지정된 경우에는 사용하지 마십시오.  
*유형*: 문자열  
*필수 항목 여부*: 조건부  
*CloudFormation 호환성*:이 속성은 `AWS::IAM::Role` 리소스의 `[Path](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html#cfn-iam-role-path)` 속성으로 직접 전달됩니다.

 `Tags`   <a name="sam-statemachine-tags"></a>
상태 시스템에 추가된 태그와 해당 실행 역할을 지정하는 문자열-문자열 맵입니다. 태그의 유효한 키와 값에 대한 자세한 내용은 [ 리소스](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-tags)의 [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html)태그 속성을 참조하세요.  
*유형*: 맵  
*필수 항목 여부*: 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::StepFunctions::StateMachine` 리소스의 `[Tags](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-tags)` 속성과 유사합니다.는이 리소스와 해당 리소스에 대해 생성된 기본 역할에 `stateMachine:createdBy:SAM` 태그를 AWS SAM 자동으로 추가합니다.

 `Tracing`   <a name="sam-statemachine-tracing"></a>
상태 시스템에 대해 AWS X-Ray 가 활성화되었는지 여부를 선택합니다. Step Functions와 함께 X-Ray를 사용하는 방법에 대한 자세한 내용은 [AWS X-Ray 개발자 가이드](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-xray-tracing.html)의 *AWS Step Functions 계단 함수*를 참조하세요.  
*유형*: [TracingConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-tracingconfiguration)  
*필수 항목 여부*: 아니요  
*CloudFormation 호환성*:이 속성은 `AWS::StepFunctions::StateMachine` 리소스의 `[TracingConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-tracingconfiguration)` 속성으로 직접 전달됩니다.

 `Type`   <a name="sam-statemachine-type"></a>
상태 기기의 이름입니다.  
*유효한 값*: `STANDARD` 또는 `EXPRESS`  
*유형*: 문자열  
*필수 항목 여부*: 아니요  
*기본값*: `STANDARD`  
*CloudFormation 호환성*:이 속성은 `AWS::StepFunctions::StateMachine` 리소스의 `[StateMachineType](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html#cfn-stepfunctions-statemachine-statemachinetype)` 속성으로 직접 전달됩니다.

## 반환 값
<a name="sam-resource-statemachine-return-values"></a>

### Ref
<a name="sam-resource-statemachine-return-values-ref"></a>

이 리소스의 논리적 ID를 Ref 내장 함수에 전달하면 Ref가 기저의 `AWS::StepFunctions::StateMachine` 리소스의 Amazon 리소스 이름(ARN)을 반환합니다.

`Ref` 함수에 대한 자세한 내용은 [`Ref` 사용자 가이드](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html)의 *AWS CloudFormation *를 참조하십시오.

### Fn::GetAtt
<a name="sam-resource-statemachine-return-values-fn--getatt"></a>

`Fn::GetAtt`은 이 유형의 지정된 속성에 대한 값을 반환합니다. 다음은 사용 가능한 속성과 반환되는 샘플 값.

`Fn::GetAtt`의 사용에 대한 자세한 내용은 *AWS CloudFormation 사용자 가이드*의 [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html) 섹션을 참조하세요.

`Name`  <a name="Name-fn::getatt"></a>
`HelloWorld-StateMachine`과 같은 상태 기기의 이름을 반환합니다.

## 예제
<a name="sam-resource-statemachine--examples"></a>

### 스테이트 기기 정의 파일
<a name="sam-resource-statemachine--examples--state-machine-definition-file"></a>

다음은 Lambda 함수가 상태 시스템을 호출할 수 있도록 허용하는 인라인 상태 시스템 정의의 예입니다. 이 예제에서는 `Role` 속성이 호출을 허용하는 적절한 정책으로 구성되어 있다고 가정합니다. `my_state_machine.asl.json`파일은 [Amazon States Language](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html) 로 작성해야 합니다.

이 예제에서 `DefinitionSubstitution` 항목은 상태 머신이 AWS SAM 템플릿 파일에 선언된 리소스를 포함할 수 있도록 허용합니다.

#### YAML
<a name="sam-resource-statemachine--examples--state-machine-definition-file--yaml"></a>

```
MySampleStateMachine:
  Type: AWS::Serverless::StateMachine
  Properties:
    DefinitionUri: statemachine/my_state_machine.asl.json
    Role: arn:aws:iam::123456123456:role/service-role/my-sample-role
    Tracing:
      Enabled: true
    DefinitionSubstitutions:
      MyFunctionArn: !GetAtt MyFunction.Arn
      MyDDBTable: !Ref TransactionTable
```

### 인라인 상태 기기 정의
<a name="sam-resource-statemachine--examples--inline-state-machine-definition"></a>

다음은 인라인 상태 기기 정의의 예입니다.

이 예제에서는 AWS SAM 템플릿 파일이 YAML로 작성되므로 상태 시스템 정의도 YAML로 작성됩니다. 인라인 상태 시스템 정의를 JSON으로 선언하려면 AWS SAM 템플릿 파일을 JSON으로 작성합니다.

#### YAML
<a name="sam-resource-statemachine--examples--inline-state-machine-definition--yaml"></a>

```
MySampleStateMachine:
  Type: AWS::Serverless::StateMachine
  Properties:
    Definition:
      StartAt: MyLambdaState
      States:
        MyLambdaState:
          Type: Task
          Resource: arn:aws:lambda:us-east-1:123456123456:function:my-sample-lambda-app
          End: true
    Role: arn:aws:iam::123456123456:role/service-role/my-sample-role
    Tracing:
      Enabled: true
```