Reputation: 1065
Elastic beanstalk is used to deploy a docker container in a ec2 instance. Hence the ec2 instance is controlled by elastic beanstalk.
Using the .ebextensions settings I can change the file /var/lib/update-motd/motd in my ec2 instance.
Using:
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
But every day this gets wiped away and the EB deafault message is there! How can I make sure my custom motd stays there??
Upvotes: 2
Views: 375
Reputation: 14237
https://blog.eq8.eu/til/elasticbeanstalk-update-ssh-welcome-message-motd.html
create file .ebextensions/91_update_motd_welcome_message_after_ssh.config
add content
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
this will add extra message after the ElasticBeanstalk msg
if you want to override the original message change the file name from 20-custom-welcome-message
to 10eb-banner
Upvotes: 0
Reputation: 81
I think one way to make this motd persistent is to have something in motd then remote the package update-motd.
create file .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"
Upvotes: 0