2

Is there any official way or 'the right way' to convert one of the platforms returned by eb platform list to the latest version of the eb solution stacks listed by aws elasticbeanstalk list-available-solution-stacks --query 'SolutionStacks'

user319862
  • 1,797
  • 2
  • 24
  • 32

1 Answers1

5

eb platform list is going to give you a list of platform "families." Essentially, they are modified names of platforms which have different versions. You probably can't use them "as-is" outside of the EB CLI but you can use them as a heuristic for querying the platform versions from the AWS CLI.

You can use the names from eb platform list as query filter for list-platform-versions. So, lets say you're looking for the latest Java 8 platform.

aws elasticbeanstalk list-platform-versions --filters='[{"Type":"PlatformName","Operator":"begins_with","Values":["Java 8"]},{"Type":"PlatformVersion","Operator":"=","Values":["latest"]}]'

That will return one item which you can pluck the ARN and use that as an input into describe-platform-version.

aws elasticbeanstalk describe-platform-version --platform-arn 'arn:aws:elasticbeanstalk:us-east-1::platform/Java 8 running on 64bit Amazon Linux/2.5.5'

That response should have the solution stack name for the latest platform.

Tim Christensen
  • 371
  • 2
  • 10
  • can you modify your answer for scripted input? i.e. somewhere set `PLATFORM='multi-container-docker-17.03.2-ce-(generic)'` and process it to the input array you need so that it returns the latest solution stack string? – user319862 Sep 29 '17 at 21:52
  • really just the appropriate filter part. getting the ARN is sufficient – user319862 Sep 29 '17 at 21:54
  • You're gonna have some difficulty converting the string `"multi-container-docker-17.03.2-ce-(generic)"` into "Multi-container Docker". The way the EBCLI represents it's platform inputs is meant for command line input. So it does a transform on the platform name to make it "dasherized". You can't really use that directly with the Elastic Beanstalk service because it doesn't support fuzzy matching as far as I can tell. – Tim Christensen Oct 02 '17 at 17:01
  • 1
    I think you're going to be better off not using `eb platform list`. Instead, use `aws elasticbeanstalk list-platform-versions --filters='[{"Type":"PlatformVersion","Operator":"=","Values":["latest"]}]'`. That is going to be 'the right way.' – Tim Christensen Oct 02 '17 at 17:03
  • Wish there were more up buttons for this answer. Thanks so much! I put the two steps together into https://gist.github.com/matschaffer/36977dd7ee07d514934fcbb95b25589f and now I never have to worry about finding the right latest stack solution name again! – Mat Schaffer Feb 07 '19 at 03:39