@@ -386,7 +386,6 @@ Resources:
386386 import logging
387387 from datetime import date
388388 from functools import partial
389- import boto3
390389
391390 BUCKET_PREFIX = os.environ["BUCKET_PREFIX"]
392391 INCLUDE_MEMBER_ACCOUNTS = os.environ.get("INCLUDE_MEMBER_ACCOUNTS", 'yes').lower() == 'yes'
@@ -396,6 +395,12 @@ Resources:
396395
397396 logger = logging.getLogger(__name__)
398397 logger.setLevel(getattr(logging, os.environ.get('LOG_LEVEL', 'INFO').upper(), logging.INFO))
398+ #ensure we get latest boto3
399+ from pip._internal.cli.main import main, sys
400+ logging.getLogger('pip').setLevel(logging.ERROR) # Silence pip's logger
401+ main(['install', '-I', 'boto3', '--target', '/tmp/', '--no-cache-dir', '--disable-pip-version-check'])
402+ sys.path.insert(0,'/tmp/')
403+ import boto3 #pylint: disable=wrong-import-position
399404
400405 def lambda_handler(event, context): #pylint: disable=unused-argument
401406 logger.info(f"Event data {json.dumps(event)}")
@@ -430,6 +435,7 @@ Resources:
430435 'ecs_service': co.export_ecs_service_recommendations,
431436 'license': co.export_license_recommendations,
432437 'rds_database': partial(co.export_rds_database_recommendations, recommendationPreferences={'cpuVendorArchitectures': ARCH}),
438+ 'idle': co.export_idle_recommendations,
433439 }
434440 bucket = BUCKET_PREFIX + '.' + region
435441 logger.info(f"INFO: bucket={bucket}")
0 commit comments