본문 바로가기

AWS

AWS IoT SiteWise Portal 삭제 이슈 해결방법

728x90

AWS IoT SiteWise엔 데이터를 대시보드화 하기 쉽도록 Portal 기능이 있다.

해당 기능을 이용하면 그래프를 통해 SiteWise에 저장/전달된 데이터를 쉽게 시각화 할 수 있다는 장점이 있다.

https://docs.aws.amazon.com/iot-sitewise/latest/userguide/monitor-getting-started.html

 

Get started with AWS IoT SiteWise Monitor (Classic) - AWS IoT SiteWise

When adding users or administrators to the portal, avoid creating AWS Identity and Access Management (IAM) policies that restrict user permissions, such as limited IP. Any attached policies with restricted permissions will not be able to connect to the AWS

docs.aws.amazon.com

 

하지만.. 이 portal은 외부 페이지로 디렉션되는 구조라 권한이나 사용자별 관리나 제어가 필요하다.

그 과정에서 .. 어떤 이슈로 인해 Portal이 삭제되지 않았는데 .. 그 이슈와 해결방안에 대해 풀어보고자 한다.

 

이슈 상황

AWS IoT SiteWise의 Portal 페이지에서 [삭제]를 선택했는데 다음 오류가 나타났다.

 

 

띠로리

 

에러를 확인하면 portal에 연결된 policies와 projects가 있어서 삭제가 불가능하다고 한다.

 

Projects 삭제

프로젝트를 삭제하려면 프로젝트 내에 설정된 프로젝트 뷰어프로젝트 소유자제거해야만 한다!

다음 링크를 참고해서 삭제하면 된다! https://docs.aws.amazon.com/iot-sitewise/latest/appguide/delete-projects.html

 

Delete projects in AWS IoT SiteWise Monitor - AWS IoT SiteWise Monitor

Delete projects in AWS IoT SiteWise Monitor As a portal administrator, you can delete any project that you don't need. To delete a project, you must first delete or remove all dashboards, associated assets, project owners, and project viewers. To delete a

docs.aws.amazon.com

 

Policies 삭제

Access Policy는 IAM identity Center User / Group 또는 IAM 사용자에게 지정된 AWS IoT SiteWise Monitor Portal이나 Project 리소스에 대한 액세스 권한을 부여하도록 정책을 만든다.

 

policies는 어디에서 삭제하는 건지.. 도저히 모르겠어서 AWS re:post에 도움을 요청했다.

친절한 AWS 사람이 cli로 해보라고 해서 도저언.!

 

 

1. Cloudshell에 접속한다.

 

2. Portal ID를 확인하기 위해 다음 cli를 입력한다.

aws iotsitewise list-portals

 

그러면 다음 형태의 출력이 나타난다. 여기에서 id 부분을 따로 메모해두자.

{
    "portalSummaries": [
        {
            "id": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111",
            "name": "MySiteWisePortal",
            "description": "Example portal",
            ...
        }
    ]
}

 

 

3. list-access-policies CLI로 어떤 정책이 있는지 확인해보자.

aws iotsitewise list-access-policies --resource-type PORTAL \
	--resource-id a1b2c3d4-5678-90ab-cdef-EXAMPLE11111

 

그러면 다음과 같은 access policy가 나타난다. (이런 걸 설정하지 않았음에도 있는 거 보면 사용자 제어 하다가 자동으로 생긴 것 같다 ..)

 

 

4. 이제 access policy를 지우면 된다!

aws iotsitewise delete-access-policy --access-policy-id ACCESS-POLICY-ID-aaaaa-YYYYYY

 

아무 출력이 없으면 삭제가 완료된 것이다.

 

 

5. 마지막으로 SiteWise portal 페이지에서 다시 [삭제]를 누르면 완전히 삭제된다

 

 

access policy가 예전엔 없었는데 생긴 걸 보면 삭제하는 과정에서 뭐가 꼬여서 설정이 누락되었거나, 또는 업데이트 되는 과정에서 자동으로 삭제되지 않아서 그런 것 같다 ..

IoT SiteWise Portal은 사용자 당 비용 과금이여서 사용자가 없으면 상관 없을테지만 혹시모를 비용을 위해 언제나 리소스 삭제하는 건 꼭 필요하다

 

참고 문서

list-access-policies : https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/list-access-policies.html

 

list-access-policies — AWS CLI 2.26.3 Command Reference

The total number of items to return in the command’s output. If the total number of items available is more than the value specified, a NextToken is provided in the command’s output. To resume pagination, provide the NextToken value in the starting-tok

awscli.amazonaws.com

delete-access-policy : https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/delete-access-policy.html

 

delete-access-policy — AWS CLI 2.26.3 Command Reference

Note To use the following examples, you must have the AWS CLI installed and configured. See the Getting started guide in the AWS CLI User Guide for more information. Unless otherwise stated, all examples have unix-like quotation rules. These examples will

awscli.amazonaws.com

 

 

그럼 끗

728x90