amazon beanstalk ec2 instance current git sha
amazon-elastic-beanstalk, amazon-web-services, git
Solution
You can confirm version label (aka git commit) with AWS Elastic Beanstalk API Command Line Interface:
$ elastic-beanstalk-describe-applications
ApplicationName | ConfigurationTemplates | DateCreated | DateUpdated | Description | Versions
---------------------------------------------------------------------------------------------
angrywhopper | | 2013-12-05 10:44:21 -0800 | 2013-12-05 10:44:21 -0800 | N/A | git-c069d943a152871a3a43898ce19ea20295b1307d-1386466726575
It should match your local commit:
$ git rev-parse HEAD
c069d943a152871a3a43898ce19ea20295b1307d
Also, look for archive operation in the log:
2013-12-08 03:51:31,830 [INFO] (10377 MainThread) [directoryHooksExecutor.py-29] [root directoryHooksExecutor info] Output from script: Archive: /opt/elasticbeanstalk/deploy/appsource/source_bundle
c069d943a152871a3a43898ce19ea20295b1307d
creating: /opt/python/ondeck/app/.ebextensions/
...
Problem
How can I get current git sha of the commit that was `git aws.push` ? My container_commands need to download a file on a server that has that head git sha as the file name so I need a way to determine it. I've been browsing around `/opt/elasticbanstalk/` and found file `/opt/elasticbeanstalk/deploy/configuration/appsourceurl` which contains ``` "url": "https://elasticbeanstalk-us-west-43434324.s3.amazonaws.com/resources%2Fenvironments%2Dg-fea2ffeaf5%2F_runtime%2F_versions%2Fbb-test-eb%2Fgit-6cb3416a7a5a84ce864dd0213236984age4b0b9-2678564154681?Expires=1417813357&AWSAccessKeyId=-----&Signature=-----" ``` I could parse this and extract the git-sha the problem this git sha is different from my git head sha on local that I just git aws.pushed! Why?