ComputeOptimizer / Client / get_ecs_service_recommendations

get_ecs_service_recommendations#

ComputeOptimizer.Client.get_ecs_service_recommendations(**kwargs)#

Returns Amazon ECS service recommendations.

Compute Optimizer generates recommendations for Amazon ECS services on Fargate that meet a specific set of requirements. For more information, see the Supported resources and requirements in the Compute Optimizer User Guide.

See also: AWS API Documentation

Request Syntax

response = client.get_ecs_service_recommendations(
    serviceArns=[
        'string',
    ],
    nextToken='string',
    maxResults=123,
    filters=[
        {
            'name': 'Finding'|'FindingReasonCode',
            'values': [
                'string',
            ]
        },
    ],
    accountIds=[
        'string',
    ]
)
Parameters:
  • serviceArns (list) –

    The ARN that identifies the Amazon ECS service.

    The following is the format of the ARN:

    arn:aws:ecs:region:aws_account_id:service/cluster-name/service-name

    • (string) –

  • nextToken (string) – The token to advance to the next page of Amazon ECS service recommendations.

  • maxResults (integer) –

    The maximum number of Amazon ECS service recommendations to return with a single request.

    To retrieve the remaining results, make another request with the returned nextToken value.

  • filters (list) –

    An array of objects to specify a filter that returns a more specific list of Amazon ECS service recommendations.

    • (dict) –

      Describes a filter that returns a more specific list of Amazon ECS service recommendations. Use this filter with the GetECSServiceRecommendations action.

      • name (string) –

        The name of the filter.

        Specify Finding to return recommendations with a specific finding classification.

        Specify FindingReasonCode to return recommendations with a specific finding reason code.

        You can filter your Amazon ECS service recommendations by tag:key and tag-key tags.

        A tag:key is a key and value combination of a tag assigned to your Amazon ECS service recommendations. Use the tag key in the filter name and the tag value as the filter value. For example, to find all Amazon ECS service recommendations that have a tag with the key of Owner and the value of TeamA, specify tag:Owner for the filter name and TeamA for the filter value.

        A tag-key is the key of a tag assigned to your Amazon ECS service recommendations. Use this filter to find all of your Amazon ECS service recommendations that have a tag with a specific key. This doesn’t consider the tag value. For example, you can find your Amazon ECS service recommendations with a tag key value of Owner or without any tag keys assigned.

      • values (list) –

        The value of the filter.

        The valid values for this parameter are as follows:

        • If you specify the name parameter as Finding, specify Optimized, NotOptimized, or Unavailable.

        • If you specify the name parameter as FindingReasonCode, specify CPUUnderprovisioned, CPUOverprovisioned, MemoryUnderprovisioned, or MemoryOverprovisioned.

        • (string) –

  • accountIds (list) –

    Return the Amazon ECS service recommendations to the specified Amazon Web Services account IDs.

    If your account is the management account or the delegated administrator of an organization, use this parameter to return the Amazon ECS service recommendations to specific member accounts.

    You can only specify one account ID per request.

    • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'nextToken': 'string',
    'ecsServiceRecommendations': [
        {
            'serviceArn': 'string',
            'accountId': 'string',
            'currentServiceConfiguration': {
                'memory': 123,
                'cpu': 123,
                'containerConfigurations': [
                    {
                        'containerName': 'string',
                        'memorySizeConfiguration': {
                            'memory': 123,
                            'memoryReservation': 123
                        },
                        'cpu': 123
                    },
                ],
                'autoScalingConfiguration': 'TargetTrackingScalingCpu'|'TargetTrackingScalingMemory',
                'taskDefinitionArn': 'string'
            },
            'utilizationMetrics': [
                {
                    'name': 'Cpu'|'Memory',
                    'statistic': 'Maximum'|'Average',
                    'value': 123.0
                },
            ],
            'lookbackPeriodInDays': 123.0,
            'launchType': 'EC2'|'Fargate',
            'lastRefreshTimestamp': datetime(2015, 1, 1),
            'finding': 'Optimized'|'Underprovisioned'|'Overprovisioned',
            'findingReasonCodes': [
                'MemoryOverprovisioned'|'MemoryUnderprovisioned'|'CPUOverprovisioned'|'CPUUnderprovisioned',
            ],
            'serviceRecommendationOptions': [
                {
                    'memory': 123,
                    'cpu': 123,
                    'savingsOpportunity': {
                        'savingsOpportunityPercentage': 123.0,
                        'estimatedMonthlySavings': {
                            'currency': 'USD'|'CNY',
                            'value': 123.0
                        }
                    },
                    'projectedUtilizationMetrics': [
                        {
                            'name': 'Cpu'|'Memory',
                            'statistic': 'Maximum'|'Average',
                            'lowerBoundValue': 123.0,
                            'upperBoundValue': 123.0
                        },
                    ],
                    'containerRecommendations': [
                        {
                            'containerName': 'string',
                            'memorySizeConfiguration': {
                                'memory': 123,
                                'memoryReservation': 123
                            },
                            'cpu': 123
                        },
                    ],
                    'savingsOpportunityAfterDiscounts': {
                        'savingsOpportunityPercentage': 123.0,
                        'estimatedMonthlySavings': {
                            'currency': 'USD'|'CNY',
                            'value': 123.0
                        }
                    }
                },
            ],
            'currentPerformanceRisk': 'VeryLow'|'Low'|'Medium'|'High',
            'tags': [
                {
                    'key': 'string',
                    'value': 'string'
                },
            ],
            'effectiveRecommendationPreferences': {
                'savingsEstimationMode': {
                    'source': 'PublicPricing'|'CostExplorerRightsizing'|'CostOptimizationHub'
                }
            }
        },
    ],
    'errors': [
        {
            'identifier': 'string',
            'code': 'string',
            'message': 'string'
        },
    ]
}

