eb migrate - AWS Elastic Beanstalk

eb migrate

설명

인터넷 정보 서비스(IIS) 사이트와 애플리케이션을 Windows 서버에서 Elastic Beanstalk으로 마이그레이션합니다. 이 명령은 애플리케이션을 패키징하고 구성 정보를 보존한 뒤, 새로운 Elastic Beanstalk 환경에 배포합니다.

IIS 사이트 및 애플리케이션 마이그레이션에 대한 자세한 내용은 Elastic Beanstalk로 IIS 애플리케이션 마이그레이션 섹션을 참조하세요.

참고

이 명령어를 사용하기 전에 시스템이 다음 요구 사항을 충족하는지 확인하세요.

  • IIS(인터넷 정보 서비스) 버전 7.0 이상

  • Web Deploy 3.6 이상이 설치됨

  • Windows 서버에 대한 관리 권한

  • 적절한 권한으로 구성된 AWS 자격 증명

  • 소스 서버에는 AWS 서비스에 대한 아웃바운드 인터넷 액세스 권한이 있습니다.

다음 단계는 마이그레이션 절차를 요약한 것입니다.

  1. IIS 사이트 및 해당 구성을 검색합니다.

  2. 애플리케이션 콘텐츠와 구성을 패키징합니다.

  3. Elastic Beanstalk 환경 및 애플리케이션을 생성합니다.

  4. 보존된 설정으로 애플리케이션을 배포합니다.

이 명령은 다음과 같이 구조화된 디렉터리에 마이그레이션 아티팩트를 생성합니다.

C:\migration_workspace\ └── .\migrations\latest\ ├── upload_target.zip └── upload_target\ ├── [SiteName].zip # One ZIP per default application of IIS site ├── [SiteName-ApplicationName].zip # One ZIP per additional application ├── aws-windows-deployment-manifest.json └── ebmigrateScripts\ ├── site_installer.ps1 # Site installation scripts ├── permission_handler.ps1 # Permission management └── other helper scripts

eb migrate cleanup을 사용하여 이러한 아티팩트를 관리합니다.

구문

eb migrate [options]

eb migrate explore [options]

eb migrate cleanup [options]

인수를 지정하지 않고 실행하면 eb migrate가 비대화형 모드로 동작합니다. 대화형 모드로 실행하려면 eb migrate --interactive를 실행하세요.

대화형 모드 명령은 다음 정보를 묻는 프롬프트를 표시합니다.

  • 마이그레이션하려는 IIS 사이트 선택

  • 환경 및 애플리케이션 이름

  • 플랫폼 버전 선택

  • 인스턴스 유형 및 기타 구성 옵션

하위 명령

explore

eb migrate explore 하위 명령은 IIS 서버를 검사하여 사용 가능한 사이트 목록을 출력합니다.

다음 정보를 표시하려면 이 명령을 사용하세요.

  • 서버에 있는 모든 IIS 사이트 보기

  • --verbose를 사용하면 다음을 포함한 상세 설정을 확인할 수 있습니다.

    • 사이트 바인딩 및 포트

    • 애플리케이션 풀

    • 가상 디렉터리 및 물리적 경로

    • 인증 설정

PS C:\migrations_workspace > eb migrate explore Default Web Site Site2 site3 router
PS C:\migrations_workspace > eb migrate explore --verbose 1: Default Web Site: - Bindings: - *:8083: - Application '/': - Application Pool: DefaultAppPool - Enabled Protocols: http - Virtual Directories: - /: - Physical Path: C:\inetpub\wwwroot - Logon Method: ClearText - Application '/dotnet-6-0': - Application Pool: DefaultAppPool - Enabled Protocols: http - Virtual Directories: - /: - Physical Path: C:\inetpub\AspNetCoreWebApps\CoreWebApp-6-0 - Logon Method: ClearText - Application '/dotnet-8-0': - Application Pool: DefaultAppPool - Enabled Protocols: http - Virtual Directories: - /: - Physical Path: C:\inetpub\AspNetCoreWebApps\CoreWebApp-8-0 - Logon Method: ClearText 2: Site2: - Bindings: - *:8081: ...

정리

