5

Since I started using AWS ECS I have followed the AWS ECS reference architecture. This reference architecture uses Amazon Linux, and I would like to update to Amazon Linux 2, but I'm not sure what I'm required to do in order to make this transition successfully.

There is an issue on the GitHub repo for this reference architecture but it has not received any attention in months despite several people asking for help. From what I understand, here are some issues that need to be addressed when using the Amazon Linux 2 ECS optimized AMI:

  • sysvinit is no longer supported on Amazon Linux 2; systemd should be used instead.
  • Amazon Linux 2 stores docker logs in journald which is not currently supported by Cloud (described here)

I have an open source project that I am using to learn CloudFormation and AWS; here's a link to the ecs-cluster.yaml file that describes the ECS cluster and container instance that I am trying to update.

I have heard that some people are using Amazon Linux 2 with ECS and I would like to update as well since support for Amazon Linux (1) ends in about 6 months. Does anyone know what other considerations I would need to make in order to use Amazon Linux 2 with ECS? Debugging this issue is time consuming and I'm not sure what options and configurations I should be trying.

briancaffey
  • 2,339
  • 6
  • 34
  • 62
  • Should be pretty simple changes. Here is a reference template using Linux2 AMI -- https://github.com/widdix/aws-cf-templates/blob/master/ecs/cluster.yaml – spinkus Jan 02 '20 at 07:15
  • Thank you for the resource @spinkus. I noticed that this template uses `sysvinit`, but I thought that wasn't compatible with Amazon Linux 2 AMIs [https://cloudonaut.io/migrating-to-amazon-linux-2/](https://cloudonaut.io/migrating-to-amazon-linux-2/). I can still give this a try, however. – briancaffey Jan 02 '20 at 17:20
  • There is a compatability layer on most distros including AWS Linux 2 for sysv init scripts. – spinkus Jan 04 '20 at 00:28
  • @briancaffey have you tried using [commands](https://acloud.guru/forums/aws-advanced-cloudformation/discussion/-Kpm2dXiivAKYnqWDGwQ/Cfn%20Init%20and%20linux%20systemd%3F) section for resolving `systemd` ?. – Imran Jan 05 '20 at 00:39
  • Hi @Imran, I haven't tried this but I imagine that it is something that I would need to do. – briancaffey Jan 05 '20 at 18:36
  • You can use something like https://advantageous.github.io/systemd-cloud-watch/ to send journald logs to CloudWatch Logs. – madeddie Jan 09 '20 at 04:04
  • I wonder if there is a solution for this yet. I'm still stuck with amazon linux 1. When I upgrade to the AMI for amazon linux 2, I get a Cloudformation update error, and rolls back. – Thomas Cheng Sep 19 '20 at 14:54

0 Answers0