Amazon ec2 如何覆盖AWS弹性豆茎默认值;“今日讯息”;

Amazon ec2 如何覆盖AWS弹性豆茎默认值;“今日讯息”;,amazon-ec2,amazon-elastic-beanstalk,Amazon Ec2,Amazon Elastic Beanstalk,弹性beanstalk用于在ec2实例中部署docker容器。因此,ec2实例由elastic beanstalk控制 使用.ebextensions设置,我可以更改ec2实例中的文件/var/lib/update motd/motd 使用: files: /var/lib/update-motd/motd: content: | The Custom Message # Menu >

弹性beanstalk用于在ec2实例中部署docker容器。因此,ec2实例由elastic beanstalk控制

使用.ebextensions设置,我可以更改ec2实例中的文件/var/lib/update motd/motd

使用:

files: 
      /var/lib/update-motd/motd: 
        content: |

            The Custom Message
            # Menu
            > app   [open docker info]
            > logs  [Print logs from Rails app]

        group: root
        mode: "000644"
        owner: root
但每天这一切都会被抹去,错误的信息就在那里!
如何确保我的自定义motd保持不变???

我认为使此motd持久化的一种方法是在motd中有一些内容,然后远程更新motd包。
创建文件.ebextension/000update-motd.config

files:
  "/home/ec2-user/updatemotd.sh" :
    mode: "000777"
    owner: root
    group: root
    content: |
      #!/bin/bash
      yum erase -y update-motd ; unlink /etc/motd
      yum install -y figlet 
      echo `{"Ref": "AWSEBEnvironmentName" }` | figlet -f standard > /etc/motd

commands:
  updatemotd:
    command: "/home/ec2-user/updatemotd.sh"

在ssh.config之后创建文件
.ebextensions/91\u更新\u motd\u欢迎消息\u

添加内容

files:
  "/tmp/20-custom-welcome-message":
    mode: "000755"
    owner: root
    group: root
    content: |
      cat << EOF
      THIS WILL BE YOUR WELCOME MESSAGE
      EOF

commands:
  80_tell_instance_to_regenerate_motd:
    command: mv /tmp/20-custom-welcome-message /etc/update-motd.d/20-custom-welcome-message

  99_tell_instance_to_regenerate_motd:
    command: /usr/sbin/update-motd
文件:
“/tmp/20自定义欢迎信息”:
模式:“000755”
所有者:root
组:根
内容:|

cat是您应该覆盖的文件吗?对我来说,目录名意味着子系统可能会覆盖此内容。谢谢@Michael sqlbot,您的回答让我在/etc/update-motd.d/中找到了10eb横幅,现在我的设置仍然保留,因为我正在更改它,而不是/etcThanks中的motd,以获取您的答案。我发现源文件位于:/etc/update motd.d/。通过直接更改它们,motd更改得以持久化。