쿠키 기본 설정 선택

당사는 사이트와 서비스를 제공하는 데 필요한 필수 쿠키 및 유사한 도구를 사용합니다. 고객이 사이트를 어떻게 사용하는지 파악하고 개선할 수 있도록 성능 쿠키를 사용해 익명의 통계를 수집합니다. 필수 쿠키는 비활성화할 수 없지만 '사용자 지정' 또는 ‘거부’를 클릭하여 성능 쿠키를 거부할 수 있습니다.

사용자가 동의하는 경우 AWS와 승인된 제3자도 쿠키를 사용하여 유용한 사이트 기능을 제공하고, 사용자의 기본 설정을 기억하고, 관련 광고를 비롯한 관련 콘텐츠를 표시합니다. 필수가 아닌 모든 쿠키를 수락하거나 거부하려면 ‘수락’ 또는 ‘거부’를 클릭하세요. 더 자세한 내용을 선택하려면 ‘사용자 정의’를 클릭하세요.

환경에서 사용하는 Amazon EBS 볼륨 크기 조정

포커스 모드
환경에서 사용하는 Amazon EBS 볼륨 크기 조정 - AWS Cloud9

AWS Cloud9 는 더 이상 신규 고객이 사용할 수 없습니다. AWS Cloud9 의 기존 고객은 정상적으로 서비스를 계속 이용할 수 있습니다. 자세히 알아보기

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

AWS Cloud9 는 더 이상 신규 고객이 사용할 수 없습니다. AWS Cloud9 의 기존 고객은 정상적으로 서비스를 계속 이용할 수 있습니다. 자세히 알아보기

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

이 단계에서는 Amazon EBS 볼륨의 크기를 조정할 수 있는 방법을 설명합니다.

  1. 크기를 조정할 Amazon EBS 볼륨에 대해 Amazon EC2 인스턴스와 연결된 환경을 엽니다.

  2. 환경의 AWS Cloud9 IDE에서 다음 내용이 포함된 파일을 생성한 다음 확장명.sh(예: resize.sh)으로 파일을 저장합니다.

    Note

    이 스크립트는 AL2023, Amazon Linux 2, Amazon Linux 또는 Ubuntu 서버를 실행하는 EC2 인스턴스에 연결된 Amazon EBS 볼륨에 적용되며 IMDSv2를 사용하도록 구성됩니다.

    또한 이 스크립트는 Nitro 기반 인스턴스에 NVMe 블록 디바이스로 표시된 Amazon EBS 볼륨의 크기를 조정합니다. Nitro 시스템을 기반으로 한 인스턴스의 목록은 Amazon EC2 사용 설명서에서 Nitro 기반 인스턴스를 참조하세요.

    #!/bin/bash # Specify the desired volume size in GiB as a command line argument. If not specified, default to 20 GiB. SIZE=${1:-20} # Get the ID of the environment host Amazon EC2 instance. TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 60") INSTANCEID=$(curl -s -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/instance-id 2> /dev/null) REGION=$(curl -s -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/placement/region 2> /dev/null) # Get the ID of the Amazon EBS volume associated with the instance. VOLUMEID=$(aws ec2 describe-instances \ --instance-id $INSTANCEID \ --query "Reservations[0].Instances[0].BlockDeviceMappings[0].Ebs.VolumeId" \ --output text \ --region $REGION) # Resize the EBS volume. aws ec2 modify-volume --volume-id $VOLUMEID --size $SIZE # Wait for the resize to finish. while [ \ "$(aws ec2 describe-volumes-modifications \ --volume-id $VOLUMEID \ --filters Name=modification-state,Values="optimizing","completed" \ --query "length(VolumesModifications)"\ --output text)" != "1" ]; do sleep 1 done # Check if we're on an NVMe filesystem if [[ -e "/dev/xvda" && $(readlink -f /dev/xvda) = "/dev/xvda" ]] then # Rewrite the partition table so that the partition takes up all the space that it can. sudo growpart /dev/xvda 1 # Expand the size of the file system. # Check if we're on AL2 or AL2023 STR=$(cat /etc/os-release) SUBAL2="VERSION_ID=\"2\"" SUBAL2023="VERSION_ID=\"2023\"" if [[ "$STR" == *"$SUBAL2"* || "$STR" == *"$SUBAL2023"* ]] then sudo xfs_growfs -d / else sudo resize2fs /dev/xvda1 fi else # Rewrite the partition table so that the partition takes up all the space that it can. sudo growpart /dev/nvme0n1 1 # Expand the size of the file system. # Check if we're on AL2 or AL2023 STR=$(cat /etc/os-release) SUBAL2="VERSION_ID=\"2\"" SUBAL2023="VERSION_ID=\"2023\"" if [[ "$STR" == *"$SUBAL2"* || "$STR" == *"$SUBAL2023"* ]] then sudo xfs_growfs -d / else sudo resize2fs /dev/nvme0n1p1 fi fi
  3. IDE의 터미널 세션에서 resize.sh 파일을 포함하는 디렉터리로 전환합니다. 그리고 나서 다음 명령 중 하나를 실행하여 Amazon EBS Volume의 크기를 조정하기 위해 20을 원하는 크기(단위: GIB)로 바꿉니다.

    • bash resize.sh 20
    • chmod +x resize.sh ./resize.sh 20
프라이버시사이트 이용 약관쿠키 기본 설정
© 2025, Amazon Web Services, Inc. 또는 계열사. All rights reserved.