node.js - Tag AWS beanstalk deployment using .config file in .ebextensions -


i added scripts.config file .ebextensions @ root of node app deployed in beanstalk.i did not see tags ec2 instances in console. nor did see mention of 1_add_tags in beanstalk logs. did wrong , how find out if commands in script.config called @ all!

the config file in .ebextensions follows ....

01_add_tags:

command: ec2-create-tags $(ec2-metadata -i | cut -d ' ' -f2) --tag environment=production --tag name=proxy-server --tag application=something 

env:

ec2_home: /opt/aws/apitools/ec2 ec2_url: https://ec2.ap-southeast-2.ama... java_home: /usr/lib/jvm/jre path: /bin:/usr/bin:/opt/aws/bin/ 

cheers,

prabin

amazon's answer problem. (this worked me) ...

you can utilise ebextensions execute commands on instance boot. supposing want implement on linux based containers. have formulated sample config file , attached case.

please follow below guidelines :

  1. in aws management console, check iam role/instance profile used beanstalk. default uses "aws-elasticbeanstalk-ec2-role". add permissions role create new tags (ec2:createtags).
  2. if not have ".ebextensions" folder @ root of application or "web-inf" folder, create folder.
  3. modify key value pairs in config file. multiple pairs separated space.

a sample snippet below:

   {         "container_commands": {             "01_add_tags": {                 "command": "aws ec2 create-tags --resources $(get http://169.254.169.254/latest/meta-data/instance-id) --tags key=clientname,value=testclient key=newtag,value=new-value --region us-east-1"             }         }     } 
  1. add modified config file in ".ebextensions" folder.
  2. upload version beanstalk. should launch new instances , execute config file.
  3. please give sometime, preferably till instances pass ec2 instance status checks. refresh page additional tags displayed.

please note using "container_commands" instead of "command" used in blog. container commands run after application , web server have been set , application version file has been extracted, before application version deployed. important these commands have access environment variables such aws security credentials set instance-profile.

i recommend go through restrictions aws resources tagging mentioned @ http://docs.aws.amazon.com/awsec2/latest/userguide/using_tags.html#tag-restrictions highlight maximum number of tags per resource 10.

also check table tagging support resource. example, tagging not supported elb.


Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -