AWS EKS 실습/EKS 환경 구성
2. 사전 준비 - 2 (EKS Cluster 구성을 위한 Cloud 9 생성)
Clark Shim
2021. 2. 17. 15:47
AWS Cloud 9 으로 eks 설치를 위한 사전 환경 구성
ㅇ 사전에 생성한 IAM User로 AWS Console 로그인
ㅇ Cloud9 생성 버튼 클릭 (Create environment)
ㅇ cloud9 이름 정의 (eks-newelite)
ㅇ 환경 설정
ㅁ Environment Type: direct access
ㅁ Instance Type: t3.small(2GiB RAM + 2vCPU)
ㅁ Platform: Amazon Linux 2(recommended)
ㅁ Cost-Saving setting: After 30 minutes(default)
ㅁ IAM role : AWSServiceRoleForAWSCloud9
ㅁ Network(VPC): sdshim-vpc-01
ㅁ Subnet: public-subnet-a-01
ㅇ 최종 리뷰 완료 후 생성 클릭
ㅇ Cloud9 최종 구성 완료 화면
ㅇ 별첨: Cloud9 디스크 사이즈 증설 (작업 진행 중 디스크 부족할 수 있어 진행여부 검토)
pip3 install --user --upgrade boto3
export instance_id=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
python -c "import boto3
import os
from botocore.exceptions import ClientError
ec2 = boto3.client('ec2')
volume_info = ec2.describe_volumes(
Filters=[
{
'Name': 'attachment.instance-id',
'Values': [
os.getenv('instance_id')
]
}
]
)
volume_id = volume_info['Volumes'][0]['VolumeId']
try:
resize = ec2.modify_volume(
VolumeId=volume_id,
Size=30
)
print(resize)
except ClientError as e:
if e.response['Error']['Code'] == 'InvalidParameterValue':
print('ERROR MESSAGE: {}'.format(e))"
if [ $? -eq 0 ]; then
sudo reboot
fi