Creation of .ebextensions folder in aws elastic beanstalk

后端 未结 2 611
说谎
说谎 2021-01-04 09:48

I am trying to deploy a shellscript script to install a program when autoscaling triggers on aws elastic beanstalk.

I have searched on google and it all points to th

2条回答
  •  孤独总比滥情好
    2021-01-04 10:01

    You need to do the following (obviously catering for your requirements):

    In the root on your packaged software create a folder called .ebextensions

    drwxr-xr-x 4 root root     4096 Sep 30 13:39 .
    dr-xr-x--- 7 root root     4096 Nov  4 15:22 ..
    drwxr-xr-x 2 root root     4096 Nov  4 15:22 .ebextensions
    

    In the .ebextensions folder create two files called 02_files.config and 03_container_commands.config

    -rw-r--r-- 1 root root 11334 Jul 25 12:26 02_files.config
    -rw-r--r-- 1 root root   960 Nov  4 11:22 03_container_commands.config
    

    The contents of 02_files.config should contain the contents of your shell script:

    files:
    
      "/path/to/your/shellscript/myscript.sh" :
        mode: "000755"
        owner: root
        group: root
        content: |
          #!/bin/sh
          echo "Hello World!" >> /var/log/myscript.out
    

    The contents of 03_container_commands.config should contain the command to run your shell script:

    container_commands:
    
      01_runmyshellscript:
        command: "/path/to/your/shellscript/myscript.sh"
    

    Now when you upload your code it will create your shell script in /path/to/your/shellscript/myscript.sh and then execute it sending Hello World! to /var/log/myscript.out

提交回复
热议问题