

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

# 를 사용하여 AWS IoT Greengrass 리소스 생성 AWS CloudFormation
<a name="creating-resources-with-cloudformation"></a>

AWS IoT Greengrass 는 AWS 리소스 및 인프라를 생성하고 관리하는 데 소요되는 시간을 줄일 수 있도록 리소스를 모델링하고 설정하는 데 도움이 되는 AWS CloudFormation서비스인와 통합됩니다. 원하는 모든 AWS 리소스(예: 구성 요소 버전 및 배포)를 설명하는 템플릿을 생성하고 해당 리소스를 CloudFormation 프로비저닝하고 구성합니다.

를 사용하면 템플릿을 재사용하여 AWS IoT Greengrass 리소스를 일관되고 반복적으로 설정할 CloudFormation수 있습니다. 리소스를 한 번 설명한 다음 여러 AWS 계정 및 리전에서 동일한 리소스를 반복적으로 프로비저닝합니다.

## AWS IoT Greengrass 및 CloudFormation 템플릿
<a name="working-with-templates"></a>

 AWS IoT Greengrass 및 관련 서비스에 대한 리소스를 프로비저닝하고 구성하려면 [CloudFormation 템플릿을](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-guide.html) 이해해야 합니다. 템플릿은 JSON 또는 YAML로 서식 지정된 텍스트 파일입니다. 이러한 템플릿은 CloudFormation 스택에서 프로비저닝하려는 리소스를 설명합니다. JSON 또는 YAML에 익숙하지 않은 경우 CloudFormation Designer를 사용하여 CloudFormation 템플릿을 시작할 수 있습니다. 자세한 내용은 *AWS CloudFormation 사용자 안내서*에서 [CloudFormation Designer란?](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/working-with-templates-cfn-designer.html)을 참조하세요.

AWS IoT Greengrass 는에서 구성 요소 버전 및 배포 생성을 지원합니다 CloudFormation. 구성 요소 버전과 배포에 대한 JSON 및 YAML 템플릿의 예제를 포함한 자세한 내용은 *AWS CloudFormation 사용 설명서*의 [AWS IoT Greengrass 리소스 유형 참조](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_GreengrassV2.html)를 참조하세요.

### ComponentVersion 템플릿 예제
<a name="component-version-template"></a>

다음은 간단한 구성 요소의 버전에 대한 YAML 템플릿입니다. JSON 레시피는 읽기 쉽도록 줄이 나누어져 있습니다.

```
Parameters:
  ComponentVersion:
    Type: String
Resources:
  TestSimpleComponentVersion:
    Type: AWS::GreengrassV2::ComponentVersion
    Properties:
      InlineRecipe: !Sub
        - "{\n
            \"RecipeFormatVersion\": \"2020-01-25\",\n
            \"ComponentName\": \"component1\",\n
            \"ComponentVersion\": \"${ComponentVersion}\",\n
            \"ComponentType\": \"aws.greengrass.generic\",\n
            \"ComponentDescription\": \"This\",\n
            \"ComponentPublisher\": \"You\",\n
            \"Manifests\": [\n
            {\n
              \"Platform\": {\n
              \"os\": \"darwin\"\n
            },\n
            \"Lifecycle\": {},\n
            \"Artifacts\": []\n
           },\n
           {\n
             \"Lifecycle\": {},\n
             \"Artifacts\": []\n
           }\n
          ],\n
          \"Lifecycle\": {\n
          \"install\": {\n
            \"script\": \"yuminstallpython\"\n
          }\n
         }\n
        }"
        - { ComponentVersion: !Ref ComponentVersion }
```

### 배포 템플릿 예제
<a name="deployment-template"></a>

다음은 배포에 대한 간단한 템플릿이 정의되는 YAML 파일입니다.

```
Parameters:
  ComponentVersion:
    Type: String
  TargetArn:
    Type: String
Resources:
  TestDeployment:
    Type: AWS::GreengrassV2::Deployment
    Properties:
      Components:
        component1:
          ComponentVersion: !Ref ComponentVersion
      TargetArn: !Ref TargetArn
      DeploymentName: CloudFormationIntegrationTest
      DeploymentPolicies:
        FailureHandlingPolicy: DO_NOTHING
        ComponentUpdatePolicy:
          TimeoutInSeconds: 5000
          Action: SKIP_NOTIFY_COMPONENTS
        ConfigurationValidationPolicy:
          TimeoutInSeconds: 30000
Outputs:
  TestDeploymentArn:
    Value: !Sub
      - arn:${AWS::Partition}:greengrass:${AWS::Region}:${AWS::AccountId}:deployments:${DeploymentId}
      - DeploymentId: !GetAtt TestDeployment.DeploymentId
```

## 에 대해 자세히 알아보기 CloudFormation
<a name="learn-more-cloudformation"></a>

에 대해 자세히 알아보려면 다음 리소스를 CloudFormation참조하세요.
+ [AWS CloudFormation](https://aws.amazon.com/cloudformation/)
+ [AWS CloudFormation 사용 설명서](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html)
+ [CloudFormation API Reference](https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/Welcome.html)
+ [AWS CloudFormation 명령줄 인터페이스 사용자 안내서](https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/what-is-cloudformation-cli.html)