Response Structure

  • (dict) –

    • nextToken (string) –

      The token to advance to the next page of Amazon ECS service recommendations.

    • ecsServiceRecommendations (list) –

      An array of objects that describe the Amazon ECS service recommendations.

      • (dict) –

        Describes an Amazon ECS service recommendation.

        • serviceArn (string) –

          The Amazon Resource Name (ARN) of the current Amazon ECS service.

          The following is the format of the ARN:

          arn:aws:ecs:region:aws_account_id:service/cluster-name/service-name

        • accountId (string) –

          The Amazon Web Services account ID of the Amazon ECS service.

        • currentServiceConfiguration (dict) –

          The configuration of the current Amazon ECS service.

          • memory (integer) –

            The amount of memory used by the tasks in the Amazon ECS service.

          • cpu (integer) –

            The number of CPU units used by the tasks in the Amazon ECS service.

          • containerConfigurations (list) –

            The container configurations within a task of an Amazon ECS service.

            • (dict) –

              Describes the container configurations within the tasks of your Amazon ECS service.

              • containerName (string) –

                The name of the container.

              • memorySizeConfiguration (dict) –

                The memory size configurations for the container.

                • memory (integer) –

                  The amount of memory in the container.

                • memoryReservation (integer) –

                  The limit of memory reserve for the container.

              • cpu (integer) –

                The number of CPU units reserved for the container.

          • autoScalingConfiguration (string) –

            Describes the Auto Scaling configuration methods for an Amazon ECS service. This affects the generated recommendations. For example, if Auto Scaling is configured on a service’s CPU, then Compute Optimizer doesn’t generate CPU size recommendations.

            The Auto Scaling configuration methods include:

            • TARGET_TRACKING_SCALING_CPU — If the Amazon ECS service is configured to use target scaling on CPU, Compute Optimizer doesn’t generate CPU recommendations.

            • TARGET_TRACKING_SCALING_MEMORY — If the Amazon ECS service is configured to use target scaling on memory, Compute Optimizer doesn’t generate memory recommendations.

            For more information about step scaling and target scaling, see Step scaling policies for Application Auto Scaling and Target tracking scaling policies for Application Auto Scaling in the Application Auto Scaling User Guide.

          • taskDefinitionArn (string) –

            The task definition ARN used by the tasks in the Amazon ECS service.

        • utilizationMetrics (list) –

          An array of objects that describe the utilization metrics of the Amazon ECS service.

          • (dict) –

            Describes the utilization metric of an Amazon ECS service.

            To determine the performance difference between your current Amazon ECS service and the recommended option, compare the utilization metric data of your service against its projected utilization metric data.

            • name (string) –

              The name of the utilization metric.

              The following utilization metrics are available:

              • Cpu — The amount of CPU capacity that’s used in the service.

              • Memory — The amount of memory that’s used in the service.

            • statistic (string) –

              The statistic of the utilization metric.

              The Compute Optimizer API, Command Line Interface (CLI), and SDKs return utilization metrics using only the Maximum statistic, which is the highest value observed during the specified period.

              The Compute Optimizer console displays graphs for some utilization metrics using the Average statistic, which is the value of Sum / SampleCount during the specified period. For more information, see Viewing resource recommendations in the Compute Optimizer User Guide. You can also get averaged utilization metric data for your resources using Amazon CloudWatch. For more information, see the Amazon CloudWatch User Guide.

            • value (float) –

              The value of the utilization metric.

        • lookbackPeriodInDays (float) –

          The number of days the Amazon ECS service utilization metrics were analyzed.

        • launchType (string) –

          The launch type the Amazon ECS service is using.

          Note

          Compute Optimizer only supports the Fargate launch type.

        • lastRefreshTimestamp (datetime) –

          The timestamp of when the Amazon ECS service recommendation was last generated.

        • finding (string) –

          The finding classification of an Amazon ECS service.

          Findings for Amazon ECS services include:

          • Underprovisioned — When Compute Optimizer detects that there’s not enough memory or CPU, an Amazon ECS service is considered under-provisioned. An under-provisioned service might result in poor application performance.

          • Overprovisioned — When Compute Optimizer detects that there’s excessive memory or CPU, an Amazon ECS service is considered over-provisioned. An over-provisioned service might result in additional infrastructure costs.

          • Optimized — When both the CPU and memory of your Amazon ECS service meet the performance requirements of your workload, the service is considered optimized.

        • findingReasonCodes (list) –

          The reason for the finding classification of an Amazon ECS service.

          Finding reason codes for Amazon ECS services include:

          • CPUUnderprovisioned — The service CPU configuration can be sized up to enhance the performance of your workload. This is identified by analyzing the CPUUtilization metric of the current service during the look-back period.

          • CPUOverprovisioned — The service CPU configuration can be sized down while still meeting the performance requirements of your workload. This is identified by analyzing the CPUUtilization metric of the current service during the look-back period.

          • MemoryUnderprovisioned — The service memory configuration can be sized up to enhance the performance of your workload. This is identified by analyzing the MemoryUtilization metric of the current service during the look-back period.

          • MemoryOverprovisioned — The service memory configuration can be sized down while still meeting the performance requirements of your workload. This is identified by analyzing the MemoryUtilization metric of the current service during the look-back period.

          • (string) –

        • serviceRecommendationOptions (list) –

          An array of objects that describe the recommendation options for the Amazon ECS service.

          • (dict) –

            Describes the recommendation options for an Amazon ECS service.

            • memory (integer) –

              The memory size of the Amazon ECS service recommendation option.

            • cpu (integer) –

              The CPU size of the Amazon ECS service recommendation option.

            • savingsOpportunity (dict) –

              Describes the savings opportunity for recommendations of a given resource type or for the recommendation option of an individual resource.

              Savings opportunity represents the estimated monthly savings you can achieve by implementing a given Compute Optimizer recommendation.

              Warning

              Savings opportunity data requires that you opt in to Cost Explorer, as well as activate Receive Amazon EC2 resource recommendations in the Cost Explorer preferences page. That creates a connection between Cost Explorer and Compute Optimizer. With this connection, Cost Explorer generates savings estimates considering the price of existing resources, the price of recommended resources, and historical usage data. Estimated monthly savings reflects the projected dollar savings associated with each of the recommendations generated. For more information, see Enabling Cost Explorer and Optimizing your cost with Rightsizing Recommendations in the Cost Management User Guide.

              • savingsOpportunityPercentage (float) –

                The estimated monthly savings possible as a percentage of monthly cost by adopting Compute Optimizer recommendations for a given resource.

              • estimatedMonthlySavings (dict) –

                An object that describes the estimated monthly savings amount possible by adopting Compute Optimizer recommendations for a given resource. This is based on the On-Demand instance pricing..

                • currency (string) –

                  The currency of the estimated monthly savings.

                • value (float) –

                  The value of the estimated monthly savings.

            • projectedUtilizationMetrics (list) –

              An array of objects that describe the projected utilization metrics of the Amazon ECS service recommendation option.

              • (dict) –

                Describes the projected utilization metrics of an Amazon ECS service recommendation option.

                To determine the performance difference between your current Amazon ECS service and the recommended option, compare the utilization metric data of your service against its projected utilization metric data.

                • name (string) –

                  The name of the projected utilization metric.

                  The following utilization metrics are available:

                  • Cpu — The percentage of allocated compute units that are currently in use on the service tasks.

                  • Memory — The percentage of memory that’s currently in use on the service tasks.

                • statistic (string) –

                  The statistic of the projected utilization metric.

                  The Compute Optimizer API, Command Line Interface (CLI), and SDKs return utilization metrics using only the Maximum statistic, which is the highest value observed during the specified period.

                  The Compute Optimizer console displays graphs for some utilization metrics using the Average statistic, which is the value of Sum / SampleCount during the specified period. For more information, see Viewing resource recommendations in the Compute Optimizer User Guide. You can also get averaged utilization metric data for your resources using Amazon CloudWatch. For more information, see the Amazon CloudWatch User Guide.

                • lowerBoundValue (float) –

                  The lower bound values for the projected utilization metrics.

                • upperBoundValue (float) –

                  The upper bound values for the projected utilization metrics.

            • containerRecommendations (list) –

              The CPU and memory size recommendations for the containers within the task of your Amazon ECS service.

              • (dict) –

                The CPU and memory recommendations for a container within the tasks of your Amazon ECS service.

                • containerName (string) –

                  The name of the container.

                • memorySizeConfiguration (dict) –

                  The recommended memory size configurations for the container.

                  • memory (integer) –

                    The amount of memory in the container.

                  • memoryReservation (integer) –

                    The limit of memory reserve for the container.

                • cpu (integer) –

                  The recommended number of CPU units reserved for the container.

            • savingsOpportunityAfterDiscounts (dict) –

              Describes the savings opportunity for Amazon ECS service recommendations or for the recommendation option.

              Savings opportunity represents the estimated monthly savings after applying Savings Plans discounts. You can achieve this by implementing a given Compute Optimizer recommendation.

              • savingsOpportunityPercentage (float) –

                The estimated monthly savings possible as a percentage of monthly cost by adopting Compute Optimizer’s Amazon ECS service recommendations. This includes any applicable Savings Plans discounts.

              • estimatedMonthlySavings (dict) –

                The estimated monthly savings possible by adopting Compute Optimizer’s Amazon ECS service recommendations. This includes any applicable Savings Plans discounts.

                • currency (string) –

                  The currency of the estimated monthly savings.

                • value (float) –

                  The value of the estimated monthly savings for Amazon ECS services.

        • currentPerformanceRisk (string) –

          The risk of the current Amazon ECS service not meeting the performance needs of its workloads. The higher the risk, the more likely the current service can’t meet the performance requirements of its workload.

        • tags (list) –

          A list of tags assigned to your Amazon ECS service recommendations.

          • (dict) –

            A list of tag key and value pairs that you define.

            • key (string) –

              One part of a key-value pair that makes up a tag. A key is a general label that acts like a category for more specific tag values.

            • value (string) –

              One part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key). The value can be empty or null.

        • effectiveRecommendationPreferences (dict) –

          Describes the effective recommendation preferences for Amazon ECS services.

          • savingsEstimationMode (dict) –

            Describes the savings estimation mode preference applied for calculating savings opportunity for Amazon ECS services.

            • source (string) –

              Describes the source for calculating the savings opportunity for Amazon ECS services.

    • errors (list) –

      An array of objects that describe errors of the request.

      • (dict) –

        Describes an error experienced when getting recommendations.

        For example, an error is returned if you request recommendations for an unsupported Auto Scaling group, or if you request recommendations for an instance of an unsupported instance family.

        • identifier (string) –

          The ID of the error.

        • code (string) –

          The error code.

        • message (string) –

          The message, or reason, for the error.

Exceptions