2

I want to create a Cloudformation template for launching an Elastic Beanstalk application based on the Docker platform. I managed to make manually the setup, which includes uploading the Dockerrun.aws.json.

From what I've seen, this file can be specified as the SourceBundle as a reference to a an S3 object. However, I cannot find a way to put the content of the Dockerrun.aws.json file as part to the template.

I've seen examples for EC2 deployments, on which the content of configuration files can be part of the template.

pablochacin
  • 200
  • 1
  • 2
  • 7

1 Answers1

1

As an alternative to using the AWS Elastic Beanstalk tasks built into Tasks for AWS, it is also possible to provision the Elastic Beanstalk components directly via the AWS CloudFormation Stack task and the corresponding CloudFormation resource types:

AWS::ElasticBeanstalk::Application

AWS::ElasticBeanstalk::ApplicationVersion

AWS::ElasticBeanstalk::Environment

In your case, check the ApplicationVersion object where it is described how to manage the Dockerrun.aws.json file using CloudFormation.

Example:

"myAppVersion" :{ 
  "Type" : "AWS::ElasticBeanstalk::ApplicationVersion",
  "Properties" : {
    "ApplicationName" : {"Ref" : "myAppName"},
    "Description" : "ElasticBeanStalk_conf",
    "SourceBundle" : {
      "S3Bucket" : { "Fn::Join" :
        ["-", [ "elasticbeanstalk-conf", { "Ref" : "AWS::Region" } ] ] },
      "S3Key" : "Dockerrun.aws.json"
    } 
  }
}
Itai Ganot
  • 10,424
  • 27
  • 88
  • 143
  • Thanks but I was asking on ways to put the Dockerrun file inline into the cloud formation file (as can be done with for example the lambda function source code). – pablochacin Mar 21 '18 at 15:34
  • Ah sorry, I forgot to mention, this is the only way to provide the file, if you look in the ApplicationVersion link above you'll see the available directives this object provides and which directives these objects allow - SourceBundle from S3 is the only option. – Itai Ganot Mar 21 '18 at 15:38