

AWS Well-Architected 에이전트는 현재 프리뷰 버전이 출시 중이기 때문에 변경될 수도 있습니다.

# API 빠른 시작
<a name="agent-api-quickstart"></a>

콘솔 대신 AWS CLI 또는 SDK를 통해 AWS WA 에이전트를 완전히 설정할 수 있습니다. 이 빠른 시작에서는 프로필 생성, 목표 추가, 애플리케이션 컨텍스트 추가 및 자격 확인을 안내합니다.

**참고**  
API를 사용하기 전에 [3단계: 권한 및 통합 구성](agent-getting-started.md#agent-permissions-integrations) 및 [6단계: 워크로드 계정에서 액세스 역할 생성](agent-getting-started.md#agent-access-roles)에 설명된 대로 실행 역할과 액세스 역할을 생성합니다. API는 IAM 역할을 생성하지 않습니다.

## 1단계: 에이전트 프로필 생성
<a name="agent-api-create-profile"></a>

실행 역할, 대상 원칙 및 계정 구성을 사용하여 프로필을 생성합니다.

**에이전트 프로필을 생성하려면(CLI)**

1. 다음 명령을 실행합니다. 자리 표시자 값을 계정 ID, 역할 ARN 및 대상 리전으로 바꿉니다.
**참고**  
 공통 액세스 역할 이름을 선택하거나 계정당 액세스 역할 이름을 입력할 수 있습니다. 이는 온보딩의 API 버전에서만 사용할 수 있으며 콘솔에서는 사용할 수 없습니다.

   ```
   aws wellarchitected create-agent-profile \
       --name "my-production-profile" \
       --execution-role-arn "arn:aws:iam::{{111122223333}}:role/service-role/ExecutionRoleForWellArchitectedAgent" \
       --pillars COST_OPTIMIZATION SECURITY RESILIENCE PERFORMANCE \
       --aggregation-configuration '[{"accountId":"{{444455556666}}","accessRoleArn":"arn:aws:iam::{{444455556666}}:role/AccessRoleForWellArchitectedAgent","regions":["us-east-1","us-west-2"]}]'
   ```

1. 응답에서 프로필 ARN을 기록해 둡니다. 후속 명령에서 이 값을 사용하게 됩니다.

## 2단계: 최적화 목표 추가
<a name="agent-api-create-goal"></a>

권장 사항 우선순위 지정을 촉진하기 위한 목표를 추가합니다. 각 목표는 하나 이상의 최적화 원칙과 연결됩니다.

**목표를 추가하려면(CLI)**
+ 다음 명령을 실행합니다. 프로필 ARN을 1단계의 값으로 바꿉니다.

  ```
  aws wellarchitected create-agent-goal \
      --profile-arn "arn:aws:wellarchitected:{{us-east-1}}:{{111122223333}}:agent-profile/{{my-production-profile}}" \
      --title "Reduce EC2 spend by 20% by Q4 through rightsizing and Reserved Instance coverage" \
      --pillars COST_OPTIMIZATION
  ```

## 3단계: 애플리케이션 컨텍스트 추가
<a name="agent-api-create-context"></a>

AWS WA 에이전트가 보다 관련성이 높고 개인화된 추천을 생성할 수 있도록 애플리케이션 메타데이터를 제공합니다.

**애플리케이션 컨텍스트를 추가하려면(CLI)**
+ 다음 명령을 실행합니다. 프로필 ARN 및 콘텐츠 필드를 애플리케이션 세부 정보로 바꿉니다.

  ```
  aws wellarchitected create-agent-context \
      --profile-arn "arn:aws:wellarchitected:{{us-east-1}}:{{111122223333}}:agent-profile/{{my-production-profile}}" \
      --title "Payment processing service" \
      --context-type APPLICATION \
      --content '{"applicationOverview":"Real-time payment processing","criticality":"MISSION_CRITICAL","accountIds":["{{444455556666}}"],"regions":["us-east-1"]}'
  ```

## 4단계: 프로필 자격 확인
<a name="agent-api-verify-eligibility"></a>

프로필이 유효하고 권장 사항 생성에 적합한지 확인합니다.

**자격을 확인하려면(CLI)**

1. 다음 명령을 실행합니다.

   ```
   aws wellarchitected get-agent-profile \
       --profile-arn "arn:aws:wellarchitected:{{us-east-1}}:{{111122223333}}:agent-profile/{{my-production-profile}}" \
       --query '{eligible: eligibleForScheduledGeneration, errors: fieldErrors}'
   ```

1. `eligibleForScheduledGeneration`이 `true`이면 프로필이 올바르게 구성된 것입니다. 예정된 권장 사항은 48시간 이내에 생성되기 시작합니다.

1. `eligibleForScheduledGeneration`이 `false`인 경우 `fieldErrors` 맵에서 특정 문제를 확인합니다. 일반적인 해결 방법은 [AWS Well-Architected 에이전트 문제 해결](agent-troubleshooting.md) 섹션을 참조하세요.

전체 API 참조는 [AWS Well-Architected API 참조](https://docs.aws.amazon.com/wellarchitected/latest/APIReference/Welcome.html)를 참조하세요.