Skip to content

feat(aws/ami): Sales 계정 AMI 승격 자동화 - #146

Open
jk-kim0 wants to merge 5 commits into
mainfrom
codex/automate-ami-promotion
Open

feat(aws/ami): Sales 계정 AMI 승격 자동화#146
jk-kim0 wants to merge 5 commits into
mainfrom
codex/automate-ami-promotion

Conversation

@jk-kim0

@jk-kim0 jk-kim0 commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Why

  • QPE 계정에서 검증한 AMI를 Sales 계정의 Marketplace 제출용 AMI로 전환하는 과정이 수동으로 수행되고 있습니다.
  • 계정, 리전, 암호화 조건이 고정된 운영 절차이므로 입력을 최소화하고 공유 권한의 회수까지 일관되게 자동화할 필요가 있습니다.

What

  • ami-promote-to-sales.sh <qpe-ami-id> 명령을 추가합니다.
    • QPE/Sales 계정 ID, AWS CLI profile, 소스/대상 Region을 스크립트에 고정합니다.
    • QPE AMI와 모든 backing snapshot을 Sales 계정에 임시 공유합니다.
    • Sales 계정의 us-east-1에 비암호화 AMI를 복사하고 Marketplace 구조 검증을 실행합니다.
    • 승격 완료 또는 복사 terminal 상태 이후 QPE 공유 권한을 회수합니다.
    • 복사 진행 상태가 불명확한 경우에는 공유를 유지하고 동일 AMI ID로 재실행할 수 있습니다.
    • terminal 상태의 기존 Sales AMI는 retry-N 시도로 자동 대체합니다.
  • 동일 소스 AMI의 기존 Sales 복사본을 태그로 식별해 재사용하고 중복 복사를 방지합니다.
  • 계정 불일치, Sales EBS 기본 암호화 활성화, 권한 롤백과 회수 경계를 Bats 테스트로 검증합니다.
  • aws/ami/README.md에 실행 전제조건과 승격·회수 흐름을 문서화합니다.

Impact

  • 운영자는 기능 검증을 통과한 QPE AMI ID 하나만 입력하면 Sales 소유 Marketplace 소스 AMI를 생성할 수 있습니다.
  • 복사 완료 후 QPE AMI와 snapshot의 Sales 접근 권한이 남지 않습니다.
  • AWS CLI의 qpe, sales profile은 저장소 밖에서 사전에 설정하고 로그인해야 합니다.

Added/updated tests?

  • Yes
    • bash -n aws/ami/ami-promote-to-sales.sh
    • bats aws/ami/tests/*.bats — 40 tests passed

Additional notes

  • 실제 AWS AMI 복사나 권한 변경은 수행하지 않았으며, AWS 호출은 mock 기반 테스트로 검증했습니다.

QPE AMI와 backing snapshot을 Sales 계정에 임시 공유하고, us-east-1 복사와 Marketplace 구조 검증을 자동화합니다.

승격 완료 후 공유 권한을 회수하며 복사 상태에 따른 롤백과 재실행 경계를 추가합니다.

Co-Authored-By: Atlas <atlas@jk.agent>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6f297913de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread aws/ami/ami-promote-to-sales.sh
Comment thread aws/ami/ami-promote-to-sales.sh Outdated
@jk-kim0 jk-kim0 self-assigned this Aug 7, 2026
jk-kim0 and others added 2 commits August 7, 2026 16:55
진행 중인 Sales AMI의 권한 복구 전에 복사 상태를 표시해 실패 시 공유를 유지합니다.

복사 시작 전 실패에서는 임시 공유 권한 전체를 검증하며 회수하고, 회수 실패 시 재시도 안내를 출력합니다.

Co-Authored-By: Atlas <atlas@jk.agent>
권한 조회 실패를 권한 부재와 구분하고 오류 종료 코드를 보존한다. 계정, 중복 AMI, 잘못된 인자와 정리 검증 실패 회귀 테스트를 추가한다.

Co-Authored-By: Atlas <atlas@jk.agent>
@jk-kim0

jk-kim0 commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cfdaa7a7ac

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread aws/ami/ami-promote-to-sales.sh
Comment thread aws/ami/ami-promote-to-sales.sh
CopyImage 응답이 불명확하면 원본 공유를 유지해 진행 중인 복사를 보호한다. terminal Sales AMI는 retry-N 시도로 자동 대체하고 재실행 절차와 회귀 테스트를 갱신한다.

Co-Authored-By: Atlas <atlas@jk.agent>
@jk-kim0

jk-kim0 commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d220b749ca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread aws/ami/ami-promote-to-sales.sh
옵션 구분자 뒤의 위치 인자를 보존해 표준 -- 사용 방식에서도 AMI ID가 정상 처리되도록 한다. 해당 호출 경로를 Bats 회귀 테스트로 검증한다.

Co-Authored-By: Atlas <atlas@jk.agent>
@jk-kim0

jk-kim0 commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 0353fb3dbf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant