

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

# AWS SAM 파이프라인에서 OIDC 인증을 사용하는 방법
<a name="deploying-with-oidc"></a>

AWS Serverless Application Model ()는 Bitbucket, GitHub Actions 및 GitLab 지속적 통합 및 지속적 전송(CI/CD) 플랫폼에 대한 OpenID Connect(OIDC) 사용자 인증을AWS SAM지원합니다. 이 지원을 통해 모든 플랫폼에서 인증된 CI/CD 사용자 계정을 사용하여 서버리스 애플리케이션 파이프라인을 관리할 수 있습니다. 그렇지 않으면 AWS SAM 파이프라인에 대한 액세스를 제어하기 위해 여러 AWS Identity and Access Management (IAM) 사용자를 생성하고 관리해야 합니다.

## AWS SAM 파이프라인을 사용하여 OIDC 설정
<a name="deploying-with-oidc-setup"></a>

`sam pipeline bootstrap` 구성 프로세스 중에 다음을 수행하여 AWS SAM 파이프라인으로 OIDC를 설정합니다.

1. ID 제공자를 선택하라는 메시지가 표시되면 **OIDC**를 선택합니다.

1. 다음으로 지원되는 OIDC 공급자를 선택합니다.

1. **https://**로 시작하는 OIDC 공급자 URL을 입력합니다.
**참고**  
AWS SAM 는 `AWS::IAM::OIDCProvider` 리소스 유형을 생성할 때이 URL을 참조합니다.

1. 그런 다음 프롬프트에 따라 선택한 플랫폼에 액세스하는 데 필요한 CI/CD 플랫폼 정보를 입력합니다. 이러한 세부 정보는 플랫폼마다 다르며 다음을 포함할 수 있습니다.
   + OIDC 클라이언트 ID.
   + 코드 리포지토리 이름 또는 범용 고유 식별자(UUID).
   + 리포지토리와 연관된 그룹 또는 조직 이름.
   + 코드 리포지토리가 속한 GitHub 조직.
   + GitHub 리포지토리 이름.
   + 배포가 이루어지는 브랜치.

1. AWS SAM 는 입력된 OIDC 구성의 요약을 표시합니다. 편집하려면 설정 번호를 입력하거나 Enter를 눌러 계속 진행합니다.

1. 입력한 OIDC 연결을 지원하는 데 필요한 리소스 생성을 확인하라는 메시지가 표시되면 Y를 눌러 계속 진행합니다.

AWS SAM 는 파이프라인 실행 역할을 수임하는 제공된 구성으로 `AWS::IAM::OIDCProvider` AWS CloudFormation 리소스를 생성합니다. 이 CloudFormation 리소스 유형에 대해 자세히 알아보려면 *AWS CloudFormation 사용 설명서*의 [AWS::IAM::OIDCProvider](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-oidcprovider.html)를 참조하세요.

**참고**  
ID 제공업체(IdP) 리소스가 이미 AWS SAM 에 있는 경우는 새 리소스를 생성하는 대신 참조 AWS 계정합니다.

## 예제
<a name="deploying-with-oidc-setup-example"></a>

다음은 AWS SAM 파이프라인을 사용하여 OIDC를 설정하는 예제입니다.

```
Select a permissions provider:
    1 - IAM (default)
    2 - OpenID Connect (OIDC)
Choice (1, 2): 2
Select an OIDC provider:
    1 - GitHub Actions
    2 - GitLab
    3 - Bitbucket
Choice (1, 2, 3): 1
Enter the URL of the OIDC provider [https://token.actions.githubusercontent.com]:
Enter the OIDC client ID (sometimes called audience) [sts.amazonaws.com]:
Enter the GitHub organization that the code repository belongs to. If there is no organization enter your username instead: my-org
Enter GitHub repository name: testing
Enter the name of the branch that deployments will occur from [main]:

[3] Reference application build resources
Enter the pipeline execution role ARN if you have previously created one, or we will create one for you []:
Enter the CloudFormation execution role ARN if you have previously created one, or we will create one for you []:
Please enter the artifact bucket ARN for your Lambda function. If you do not have a bucket, we will create one for you []:
Does your application contain any IMAGE type Lambda functions? [y/N]:

[4] Summary
Below is the summary of the answers:
    1 - Account: 123456
    2 - Stage configuration name: dev
    3 - Region: us-east-1
    4 - OIDC identity provider URL: https://token.actions.githubusercontent.com
    5 - OIDC client ID: sts.amazonaws.com
    6 - GitHub organization: my-org
    7 - GitHub repository: testing
    8 - Deployment branch: main
    9 - Pipeline execution role: [to be created]
    10 - CloudFormation execution role: [to be created]
    11 - Artifacts bucket: [to be created]
    12 - ECR image repository: [skipped]
Press enter to confirm the values above, or select an item to edit the value:

This will create the following required resources for the 'dev' configuration:
    - IAM OIDC Identity Provider
    - Pipeline execution role
    - CloudFormation execution role
    - Artifact bucket
Should we proceed with the creation? [y/N]:
```

## 자세히 알아보기
<a name="deploying-with-oidc-setup-learn-more"></a>

 AWS SAM 파이프라인과 함께 OIDC를 사용하는 방법에 대한 자세한 내용은 섹션을 참조하세요[sam pipeline bootstrap](sam-cli-command-reference-sam-pipeline-bootstrap.md).