Notice
Recent Posts
Recent Comments
Link
투케이2K
147. (Aws/Amazon) [Aws Iot Core] Aws Iot Core 원격 작업 Job OTA 작업 리스트 목록 확인 ListJobs API 설명 정리 본문
Aws (Amazon)
147. (Aws/Amazon) [Aws Iot Core] Aws Iot Core 원격 작업 Job OTA 작업 리스트 목록 확인 ListJobs API 설명 정리
투케이2K 2025. 12. 7. 19:53728x90
[개발 환경 설정]
개발 환경 : Aws / Amazon Web Services

[설명 정리]
// --------------------------------------------------------------------------------------
[개발 및 환경]
// --------------------------------------------------------------------------------------
- 인프라 : Aws / Amazon Web Services
- 기술 구분 : Aws / Aws Iot Core / Job / OTA
- 사전) Aws Iot Core 간략 설명 :
>> AWS IoT 는 IoT 디바이스를 다른 디바이스 및 AWS 클라우드 서비스에 연결하는 클라우드 서비스를 제공합니다.
>> 디바이스가에 연결할 수 있는 경우 AWS IoT는 AWS 가 제공하는 클라우드 서비스에 디바이스를 AWS IoT 연결할 수 있습니다.
>> AWS IoT Core 메시지 브로커는 MQTT 및 MQTT over WSS 프로토콜을 사용하여 메시지를 게시하고 구독하는 디바이스 및 클라이언트를 지원합니다.
- HTTPS 프로토콜을 사용하여 메시지를 게시하는 디바이스와 클라이언트도 지원합니다.
- 사전) AWS Iot Core Job 간략 설명 :
>> AWS 원격 작업 이란 작업자 또는 기술자의 물리적 존재 없이 원격으로 수행할 수 있는 업데이트 작업입니다 (무선 업데이트 (OTA) 수행)
>> AWS IoT 작업 서비스는 AWS IoT 에 연결 되는 하나 이상의 디바이스로 전송 된 후 실행 되는 원격 작업 세트를 정의하는데 사용됩니다
- 주목적 : 소프트웨어 및 펌웨어 업데이트를 디바이스 기기에게 알리는데 사용 (기기에게 작업 문서 전송)
- 작업 문서 : AWS IoT Job 생성 시 대상이 되는 디바이스로 전송 되는 문서 (펌웨어 다운로드 URL 정보 등 포함)
// --------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------
[설 명]
// --------------------------------------------------------------------------------------
1. AWS IoT ListJobs 는 현재 존재하는 IoT “jobs” 의 목록, 즉 생성된 job들을 나열(list) 을 반환합니다.
>> AWS 사이트 : https://docs.aws.amazon.com/iot/latest/apireference/API_ListJobs.html
2. AWS IoT ListJobs API 요청 형식 및 주요 매개변수
>> GET /jobs?maxResults=<maxResults>
&namespaceId=<namespaceId>
&nextToken=<nextToken>
&status=<status>
&targetSelection=<targetSelection>
&thingGroupId=<thingGroupId>
&thingGroupName=<thingGroupName>
>> maxResults : 한 번의 요청으로 반환할 최대 job 개수. 최소 1, 최대 250
>> nextToken : (페이지네이션용) 이전 응답에 nextToken 이 있었다면, 다음 페이지 결과를 가져올 때 사용
>> status : (선택) job 상태를 필터. 유효 값 : IN_PROGRESS, CANCELED, COMPLETED
>> targetSelection : (선택) job이 “연속 실행(CONTINUOUS)”인지, “스냅샷 실행(SNAPSHOT)”인지
>> thingGroupId / thingGroupName : (선택) 특정 thing-group 에 매핑된 job만 필터링
>> namespaceId : (선택) 고객 관리 네임스페이스에 속한 job을 조회할 때 사용. (현재는 Greengrass 관련 환경에서 사용됨)
3. AWS IoT ListJobs 응답 본문 예시 구문
HTTP/1.1 200
Content-type: application/json
{
"jobs": [
{
"completedAt": number,
"createdAt": number,
"isConcurrent": boolean,
"jobArn": "string",
"jobId": "string",
"lastUpdatedAt": number,
"status": "string",
"targetSelection": "string",
"thingGroupId": "string"
}
],
"nextToken": "string"
}
4. AWS IoT ListJobs 이 사용되는 시점
>> 현재 어떤 job들이 등록되어 있고, 어떤 상태인지 전체 또는 일부를 조회하고 싶을 때.
>> 상태(status)나 대상 그룹(thing group), 타겟 셀렉션 방식 등에 따라 job을 필터링해서 보고 싶을 때.
>> 자동화된 스크립트나 백엔드 로직에서 “모든 job을 순회하면서 상태 점검” 또는 “특정 group 에 속한 job만 찾아 처리”할 때.
>> job 을 정리(clean up)하거나, 모니터링/관리 시스템을 구축할 때 — 예: 완료된 job, 예정된 job, 진행 중 job 등 구분하여 조회 가능.
5. AWS IoT ListJobs 사용 주의할 점 / 제약점
>> ListJobs 호출을 위해서는 IAM 정책 상 iot:ListJobs 권한이 필요합니다.
>> 조회 결과가 많을 경우 페이지네이션이 필요합니다 — maxResults 와 nextToken 을 적절히 사용해야 전체 목록을 빠짐없이 조회할 수 있습니다.
>> status, targetSelection, thingGroupId/Name, namespaceId 등을 조합하여 필터링할 수 있지만, 필터를 너무 좁게 정하면 원하는 job이 누락될 수 있으므로 조건을 잘 설정해야 합니다.
6. AWS IoT ListJobs 사용 예시 코드 (자바스크립트)
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1416.0.min.js"></script>
const region = 'ap-northeast-2'; // [AWS 리전]
const accessKeyId = 'AK..A6'; // [IAM 액세스 키]
const secretAccessKey = 'mP..5J'; // [IAM 시크릿 키]
// -----------------------------------------
// [AWS.config 지정]
// -----------------------------------------
// IAM 계정 정보를 사용해 AWS.config 정보 업데이트 수행
// -----------------------------------------
AWS.config.update({
region: region,
accessKeyId: accessKeyId,
secretAccessKey: secretAccessKey
});
// -----------------------------------------
// [AWS.Iot 객체 생성]
// -----------------------------------------
const iot = new AWS.Iot();
// -----------------------------------------
// [Request : 요청 파라미터 생성]
// -----------------------------------------
// GET /v20180820/jobs?jobStatuses=JobStatuses&maxResults=MaxResults&nextToken=NextToken HTTP/1.1
// -----------------------------------------
const params = {
maxResults: 10, // 반환할 결과의 최대 개수입니다 (유효 범위: 최소값 0 ~ 최대값 10000)
// status: 'IN_PROGRESS', // 특정 상태 필터링 가능
// nextToken: '다음 페이지 토큰', // 페이징 처리 시 사용합니다
};
// -----------------------------------------
// [listJobs] : Aws Iot 원격 작업 목록 조회
// -----------------------------------------
// AWS 참고 사이트 : https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListJobs.html
// -----------------------------------------
iot.listJobs( params , function(err, data) {
if (err) {
console.error("[listJobs] : [Error] : ", err);
} else {
console.log("[listJobs] : [Success] : ", JSON.stringify(data));
// ---------------------------------------------
// [로그 출력 예시 첨부]
// ---------------------------------------------
/*
[
{
"jobArn": "arn:aws:iot:ap-northeast-2:123456789012:job/DEVICE_JOB_ID_TEST_1",
"jobId": "DEVICE_JOB_ID_TEST_1",
"thingGroupId": null,
"targetSelection": "SNAPSHOT",
"status": "COMPLETED",
"createdAt": "2025-10-14T09:40:35.429Z",
"lastUpdatedAt": "2025-10-14T10:19:00.763Z",
"completedAt": "2025-10-14T10:19:00.763Z",
"isConcurrent": null
}
]
*/
// ---------------------------------------------
}
});
// --------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------
[참고 사이트]
// --------------------------------------------------------------------------------------
[Aws Iot Core] 원격 작업 무선 업데이트 (OTA) job 개념 학습 및 펌웨어 업데이트 프로세스 정리
https://kkh0977.tistory.com/8133
https://blog.naver.com/kkh0977/223926549194?trackingCode=blog_bloghome_searchlist
[Aws Iot Core] AWS 원격 펌웨어 업데이트 job 알림 수신 jobs/notify 토픽과 jobs/notify-next 토픽 차이점 정리
https://kkh0977.tistory.com/8178
https://blog.naver.com/kkh0977/223954213087?trackingCode=blog_bloghome_searchlist
[Aws Iot Core] AWS 펌웨어 업데이트 Job Execution Rollout 설정 값 snapshot 과 continuous 차이점 정리
https://blog.naver.com/kkh0977/223960153729?trackingCode=blog_bloghome_searchlist
[Aws Iot Core] AWS 원격 펌웨어 업데이트 OTA 수동 job 생성 및 특정 사물 notify 펌웨어 업데이트 요청 방법 정리
https://blog.naver.com/kkh0977/223944636139?trackingCode=blog_bloghome_searchlist
[안드로이드 AWS Iot Core 원격 업데이트 Job 리스트 목록 확인]
https://blog.naver.com/kkh0977/223926528254?trackingCode=blog_bloghome_searchlist
[업무 이슈] Aws Iot Core 에서 Job 원격 펌웨어 업데이트 요청 시 상태가 완료 로 처리 되지 않는 이슈 발생
https://blog.naver.com/kkh0977/223944640508?trackingCode=blog_bloghome_searchlist
[업무 이슈] AWS Job 디바이스 펌웨어 업데이트 파일 순차 업데이트 미동작 이슈 - IN_PROGRESS, QUEUED 배열 펌웨어 처리
https://blog.naver.com/kkh0977/223955019266?trackingCode=blog_bloghome_searchlist
[업무 이슈] AWS Job 디바이스 펌웨어 업데이트 시 동일 버전 펌웨어 버전 체크 및 업데이트 진행 미완료 표시 - publish status
https://blog.naver.com/kkh0977/223955010876?trackingCode=blog_bloghome_searchlist
[업무 이슈] 디바이스 Aws Job OTA 펌웨어 업데이트 시 STS 임시 자격 증명 S3 Presigned URL 프리 사인 주소 파싱 문제 발생
https://blog.naver.com/kkh0977/223951554000?trackingCode=blog_bloghome_searchlist
// --------------------------------------------------------------------------------------
728x90
반응형
'Aws (Amazon)' 카테고리의 다른 글
Comments
