在Cloud Formation Elastic Beanstalk模板中指定ECR映像而不是S3文件

时间:2016-10-06 00:57:02

标签: amazon-cloudformation amazon-elastic-beanstalk amazon-ecs

我想在我的Cloud Formation模板的Elastic Beanstalk部分中引用EC2 Container Registry图像。示例文件引用源包的S3存储桶:

"applicationVersion": {
  "Type": "AWS::ElasticBeanstalk::ApplicationVersion",
  "Properties": {
    "ApplicationName": { "Ref": "application" },
    "SourceBundle": {
      "S3Bucket": { "Fn::Join": [ "-", [ "elasticbeanstalk-samples", { "Ref": "AWS::Region" } ] ] },
      "S3Key": "php-sample.zip"
    }
  }
}

有没有办法引用EC2 Container Registry图像?类似于EC2 Container Service TaskDefinition中可用的内容?

1 个答案:

答案 0 :(得分:1)

将Dockerrun文件上传到S3以执行此操作。这是dockerrun的一个例子:

{
  "AWSEBDockerrunVersion": "1",
  "Authentication": {
    "Bucket": "my-bucket",
    "Key": "mydockercfg"
  },
  "Image": {
    "Name": "quay.io/johndoe/private-image",
    "Update": "true"
  },
  "Ports": [
    {
      "ContainerPort": "8080:80"
    }
  ],
  "Volumes": [
    {
      "HostDirectory": "/var/app/mydb",
      "ContainerDirectory": "/etc/mysql"
    }
  ],
  "Logging": "/var/log/nginx"
}

将此文件用作s3键。有关详细信息here.