2017-12-07 14 views
2

우리 응용 프로그램을 실행할 사용자 지정 플랫폼을 구축하고 있습니다. 우리는 기본 VPC를 삭제했습니다. 따라서 문서에 따르면 거의 모든 곳의 VPC와 서브넷 ID를 지정해야합니다. 그래서 EBP에 대한 실행 명령은 다음과 같습니다 :기본 VPC가없는 사용자 지정 플랫폼

ebp create -v --vpc.id vpc-xxxxxxx --vpc.subnets subnet-xxxxxx --vpc.publicip{code} 

을 포장 나는 다음과 같은 오류 받고 있어요 인스턴스를 구축하기 시작하지만 때 위의 모든 문제없이 pcakcer 환경을 회전 :

2017-12-07 18:07:05 UTC+0100 ERROR [Instance: i-00f376be9fc2fea34] Command failed on instance. Return code: 1 Output: 'packer build' failed, the build log has been saved to '/var/log/packer-builder/XXX1.0.19-builder.log'. Hook /opt/elasticbeanstalk/hooks/packerbuild/build.rb failed. For more detail, check /var/log/eb-activity.log using console or EB CLI. 
2017-12-07 18:06:55 UTC+0100 ERROR 'packer build' failed, the build log has been saved to '/var/log/packer-builder/XXX:1.0.19-builder.log' 
2017-12-07 18:06:55 UTC+0100 ERROR Packer failed with error: '--> HVM AMI builder: VPCIdNotSpecified: No default VPC for this user status code: 400, request id: 28d94e8c-e24d-440f-9c64-88826e042e9d'{code} 

템플릿과 platform.yaml은 모두 vpc_id와 서브넷 ID를 지정하지만 패커가 고려하지 않습니다. platform.yaml :

version: "1.0" 

provisioner: 
    type: packer 
    template: tomcat_platform.json 
    flavor: ubuntu1604 

metadata: 
    maintainer: <Enter your contact details here> 
    description: Ubuntu running Tomcat 
    operating_system_name: Ubuntu Server 
    operating_system_version: 16.04 LTS 
    programming_language_name: Java 
    programming_language_version: 8 
    framework_name: Tomcat 
    framework_version: 7 
    app_server_name: "none" 
    app_server_version: "none" 

option_definitions: 
    - namespace: "aws:elasticbeanstalk:container:custom:application" 
    option_name: "TOMCAT_START" 
    description: "Default application startup command" 
    default_value: "" 

option_settings: 
    - namespace: "aws:ec2:vpc" 
    option_name: "VPCId" 
    value: "vpc-xxxxxxx" 
    - namespace: "aws:ec2:vpc" 
    option_name: "Subnets" 
    value: "subnet-xxxxxxx" 
    - namespace: "aws:elb:listener:80" 
    option_name: "InstancePort" 
    value: "8080" 
    - namespace: "aws:elasticbeanstalk:application" 
    option_name: "Application Healthcheck URL" 
    value: "TCP:8080" 

tomcat_platform.json :

{ 
    "variables": { 
    "platform_name": "{{env `AWS_EB_PLATFORM_NAME`}}", 
    "platform_version": "{{env `AWS_EB_PLATFORM_VERSION`}}", 
    "platform_arn": "{{env `AWS_EB_PLATFORM_ARN`}}" 

    }, 
    "builders": [ 
    { 
     "type": "amazon-ebs", 
     "region": "eu-west-1", 
     "source_ami": "ami-8fd760f6", 
     "instance_type": "t2.micro", 
     "ami_virtualization_type": "hvm", 
     "ssh_username": "admin", 
     "ami_name": "Tomcat running on Ubuntu Server 16.04 LTS (built on {{isotime \"20060102150405\"}})", 
     "ami_description": "Tomcat running on Ubuntu Server 16.04 LTS (built on {{isotime \"20060102150405\"}})", 
     "vpc_id": "vpc-xxxxxx", 
     "subnet_id": "subnet-xxxxxx", 
     "associate_public_ip_address": "true", 
     "tags": { 
     "eb_platform_name": "{{user `platform_name`}}", 
     "eb_platform_version": "{{user `platform_version`}}", 
     "eb_platform_arn": "{{user `platform_arn`}}" 
     } 
    } 
    ], 
    "provisioners": [ 
    { 
     "type": "file", 
     "source": "builder", 
     "destination": "/tmp/" 
    }, 
    { 
     "type": "shell", 
     "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo {{ .Path  }}", 
     "scripts": [ 
     "builder/builder.sh" 
     ] 
    } 
    ] 
} 

예상대로이 작업을하는 방법에 대한 아이디어를 주셔서 감사합니다. Packer와 관련된 몇 가지 문제점을 발견했지만 문서에서 대상 VPC와 서브넷을 지정해야한다는 내용의 문서가 있으므로 문제가 해결 될 것 같습니다.

답변

0

AWS 문서는이 인스턴스에서 약간 오해의 소지가 있습니다. 사용자 정의 플랫폼을 생성하려면 기본 VPC가 필요합니다. 필자가 보았던 것은 ebp create 명령에 전달하는 VPC 플래그가 실제로 플랫폼을 빌드하는 패커 프로세스로 전달되지 않기 때문입니다.

오류를 방지하려면 사용자 정의 플랫폼 작성에 사용하는 새 기본 VPC를 만들면됩니다.