eb migrate cleanup 하위 명령은 다음 작업을 통해 마이그레이션 아티팩트를 관리합니다

  • ./migrations/latest에서 가장 최근의 성공적인 마이그레이션 보존

  • 이전 마이그레이션 디렉터리 제거

  • 중요한 구성 파일 유지

PS C:\migrations_workspace > eb migrate cleanup Are you sure you would like to cleanup older artifacts within `./migrations/`? (y/N):

정리 작업 중 확인 프롬프트를 건너뛰려면 --force를 사용하세요.

PS C:\migrations_workspace > eb migrate cleanup --force

옵션

이러한 옵션이 필요하지 않습니다. 옵션 없이 eb migrate를 실행하면 EB CLI는 비대화형 모드로 작동합니다. eb migrate --interactive를 사용하면 EB CLI가 필수 설정 값을 입력하거나 선택하라는 프롬프트를 표시합니다.

명칭

설명

-a application-name

or

--application-name application-name

새 Elastic Beanstalk 애플리케이션의 이름입니다.

유형: 문자열

기본값: EBMigratedApp

--archive directory-or-zip

이전 단계에서 eb migrate --archive-only로 생성된 소스 코드를 포함한 디렉터리 또는 ZIP 파일입니다.

이전에 생성한 마이그레이션 패키지를 배포하려면 이 옵션을 사용하세요.

예: --archive .\migrations\latest\upload_target 또는 --archive .\migrations\latest\upload_target.zip

-ao

or

--archive-only

배포 없이 대상 아카이브 디렉터리만 생성합니다.

생성된 디렉터리는 eb migrate과 함께 archive 옵션을 사용하거나 eb deploy를 통해 수동 배포할 수 있습니다.

-c subdomain-name

또는

--cname subdomain-name

마이그레이션된 애플리케이션의 CNAME DNS 항목 앞에 붙일 하위 도메인 이름입니다.

유형: 문자열

기본값: 환경 이름

-cf

or

--copy-firewall-config

모든 활성 바인딩이 설정된 HTTP 포트에 대해 소스 서버의 방화벽 구성을 대상 서버에 복사합니다.

AWS에 해당 보안 그룹 규칙을 생성합니다.

-es snapshot-id [snapshot-id ...]

or

--ebs-snapshots snapshot-id [snapshot-id ...]

환경에 연결할 Amazon EBS 스냅샷 ID 목록(쉼표로 구분)입니다.

예시: --ebs-snapshots snap-1234567890abcdef0, snap-0987654321fedcba1

--encrypt-ebs-volumes

모든 신규 Amazon EBS 볼륨에 대해 암호화를 적용합니다.

중요

이 설정은 계정 전체에 적용되며 이후 생성되는 모든 Amazon EBS 볼륨에 영향을 미칩니다.

-e environment-name

or

--environment-name environment-name

새로운 Elastic Beanstalk 환경의 이름입니다.

유형: 문자열

기본값: EBMigratedEnv

제약 요건: 길이는 4~40자여야 합니다. 문자, 숫자 및 하이픈만 포함될 수 있습니다. 하이픈으로 시작되거나 끝날 수 없습니다.

--force

작업 중에 확인 프롬프트를 건너뜁니다.

cleanup 하위 명령과 함께 사용하면 확인 없이 마이그레이션 아티팩트를 제거합니다.

-ip profile-name

or

--instance-profile profile-name

환경의 Amazon EC2 인스턴스에 연결할 인스턴스 프로파일입니다.

별도로 지정하지 않으면 Elastic Beanstalk 리소스에 액세스할 수 있는 권한이 포함된 기본 인스턴스 프로파일이 생성됩니다. 자세한 내용은 Elastic Beanstalk 인스턴스 프로파일 섹션을 참조하세요.

-i 인스턴스 유형

or

--instance-type 인스턴스 유형

Elastic Beanstalk 환경에 대한 Amazon EC2 인스턴스 유형

유형: 문자열

기본값: c5.2xlarge

사용 가능한 인스턴스 유형은 Amazon EC2 사용 설명서Amazon EC2 인스턴스 유형을 참조하세요.

-in

or

--interactive

