

지원 종료 알림: 2025년 12월 15일에 AWS 에 대한 지원이 종료됩니다 AWS IoT 분석. 2025년 12월 15일 이후에는 AWS IoT 분석 콘솔 또는 AWS IoT 분석 리소스에 더 이상 액세스할 수 없습니다. 자세한 내용은 [AWS IoT 분석 지원 종료를 참조하세요](https://docs.aws.amazon.com/iotanalytics/latest/userguide/iotanalytics-end-of-support.html).

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

# 2단계: 이전에 수집된 데이터 내보내기
<a name="export-previous-data"></a>

 이전에 수집하여에 저장한 데이터의 경우 Amazon S3로 내보내 AWS IoT 분석야 합니다. 이 프로세스를 간소화하기 위해 템플릿을 사용하여 CloudFormation 전체 데이터 내보내기 워크플로를 자동화할 수 있습니다. 부분(시간 범위 기반) 데이터 추출에 스크립트를 사용할 수 있습니다.

![\[CloudFormation을 사용하여 이전에 수집된 데이터를 내보내는 아키텍처\]](http://docs.aws.amazon.com/ko_kr/iotanalytics/latest/userguide/images/ingested-architecture.png)


## CloudFormation Amazon S3로 데이터를 내보내는 템플릿
<a name="cfn-data-ingestion"></a>

위 다이어그램은 CloudFormation 템플릿을 사용하여 동일한 AWS IoT 분석 데이터 스토어 내에 데이터 세트를 생성하여 타임스탬프를 기반으로 선택을 활성화하는 프로세스를 보여줍니다. 이를 통해 사용자는 원하는 기간 내에 특정 데이터 포인트를 검색할 수 있습니다. 또한 데이터를 Amazon S3 버킷으로 내보내는 콘텐츠 전송 규칙이 생성됩니다.

아래 절차는 단계를 보여줍니다.

1.  CloudFormation 템플릿을 준비하고 YAML 파일로 저장합니다. 예를 들어 `migrate-datasource.yaml`입니다.

   ```
   # Cloudformation Template to migrate an AWS IoT Analytics datastore to an external dataset
   AWSTemplateFormatVersion: 2010-09-09
   Description: Migrate an AWS IoT Analytics datastore to an external dataset
   Parameters:
     DatastoreName:
       Type: String
       Description: The name of the datastore to migrate.
       AllowedPattern: ^[a-zA-Z0-9_]+$
     TimeRange:
       Type: String
       Description: |
         This is an optional argument to split the source data into multiple files.
         The value should follow the SQL syntax of WHERE clause.
         E.g. WHERE DATE(Item_TimeStamp) BETWEEN '09/16/2010 05:00:00' and '09/21/2010 09:00:00'.
       Default: ''
     MigrationS3Bucket:
       Type: String
       Description: The S3 Bucket where the datastore will be migrated to.
       AllowedPattern: (?!(^xn--|.+-s3alias$))^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$
     MigrationS3BucketPrefix:
       Type: String
       Description: The prefix of the S3 Bucket where the datastore will be migrated to.
       Default: ''
       AllowedPattern: (^([a-zA-Z0-9.\-_]*\/)*$)|(^$)
   Resources:
     # IAM Role to be assumed by the AWS IoT Analytics service to access the external dataset
     DatastoreMigrationRole:
       Type: AWS::IAM::Role
       Properties:
         AssumeRolePolicyDocument:
           Version: 2012-10-17		 	 	 
           Statement:
             - Effect: Allow
               Principal:
                 Service: iotanalytics.amazonaws.com
               Action: sts:AssumeRole
         Policies:
           - PolicyName: AllowAccessToExternalDataset
             PolicyDocument:
               Version: 2012-10-17		 	 	 
               Statement:
                 - Effect: Allow
                   Action:
                     - s3:GetBucketLocation
                     - s3:GetObject
                     - s3:ListBucket
                     - s3:ListBucketMultipartUploads
                     - s3:ListMultipartUploadParts
                     - s3:AbortMultipartUpload
                     - s3:PutObject
                     - s3:DeleteObject
                   Resource:
                     - !Sub arn:aws:s3:::${MigrationS3Bucket}
                     - !Sub arn:aws:s3:::${MigrationS3Bucket}/${MigrationS3BucketPrefix}*
   
     # This dataset that will be created in the external S3 Export
     MigratedDataset:
       Type: AWS::IoTAnalytics::Dataset
       Properties:
         DatasetName: !Sub ${DatastoreName}_generated
         Actions:
           - ActionName: SqlAction
             QueryAction:
               SqlQuery: !Sub SELECT * FROM ${DatastoreName} ${TimeRange}
         ContentDeliveryRules:
           - Destination:
               S3DestinationConfiguration:
                 Bucket: !Ref MigrationS3Bucket
                 Key: !Sub ${MigrationS3BucketPrefix}${DatastoreName}/!{iotanalytics:scheduleTime}/!{iotanalytics:versionId}.csv
                 RoleArn: !GetAtt DatastoreMigrationRole.Arn
         RetentionPeriod:
           Unlimited: true
         VersioningConfiguration:
           Unlimited: true
   ```

1.  AWS IoT 분석 데이터를 내보내야 하는 데이터 스토어를 결정합니다. 이 가이드에서는 라는 샘플 데이터 스토어를 사용합니다`iot_analytics_datastore`.  
![\[AWS IoT 분석 데이터 스토어 식별:\]](http://docs.aws.amazon.com/ko_kr/iotanalytics/latest/userguide/images/datastore.png)

1.  데이터를 내보낼 Amazon S3 버킷을 생성하거나 식별합니다. 이 가이드에서는 `iot-analytics-export` 버킷을 사용합니다.  
![\[Amazon S3 버킷 생성 또는 식별\]](http://docs.aws.amazon.com/ko_kr/iotanalytics/latest/userguide/images/export-s3-bucket.png)

1.  CloudFormation 스택을 생성합니다.
   + [https://console.aws.amazon.com/cloudformation](https://console.aws.amazon.com/cloudformation/) 이동합니다.
   + **스택 생성을** 클릭하고 **새 리소스 사용(표준)**을 선택합니다.
   + `migrate-datasource.yaml` 파일을 업로드합니다.  
![\[CFN 콘솔에 업로드\]](http://docs.aws.amazon.com/ko_kr/iotanalytics/latest/userguide/images/cfn-console-link.png)

1.  스택 이름을 입력하고 다음 파라미터를 제공합니다.
   + **DatastoreName**: 마이그레이션하려는 AWS IoT 분석 데이터 스토어의 이름입니다.
   + **MigrationS3Bucket**: 마이그레이션된 데이터가 저장되는 Amazon S3 버킷입니다.
   + **MigrationS3BucketPrefix**(선택 사항): Amazon S3 버킷의 접두사입니다.
   + **TimeRange**(선택 사항) : 내보내는 데이터를 필터링하여 지정된 시간 범위에 따라 소스 데이터를 여러 파일로 분할할 수 있는 `SQL WHERE` 절입니다.  
![\[CFN 콘솔 스택 세부 정보\]](http://docs.aws.amazon.com/ko_kr/iotanalytics/latest/userguide/images/cfn-console-details.png)

1. 스택 옵션 구성 화면에서 **다음을** 클릭합니다.

1.  확인란을 선택하여 IAM 리소스 생성을 확인하고 **제출**을 클릭합니다.  
![\[CFN 콘솔 스택 세부 정보\]](http://docs.aws.amazon.com/ko_kr/iotanalytics/latest/userguide/images/cfn-capabilities.png)

1.  **이벤트** 탭에서 스택 생성을 검토하여 완료합니다.  
![\[이벤트 탭\]](http://docs.aws.amazon.com/ko_kr/iotanalytics/latest/userguide/images/events-tab.png)

1.  스택이 성공적으로 완료되면 **AWS IoT 분석 → 데이터 세트**로 이동하여 마이그레이션된 데이터 세트를 확인합니다.  
![\[데이터 세트 보기\]](http://docs.aws.amazon.com/ko_kr/iotanalytics/latest/userguide/images/view-datasets.png)

1.  생성된 데이터 세트를 선택하고 **지금 실행**을 클릭하여 데이터 세트를 내보냅니다.  
![\[데이터 세트 실행\]](http://docs.aws.amazon.com/ko_kr/iotanalytics/latest/userguide/images/run-datasets.png)

1.  콘텐츠는 데이터 세트의 **콘텐츠** 탭에서 볼 수 있습니다.  
![\[콘텐츠 데이터 세트 탭\]](http://docs.aws.amazon.com/ko_kr/iotanalytics/latest/userguide/images/content-datasets.png)

1.  마지막으로 Amazon S3 콘솔에서 **iot-analytics-export** 버킷을 열어 내보낸 콘텐츠를 검토합니다.  
![\[이벤트 탭\]](http://docs.aws.amazon.com/ko_kr/iotanalytics/latest/userguide/images/final-review.png)