

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

# AMS 계정의 S3 버킷에 대한 EC2 인스턴스 쓰기 액세스 허용
<a name="allow-ec2-instances-write-access-to-s3-buckets-in-ams-accounts"></a>

*Mansi Suratwala, Amazon Web Services*

## 요약
<a name="allow-ec2-instances-write-access-to-s3-buckets-in-ams-accounts-summary"></a>

AWS Managed Services (AMS)를 사용하면 AWS 인프라를 보다 효율적이고 안전하게 운영할 수 있습니다. AMS 계정에는 AWS 리소스의 표준화된 관리를 위한 보안 가드레일이 있습니다. 한 가지 문제는 기본 Amazon Elastic Compute Cloud(Amazon EC2) 인스턴스 프로파일에서는 Amazon Simple Storage Service(S3) 버킷에 대한 쓰기 액세스를 허용하지 않는다는 것입니다. 하지만 조직에 S3 버킷이 여러 개 있을 수 있으며 EC2 인스턴스의 액세스 제어를 강화해야 할 수도 있습니다. 예를 들어 S3 버킷에 EC2 인스턴스의 데이터베이스 백업을 저장하려고 할 수 있습니다.

이 패턴은 변경 요청(RFC)을 사용하여 EC2 인스턴스에 AMS 계정의 S3 버킷에 대한 쓰기 액세스를 허용하는 방법을 설명합니다. RFC는 관리형 환경을 변경하기 위해 사용자 또는 AMS가 생성하는 요청으로, 여기에는 특정 작업에 대한 [변경 유형](https://docs.aws.amazon.com/managedservices/latest/ctref/classifications.html)(CT) ID가 포함됩니다.

## 사전 조건 및 제한 사항
<a name="allow-ec2-instances-write-access-to-s3-buckets-in-ams-accounts-prereqs"></a>

**사전 조건 **
+ AMS 고급 계정. 이에 대한 자세한 내용은 AWS 설명서의 [AMS 운영 계획](https://docs.aws.amazon.com/managedservices/latest/accelerate-guide/what-is-ams-op-plans.html)을 참조하세요. 
+  AWS Identity and Access Management (IAM) `customer-mc-user-role` 역할에 액세스하여 RFCs 제출합니다. 
+ AWS Command Line Interface (AWS CLI)는 AMS 계정의 EC2 인스턴스로 설치 및 구성됩니다. 
+ AMS에서 RFC를 생성하고 제출하는 방법에 대한 이해. 이에 대한 자세한 내용은 AWS 설명서의 [AMS 변경 유형이란 무엇입니까?](https://docs.aws.amazon.com/managedservices/latest/ctref/what-are-change-types.html)를 참조하세요.
+ 수동 및 자동 변경 유형(CT)에 대한 이해 이에 대한 자세한 내용은 AWS 설명서의 [자동 및 수동 CT](https://docs.aws.amazon.com/managedservices/latest/userguide/ug-automated-or-manual.html)를 참조하세요.

## 아키텍처
<a name="allow-ec2-instances-write-access-to-s3-buckets-in-ams-accounts-architecture"></a>

**기술 스택  **
+ AMS
+ AWS CLI
+ Amazon EC2
+ Amazon S3
+ IAM

## 도구
<a name="allow-ec2-instances-write-access-to-s3-buckets-in-ams-accounts-tools"></a>
+ [AWS Command Line Interface (AWS CLI)](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html)는 명령줄 셸의 명령을 AWS 서비스 통해와 상호 작용하는 데 도움이 되는 오픈 소스 도구입니다.
+ [AWS Identity and Access Management (IAM)](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html)는 AWS 리소스에 대한 액세스를 인증하고 사용할 권한이 있는 사용자를 제어하여 리소스에 대한 액세스를 안전하게 관리하는 데 도움이 됩니다.
+ [AWS Managed Services (AMS)](https://docs.aws.amazon.com/managedservices/latest/userguide/what-is-ams.html)를 사용하면 AWS 인프라를 보다 효율적이고 안전하게 운영할 수 있습니다. 
+ [Amazon Simple Storage Service(S3)](https://docs.aws.amazon.com/AmazonS3/latest/userguide/Welcome.html)는 원하는 양의 데이터를 저장, 보호 및 검색하는 데 도움이 되는 클라우드 기반 객체 스토리지 서비스입니다.
+ [Amazon Elastic Compute Cloud(Amazon EC2)](https://docs.aws.amazon.com/ec2/)는 AWS 클라우드에서 확장 가능한 컴퓨팅 용량을 제공합니다. 필요한 만큼 가상 서버를 시작하고 빠르게 스케일 업하거나 스케일 다운할 수 있습니다.

## 에픽
<a name="allow-ec2-instances-write-access-to-s3-buckets-in-ams-accounts-epics"></a>

### RFC를 사용하여 S3 버킷 생성
<a name="create-an-s3-bucket-with-an-rfc"></a>


| 작업 | 설명 | 필요한 기술 | 
| --- | --- | --- | 
| 자동화된 RFC를 사용하여 S3 버킷을 생성합니다. | [See the AWS documentation website for more details](http://docs.aws.amazon.com/ko_kr/prescriptive-guidance/latest/patterns/allow-ec2-instances-write-access-to-s3-buckets-in-ams-accounts.html)S3 버킷의 이름을 기록해 두어야 합니다. | AWS 시스템 관리자, AWS 개발자 | 

### IAM 인스턴스 프로파일을 생성하고 EC2 인스턴스에 연결
<a name="create-an-iam-instance-profile-and-associate-it-with-the-ec2-instances"></a>


| 작업 | 설명 | 필요한 기술 | 
| --- | --- | --- | 
| 수동 RFC를 제출하여 IAM 역할을 생성하세요. | AMS 계정이 온보딩되면 `customer-mc-ec2-instance-profile`이라는 기본 IAM 인스턴스 프로파일이 생성되고 AMS 계정의 각 EC2 인스턴스에 연결됩니다. 그러나 인스턴스 프로파일에는 S3 버킷에 대한 쓰기 권한이 없습니다.<br />쓰기 권한을 추가하려면 **IAM 리소스 생성** 수동 RFC를 제출하여 `customer_ec2_instance_`, 및 `customer_deny_policy`라는 세 가지 정책이 있는 IAM 역할을 생성합니다`customer_ec2_s3_integration_policy`. `customer_ec2_instance_` 및 `customer_deny_policy` 정책은 AMS 계정에 이미 있습니다. 그러나 다음 샘플 정책을 `customer_ec2_s3_integration_policy` 사용하여를 생성해야 합니다.<pre>{<br />  "Version": "2012-10-17",		 	 	 <br />   "Statement": [<br />    {<br />      "Sid": "",<br />       "Effect": "Allow",<br />       "Principal": {<br />         "Service": "ec2.amazonaws.com"<br />      },<br />       "Action": "sts:AssumeRole"<br />    }<br />  ]<br />}<br /> <br />Role Permissions:<br />{<br />     "Version": "2012-10-17",		 	 	 <br />     "Statement": [<br />        {<br />             "Action": [<br />                 "s3:ListBucket",<br />                 "s3:GetBucketLocation"<br />            ],<br />             "Resource": "arn:aws:s3:::",<br />             "Effect": "Allow"<br />        },<br />        {<br />             "Action": [<br />                 "s3:GetObject",<br />                 "s3:PutObject",<br />                 "s3:ListMultipartUploadParts",<br />                 "s3:AbortMultipartUpload"<br />            ],<br />             "Resource": "arn:aws:s3:::/*",<br />             "Effect": "Allow"<br />        }<br />    ]<br />}</pre> | AWS 시스템 관리자, AWS 개발자 | 
| 수동 RFC를 제출하여 IAM 인스턴스 프로파일을 대체하세요. | 수동 RFC를 제출하여 대상 EC2 인스턴스를 새 IAM 인스턴스 프로파일과 연결하세요. | AWS 시스템 관리자, AWS 개발자 | 
| S3 버킷으로의 복사 작업을 테스트합니다. |  AWS CLI에서 다음 명령을 실행하여 S3 버킷으로의 복사 작업을 테스트합니다.<pre>aws s3 cp test.txt s3://<S3 bucket>/test2.txt</pre> | AWS 시스템 관리자, AWS 개발자 | 

## 관련 리소스
<a name="allow-ec2-instances-write-access-to-s3-buckets-in-ams-accounts-resources"></a>
+ [Amazon EC2 인스턴스에 대한 IAM 인스턴스 프로파일 생성](https://docs.aws.amazon.com/codedeploy/latest/userguide/getting-started-create-iam-instance-profile.html)
+ [S3 버킷 생성(Amazon S3 콘솔, AWS SDKs 또는 사용 AWS CLI)](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/create-bucket.html)