Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Add Amazon SSM manager to the EC2 images #365

Merged

Conversation

samm-git
Copy link
Contributor

@samm-git samm-git commented May 16, 2020

Add AWS SSM manager

AWS Systems Manager Agent (SSM Agent) is Amazon software that can be installed and configured on an EC2 instance, an on-premises server, or a virtual machine (VM). SSM Agent makes it possible for Systems Manager to update, manage, and configure these resources. The agent processes requests from the Systems Manager service in the AWS Cloud, and then runs them as specified in the request.

SSM Agent is preinstalled, by default, on the following Amazon Machine Images (AMIs):

  • Amazon Linux
  • Amazon Linux 2
  • Ubuntu Server 16.04
  • Ubuntu Server 18.04 Amazon ECS-Optimized

Also for the RPM and DEB based systems Amazon provides binary packages. Flatcar Linux does not have support for it [yet], so it is required to use 3rd party script for the integration via userdata

See flatcar/Flatcar#107 for the request

How to use

Target state (not here yet)

  • Package for the amazon-ssm-agent added to the coreos-overlay.
  • Dependency added to the AWS EC2 package
  • Integration with ignition/systemd
  • Testing EC2 AMI with the agent built and enabled

Testing done

  • Ebuild tested with a recent Flatcar SDK
  • Test package on the live coreos installation
  • Build EC2 AMI and test on it

@samm-git
Copy link
Contributor Author

@dongsupark would be great if you can suggest how to integrate it with systemd. My understanding was to create systemd file from ignition, as i cant (?) put one from the oem package out of the oem dir.

@pothos
Copy link
Contributor

pothos commented May 18, 2020

Thanks for your work on it. I'm not sure about the build commands… and if we want to include this tool in the current way of vendor tool distribution.
But to answer your question, the service would need to be set up in coreos-base/oem-ec2-compat/files/base/base-ec2.ign.
Edit: See for example coreos-base/oem-azure/files/base/base.ign and coreos-base/oem-azure/files/units/waagent.service.

@samm-git
Copy link
Contributor Author

@pothos thank you for feedback. Build commands are +- replicating what makefile is doing. I will work on ignition config, thank you for the hint.

@samm-git samm-git changed the title WIP: Add Amazon SSM manager to the EC2 images Add Amazon SSM manager to the EC2 images May 19, 2020
@samm-git
Copy link
Contributor Author

@pothos @dongsupark i think patch is ready to land - i added ignition/systemd support and did some minor cleanup/comments. Would be nice to see it merged, happy to answer any questions.

samm-git added a commit to samm-git/scripts that referenced this pull request May 19, 2020
@samm-git
Copy link
Contributor Author

@dongsupark now it fits to 128Mb, tested with ./image_to_vm.sh --format ami

Copy link
Contributor

@dongsupark dongsupark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general it looks good.
Before getting merged, the commits should be somehow squashed.

Anyway I will let @sayanchowdhury have a look. He will decide when to merge it.

@samm-git
Copy link
Contributor Author

@dongsupark thank you for review. squash is done, let me know if anything else needed.

@samm-git
Copy link
Contributor Author

@dongsupark one thing in my mind - by design this tool creates new uid called ssm-user and grants sudo to it. But we already do have core user for +- the same. I think that may be we should replace default user from ssm-user to the core to make it more aligned. What do you think about it?

- Add Dependency 
- Add ignition configuration to create systemd units and SSM config
@samm-git
Copy link
Contributor Author

@dongsupark i updated agent to the latest (2.3.1319.0) version and rebased it. Would be great to see if merged eventually

@sayanchowdhury sayanchowdhury merged commit 95327fc into flatcar-archive:flatcar-master-alpha Jul 13, 2020
@sayanchowdhury
Copy link
Contributor

Thanks @samm-git

@dongsupark
Copy link
Contributor

@sayanchowdhury You would probably want to cherry-pick it to edge.

@samm-git
Copy link
Contributor Author

Yeah, thank you!

@samm-git samm-git deleted the flatcar-ssm branch July 14, 2020 13:38
@samm-git samm-git restored the flatcar-ssm branch July 14, 2020 13:38
@samm-git samm-git deleted the flatcar-ssm branch July 14, 2020 13:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants