From 95ad9e7ffa6896e473f8e4475dab5e81fa6368b5 Mon Sep 17 00:00:00 2001 From: Vishnu Narayanan Date: Fri, 1 Aug 2025 19:32:04 +0530 Subject: [PATCH] fix: switch to using ec2 instance role --- .env.example | 1 + config/initializers/sidekiq_cloudwatch.rb | 10 +--------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index 152283b48..a49ba120c 100644 --- a/.env.example +++ b/.env.example @@ -262,6 +262,7 @@ AZURE_APP_SECRET= # Sidekiq CloudWatch Metrics Configuration # Enable CloudWatch metrics collection for Sidekiq (Chatwoot Cloud only) +# Uses EC2 instance role for AWS credentials - no additional AWS config needed # ENABLE_SIDEKIQ_CLOUDWATCH=true # CloudWatch namespace for Sidekiq metrics (default: Chatwoot/Sidekiq) diff --git a/config/initializers/sidekiq_cloudwatch.rb b/config/initializers/sidekiq_cloudwatch.rb index ccafbdff0..871c1f8db 100644 --- a/config/initializers/sidekiq_cloudwatch.rb +++ b/config/initializers/sidekiq_cloudwatch.rb @@ -1,16 +1,8 @@ if defined?(Sidekiq::CloudWatchMetrics) && defined?(ChatwootApp) && ChatwootApp.chatwoot_cloud? && ENV['ENABLE_SIDEKIQ_CLOUDWATCH'].present? require 'sidekiq/cloudwatchmetrics' - # Configure AWS region if specified - if ENV['AWS_REGION'].present? - require 'aws-sdk-cloudwatch' - client = Aws::CloudWatch::Client.new(region: ENV['AWS_REGION']) - else - client = nil # Use default client (EC2 instance role or env credentials) - end - + # Use EC2 instance role for AWS credentials (no custom client needed) Sidekiq::CloudWatchMetrics.enable!( - client: client, namespace: ENV.fetch('SIDEKIQ_CLOUDWATCH_NAMESPACE', 'Chatwoot/Sidekiq'), interval: ENV.fetch('SIDEKIQ_CLOUDWATCH_INTERVAL', '60').to_i )