마이그레이션 프로세스를 대화형 모드로 강제로 실행하세요.

기본값을 사용할 수 있는 경우에도 구성 값을 묻는 프롬프트가 표시됩니다.

-k key-name

or

--keyname key-name

환경 인스턴스에 대한 RDP 액세스를 활성화하는 Amazon EC2 키 페어입니다.

로그에서 확인할 수 없는 인스턴스 수준 문제를 조사할 때 유용합니다.

유효한 값: Amazon EC2에 등록된 기존 키 페어 이름

-p platform-version

또는

--platform platform-version

환경에 사용할 Elastic Beanstalk 플랫폼 런타임입니다. 별도로 지정하지 않으면 호스트 Windows Server 버전에서 자동으로 감지됩니다.

예시: "64bit Windows Server 2016 v2.16.2 running IIS 10.0"

사용 가능한 플랫폼 버전 목록을 보려면 eb platform list를 사용하세요.

--remote

마이그레이션을 원격 모드로 실행하도록 지정합니다. 이 옵션을 사용하면 배스천 호스트에서 실행할 수 있으며, 해당 호스트는 애플리케이션 및 Elastic Beanstalk으로 마이그레이션할 구성 요소가 포함된 대상 서버에 연결됩니다. eb migrate는 배스천 서버에서 실행되며, 구성을 탐지하고 마이그레이션 로직을 배스천 호스트에 준비한 후, 애플리케이션을 새로운 Elastic Beanstalk 환경에 배포합니다.

이 옵션을 사용하면 마이그레이션할 Windows 서버에 EB CLI와 Python을 설치할 필요가 없습니다. 대신 배스천 호스트에 Python과 EB CLI를 설치한 후, 이 호스트에서 --remote 옵션과 함께 eb migrate을 실행하세요. 마이그레이션할 IIS 구성이 포함된 호스트를 지정하려면 --target-ip 옵션을 사용하세요.

--target-ip, --username--password와 함께 사용해야 합니다.

--target-ip ip-address

마이그레이션 대상인 IIS 서버가 포함된 원격 Windows 시스템의 퍼블릭 IP 주소입니다.

--remote를 읽을 때 필요합니다. --remote을 사용하는 경우에만 지정할 수 있습니다.

--username 사용자 이름

마이그레이션 대상인 IIS 서버가 포함된 원격 Windows 시스템에 액세스하기 위한 사용자 프로파일의 사용자 이름입니다.

--remote를 읽을 때 필요합니다. --remote을 사용하는 경우에만 지정할 수 있습니다.

--password 암호

마이그레이션 대상인 IIS 서버가 포함된 원격 Windows 시스템에 액세스하기 위한 사용자 프로파일의 암호입니다.

--remote를 읽을 때 필요합니다. --remote을 사용하는 경우에만 지정할 수 있습니다.

-sr role-name

or

--service-role role-name

Elastic Beanstalk이 관련 AWS 서비스를 관리할 수 있도록 하는 IAM 서비스 역할입니다.

지정하지 않으면 필요한 권한이 포함된 기본 서비스 역할을 생성합니다. 자세한 내용은 Elastic Beanstalk 서비스 역할 섹션을 참조하세요.

참고

전체 ARN이 아닌 역할 이름만 지정하세요. Elastic Beanstalk은 전체 ARN을 자동으로 생성합니다.

-s site-names

or

--sites site-names

마이그레이션할 IIS 사이트의 쉼표로 구분된 목록입니다. 지정하지 않으면 서버에 있는 모든 사용 가능한 사이트를 마이그레이션합니다.

예시: --sites "Default Web Site,Intranet,API"

--ssl-certificates certificate-arn[,certificate-arn ...]

Application Load Balancer에 연결할 ACM SSL 인증서 ARNs의 쉼표로 구분된 목록입니다.

HTTPS 바인딩으로 사이트를 마이그레이션할 때 필수 항목입니다.

예시: --ssl-certificates arn:aws:acm:region:account:certificate/certificate-id

-t key1=value1[,key2=value2 ...]

or

--tags key1=value1[,key2=value2 ...]

