AWS EB .ebextensions - Contains invalid key

4.2k views Asked by At

I have the following config file:

packages:
  yum:
    at: []

01_remove_old_cron_jobs:
  command: "sudo cp enable_mod_pagespeed.conf /etc/httpd/conf.d"
02_remove_old_cron_jobs:
  command: "sudo rpm -U -iv --replacepkgs mod-pagespeed.rpm"
03_remove_old_cron_jobs:
  command: "sudo touch /var/cache/mod_pagespeed/cache.flush"

Labeled 01.config. When I deploy this to my server, I get an error such as:

Error processing file (Skipping): '.ebextensions/01.config' - Contains invalid key: '02_remove_old_cron_jobs'. For information about valid keys, see http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions.html

However, the documentation contains no information about valid keys, and this key looks similar to my other keys.

2

There are 2 answers

0
Jundiaius On

The configuration files keys are specified in this page: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html

Configuration files support the following keys that affect the Linux server your application runs on.

Keys:

  • Packages
  • Groups
  • Users
  • Sources
  • Files
  • Commands
  • Services
  • Container Commands

Keys are processed in the order that they are listed above.

So, in your case, you have to write your commands inside a commands key. Your file will look like that:

commands:
  01_remove_old_cron_jobs:
    command: "sudo cp enable_mod_pagespeed.conf /etc/httpd/conf.d"
  02_remove_old_cron_jobs:
    command: "sudo rpm -U -iv --replacepkgs mod-pagespeed.rpm"
  03_remove_old_cron_jobs:
    command: "sudo touch /var/cache/mod_pagespeed/cache.flush"

The complete syntax for commands you can find here: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#linux-commands

1
alex On

you config file is not formatted correctly:

packages:

yum:

at: []

commands: <----- MISSING HERE -------------------------------------------X

01_remove_old_cron_jobs:

command: "sudo cp enable_mod_pagespeed.conf /etc/httpd/conf.d"

02_remove_old_cron_jobs:

command: "sudo rpm -U -iv --replacepkgs mod-pagespeed.rpm"

03_remove_old_cron_jobs:

command: "sudo touch /var/cache/mod_pagespeed/cache.flush"