{"id":22347766,"url":"https://github.com/wearetechnative/amazon-cloudwatch-agent-nix","last_synced_at":"2025-07-30T04:33:25.977Z","repository":{"id":224053331,"uuid":"762273260","full_name":"wearetechnative/amazon-cloudwatch-agent-nix","owner":"wearetechnative","description":"This flake enables Amazon CloudWatch Agent on NixOS. This is a WIP project with a final goal to submit a PR in the official nixpgs repo.","archived":false,"fork":false,"pushed_at":"2025-02-24T09:47:56.000Z","size":18,"stargazers_count":5,"open_issues_count":11,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-06T02:11:21.230Z","etag":null,"topics":["aws","cloudwatch","ec2","nix","nix-flake","nixos"],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wearetechnative.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-23T12:43:59.000Z","updated_at":"2025-02-24T09:48:00.000Z","dependencies_parsed_at":"2024-12-04T10:10:56.439Z","dependency_job_id":"1bee7eee-ad07-4749-85fa-5fa625dae95f","html_url":"https://github.com/wearetechnative/amazon-cloudwatch-agent-nix","commit_stats":null,"previous_names":["mipmip/amazon-cloudwatch-agent-nix","wearetechnative/amazon-cloudwatch-agent-nix"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wearetechnative/amazon-cloudwatch-agent-nix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wearetechnative%2Famazon-cloudwatch-agent-nix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wearetechnative%2Famazon-cloudwatch-agent-nix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wearetechnative%2Famazon-cloudwatch-agent-nix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wearetechnative%2Famazon-cloudwatch-agent-nix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wearetechnative","download_url":"https://codeload.github.com/wearetechnative/amazon-cloudwatch-agent-nix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wearetechnative%2Famazon-cloudwatch-agent-nix/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267809688,"owners_count":24147516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","cloudwatch","ec2","nix","nix-flake","nixos"],"created_at":"2024-12-04T10:10:51.418Z","updated_at":"2025-07-30T04:33:25.688Z","avatar_url":"https://github.com/wearetechnative.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Amazon CloudWatch Agent on NixOS\n\nFlake to install's the CloudWatch Agent on NixOS.\n\n## TODO\n\n- more configuration options\n- more documentation\n- PR for nixpkgs\n\n## Usage\n\nThis is how you Install Amazon CloudWatch Agent on NixOS. In the inputs of your\nflake, add the Amazon CloudWatch Agent flake.\n\n```nix\n{\n  inputs = {\n    nixpkgs.url = \"github:NixOS/nixpkgs/nixos-23.11\";\n    amazon-cloudwatch-agent.url = \"github:mipmip/amazon-cloudwatch-agent-nix\";\n  }\n}\n```\n\nThen you will need to import the module and also add the cloudwatch agent\nsoftware to the system packages.\n\nBelow is an example setup.\n\n```nix\n{\n  description = \"NixOS configuration Amazon CloudWatch Agent\";\n\n  inputs = {\n    nixpkgs.url = \"github:NixOS/nixpkgs/nixos-23.11\";\n    amazon-cloudwatch-agent.url = \"github:mipmip/amazon-cloudwatch-agent-nix\";\n  };\n\n  outputs = { self, nixpkgs, amazon-cloudwatch-agent }:\n    let\n      system = \"x86_64-linux\";\n\n      amazon-cloudwatch-module = amazon-cloudwatch-agent.nixosModules.default;\n      amazon-cloudwatch-config = {\n        services.amazon-cloudwatch-agent.enable = true;\n        environment.systemPackages = [\n         amazon-cloudwatch-agent.packages.\"${system}\".amazon-cloudwatch-agent\n        ];\n      };\n\n    in {\n      nixosConfigurations.\"\u003chostname\u003e\" = nixpkgs.lib.nixosSystem {\n        inherit system;\n        modules = [\n          amazon-cloudwatch-module\n          amazon-cloudwatch-config\n          ./configuration.nix\n        ];\n      };\n    };\n}\n```\n\n## Give CloudWatch Agent permission to publish to CloudWatch\n\nOnce the agent is installed, you just need to make sure it has permission to\npublish its metrics to CloudWatch. You grant this permission by adding a policy\nto the IAM Instance Profile.\n\nBelow is an example piece of Terraform code on how to add this to your EC2\nprofile.\n\n```hcl\nresource \"aws_iam_instance_profile\" \"ssm-access-iam-profile\" {\n  name = \"ec2_profile\"\n  role = aws_iam_role.ssm-access-iam-role.name\n}\n\nresource \"aws_iam_role\" \"ssm-access-iam-role\" {\n  name        = \"ssm-access-role\"\n  description = \"The role to access EC2 with SSM\"\n\n  assume_role_policy = jsonencode({\n    Version = \"2012-10-17\"\n    Statement = [\n      {\n        Effect    = \"Allow\"\n        Principal = {\n          Service = \"ec2.amazonaws.com\"\n        }\n        Action = \"sts:AssumeRole\"\n      }\n    ]\n  })\n}\n\nresource \"aws_iam_role_policy_attachment\" \"cloudwatch-policy\" {\n  role       = aws_iam_role.ssm-access-iam-role.name\n  policy_arn = \"arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy\"\n}\n```\n\n\n\n\n## credits\n\n- https://github.com/reckenrode/nix-foundryvtt - used as example for module\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwearetechnative%2Famazon-cloudwatch-agent-nix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwearetechnative%2Famazon-cloudwatch-agent-nix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwearetechnative%2Famazon-cloudwatch-agent-nix/lists"}