환경의 새 리소스(환경, Elastic Beanstalk 애플리케이션, 애플리케이션 버전)에 태그를 지정하기 위한 key=value 페어의 쉼표로 구분된 목록입니다.

자세한 내용은 환경에 태그 지정 섹션을 참조하세요.

--verbose

마이그레이션 과정에서 상세 정보를 표시합니다.

explore 하위 명령과 함께 사용할 경우, 사이트 구성에 대한 종합 정보를 표시합니다.

-vpc config-file-or-string

or

--vpc-config config-file-or-string

환경의 VPC 구성. JSON 파일 경로나 JSON 문자열로 지정합니다.

구성에는 다음 항목이 포함되어야 합니다.

{ "id": "vpc-1234567890abcdef0", "publicip": "true|false", "elbscheme": "public|private", "ec2subnets": ["subnet-a1b2c3d4", "subnet-e5f6g7h8"], "securitygroups": "sg-123456,sg-789012", "elbsubnets": ["subnet-a1b2c3d4", "subnet-e5f6g7h8"] }
  • id: (필수) VPC 식별자

  • publicip: 인스턴스에 퍼블릭 IP를 할당할지 여부

  • elbscheme: 로드 밸런서 체계(퍼블릭 또는 프라이빗)

  • ec2subnets: EC2 인스턴스용 서브넷 ID 목록

  • securitygroups: 쉼표로 구분된 보안 그룹 ID

  • elbsubnets: 로드 밸런서의 서브넷의 ID 목록

중요

--vpc-config 파라미터를 지정하면, 마이그레이션 시 소스 환경의 기존 VPC 설정은 무시됩니다. 이 파라미터를 사용하면 마이그레이션은 전달되는 구성 파일에 지정된 VPC 설정만 사용합니다. 이 파라미터를 사용하면 기본 동작(소스 인스턴스의 VPC 구성을 자동으로 탐색하거나 기본 VPC를 사용하는 동작)이 재정의됩니다.

일반 옵션

출력

이 명령은 마이그레이션 과정 전반에 걸쳐 상태 업데이트를 제공합니다.

  1. VPC 구성 감지(EC2 인스턴스에서 실행되는 경우)

  2. 각 사이트에 대한 소스 번들 생성 진행 상황

  3. 환경 생성 상태

  4. 배포 진행 중

성공할 경우, 새 환경의 세부 정보가 표시됩니다.

  • 환경 이름 및 ID

  • 애플리케이션 이름

  • 리전

  • 플랫폼 버전

  • 환경 CNAME

마이그레이션 중 문제가 발생하면 eb eventseb health 명령을 사용해 상세 정보를 확인하세요.

예시

기본 사용법

대화형 모드에서의 기본 마이그레이션:

PS C:\migrations_workspace > eb migrate Identifying VPC configuration of this EC2 instance (i-0123456789abcdef0): id: vpc-1234567890abcdef0 publicip: true elbscheme: public ec2subnets: subnet-123,subnet-456,subnet-789 securitygroups: sg-123,sg-456 elbsubnets: subnet-123,subnet-456,subnet-789 Using .\migrations\latest to contain artifacts for this migration run. Generating source bundle for sites, applications, and virtual directories... Default Web Site/ -> .\migrations\latest\upload_target\DefaultWebSite.zip Creating application version Creating environment Environment details for: EBMigratedEnv Application name: EBMigratedApp Region: us-west-2 Deployed Version: app-230320_153045 Environment ID: e-abcdef1234 Platform: 64bit Windows Server 2019 v2.7.0 running IIS 10.0 Tier: WebServer-Standard-1.0 CNAME: ebmigratedenv.us-west-2.elasticbeanstalk.com Updated: 2023-03-20 15:30:45

사용자 지정 구성을 포함한 특정 사이트 마이그레이션:

PS C:\migrations_workspace > eb migrate ` --sites "Default Web Site,InternalAPI" ` --application-name "CorporateApp" ` --environment-name "Production" ` --instance-type "c5.xlarge" ` --tags "Environment=Production,Team=WebOps" ` --copy-firewall-config

배포 없이 마이그레이션 아카이브 생성:

PS C:\migrations_workspace > eb migrate --archive-only Using .\migrations\latest to contain artifacts for this migration run. Generating source bundle for sites, applications, and virtual directories... Default Web Site/ -> .\migrations\latest\upload_target\DefaultWebSite.zip Generated destination archive directory at .\migrations\latest\upload_target You can execute `eb init` and `eb create` from this directory to deploy to EB.

고급 구성 예제

JSON 파일을 사용한 사용자 지정 VPC 구성으로 마이그레이션:

PS C:\migrations_workspace > cat vpc-config.json { "id": "vpc-1234567890abcdef0", "publicip": "false", "elbscheme": "internal", "ec2subnets": [ "subnet-private1", "subnet-private2" ], "securitygroups": [ "sg-app", "sg-database", "sg-monitoring" ], "elbsubnets": [ "subnet-private1", "subnet-private2" ] } PS C:\migrations_workspace eb migrate ` --sites "InternalAPI" ` --vpc-config vpc-config.json ` --instance-type "r5.xlarge" ` --tags "Environment=Internal,Security=High"

SSL 인증서 및 호스트 헤더를 사용하는 사이트 마이그레이션:

PS C:\migrations_workspace > eb migrate ` --sites "SecurePortal" ` --ssl-certificates "arn:aws:acm:region:account:certificate/cert1,arn:aws:acm:region:account:certificate/cert2" ` --verbose INFO: Detected HTTPS bindings: - www.example.com:443 - api.example.com:443 INFO: Configuring Application Load Balancer with SSL certificates INFO: Creating host-based routing rules: - www.example.com -> target group 1 - api.example.com -> target group 2

EBS 스냅샷 구성을 포함한 마이그레이션:fo

PS C:\migrations_workspace > eb migrate ` --sites "Default Web Site" ` --ebs-snapshots "snap-1234567890abcdef0" "snap-0987654321fedcba1" ` --encrypt-ebs-volumes Using .\migrations\latest to contain artifacts for this migration run. INFO: Enabling EBS encryption for all new volumes in us-west-2 INFO: Configuring environment with specified EBS snapshots

보안 구성 예제

복잡한 방화벽 규칙이 있는 사이트 처리:

PS C:\migrations_workspace > eb migrate ` --sites "Default Web Site,ReportingService" ` --copy-firewall-config ` --verbose INFO: Detected the following Windows Firewall rules: - Allow Web Traffic (TCP 80, 443) - Allow Reporting Traffic (TCP 8081) INFO: Creating corresponding security group rules

사용자 지정 IAM 역할을 사용하는 마이그레이션:

PS C:\migrations_workspace > eb migrate ` --sites "SecureApp" ` --instance-profile "CustomInstanceProfile" ` --service-role "CustomServiceRole"

원격 실행 예제

원격 Windows 서버에서 IIS 애플리케이션 마이그레이션:

PS C:\migrations_workspace > eb migrate ` --remote ` --target-ip "192.0.2.10" ` --username "administrator" ` --password "YourPassword123" ` --application-name "RemoteApp" ` --environment-name "RemoteEnv" INFO: Establishing SSH connection to remote host 192.0.2.10... INFO: Connection established INFO: Discovering IIS sites on remote host... INFO: Found 2 sites: Default Web Site, API INFO: Extracting site configurations... INFO: Generating source bundle for sites, applications, and virtual directories... Default Web Site/ -> .\migrations\latest\upload_target\DefaultWebSite.zip API/ -> .\migrations\latest\upload_target\API.zip Creating application version Creating environment Environment details for: RemoteEnv Application name: RemoteAppstage mi Region: us-west-2 Deployed Version: app-230320_153045 Environment ID: e-abcdef1234 Platform: 64bit Windows Server 2019 v2.7.0 running IIS 10.0 Tier: WebServer-Standard-1.0 CNAME: remoteenv.us-west-2.elasticbeanstalk.com Updated: 2023-03-20 15:30:45

특정 사이트를 선택한 원격 마이그레이션:

PS C:\migrations_workspace > eb migrate ` --remote ` --target-ip "192.0.2.10" ` --username "administrator" ` --password "YourPassword123" ` --sites "API" ` --instance-type "c5.large"