Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify behavior of CloudWatchAgent agent installation #308

Closed
2 tasks
ddneilson opened this issue Feb 3, 2021 · 3 comments · Fixed by #338
Closed
2 tasks

Modify behavior of CloudWatchAgent agent installation #308

ddneilson opened this issue Feb 3, 2021 · 3 comments · Fixed by #338
Assignees
Labels
feature-request A feature should be added or improved.

Comments

@ddneilson
Copy link
Contributor

Many RFDK constructs use the CloudWatchAgent construct ( https://docs.aws.amazon.com/rfdk/api/latest/docs/aws-rfdk.CloudWatchAgent.html ) by default. This construct always ensures that the CloudWatchAgent is installed (either pre-installed, or by installing it itself), and will fail the UserData script if it cannot be installed.

I suggest a modification to the scripting to not always install the agent if it is not present.

Note: The instance initialization (ex: cloud-init) can be viewed in the EC2 console, or API, by querying the instance's syslog; on Linux, at least.

Use Case

The S3 method of installing the CloudWatchAgent requires that the host be able to reach the us-east-1 endpoints of S3, as that is where the bucket containing the agent is located. If deploying to any region other than us-east-1, this necessitates public internet access (tcp port 443) for any construct that uses the RFDK's CloudWatchAgent.

Using yum install on an Amazon Linux 2 instance only requires port 80 access to the regional S3 endpoints, which can be obtained, securely, through the use of a VPC Gateway Endpoint for S3 in the VPC.

For Windows, the current CloudWatchAgent construct also requires public internet access to fetch the gpg program. This makes it impossible to deploy an RFDK worker to an isolated subnet, as required by some security standards in the industry.

The current construct also make it impossible for a customer to use Linux distributions that do not support RPM.

Proposed Solution

I suggest a change of behavior to:

  1. Only try to install the agent on Amazon Linux 2 ( this will preserve functionality for the Repository ), but only do the install via yum (check for whether we're running on AL2 before trying to install); do not install the agent using the S3
  2. Do not fail the script if CloudWatchAgent is not present, or cannot be installed.
  3. Document, clearly, in the CloudWatchAgent construct and all RFDK constructs that use it, that customers should pre-install the CloudWatchAgent on their AMI, or use AL2 with access to regional S3 on port 80, if they want to enable log streaming functionality on their host(s).

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

@ddneilson ddneilson added needs-triage This issue or PR still needs to be triaged. feature-request A feature should be added or improved. labels Feb 3, 2021
@horsmand
Copy link
Contributor

horsmand commented Feb 3, 2021

How come we can't use the regional S3 endpoints to download the CloudWatch agent installer? I could be confused, but it looks like they list them in their installation guide: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/download-cloudwatch-agent-commandline.html

@horsmand
Copy link
Contributor

horsmand commented Feb 3, 2021

Another idea we had discussed was making the CloudWatch agent optional with the default being to still attempt the installation, but emit a warning from the command line that it's turned on.

@ddneilson
Copy link
Contributor Author

How come we can't use the regional S3 endpoints to download the CloudWatch agent installer? I could be confused, but it looks like they list them in their installation guide: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/download-cloudwatch-agent-commandline.html

Interesting. Yes, ensuring we use the regional endpoint would be great.

@horsmand horsmand removed the needs-triage This issue or PR still needs to be triaged. label Feb 10, 2021
@horsmand horsmand self-assigned this Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants