Class: AWSCDK::DynamoDB::CfnGlobalTable::CapacityAutoScalingSettingsProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
dynamo_db/cfn_global_table.rb

Overview

Configures a scalable target and an autoscaling policy for a table or global secondary index's read or write capacity.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(max_capacity:, min_capacity:, target_tracking_scaling_policy_configuration:, seed_capacity: nil) ⇒ CapacityAutoScalingSettingsProperty

Returns a new instance of CapacityAutoScalingSettingsProperty.

Parameters:

  • max_capacity (Numeric)

    The maximum provisioned capacity units for the global table.

  • min_capacity (Numeric)

    The minimum provisioned capacity units for the global table.

  • target_tracking_scaling_policy_configuration (AWSCDK::IResolvable, AWSCDK::DynamoDB::CfnGlobalTable::TargetTrackingScalingPolicyConfigurationProperty)

    Defines a target tracking scaling policy.

  • seed_capacity (Numeric, nil) (defaults to: nil)

    When switching billing mode from PAY_PER_REQUEST to PROVISIONED , DynamoDB requires you to specify read and write capacity unit values for the table and for each global secondary index.



855
856
857
858
859
860
861
862
863
864
# File 'dynamo_db/cfn_global_table.rb', line 855

def initialize(max_capacity:, min_capacity:, target_tracking_scaling_policy_configuration:, seed_capacity: nil)
  @max_capacity = max_capacity
  Jsii::Type.check_type(@max_capacity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxCapacity")
  @min_capacity = min_capacity
  Jsii::Type.check_type(@min_capacity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minCapacity")
  @target_tracking_scaling_policy_configuration = target_tracking_scaling_policy_configuration.is_a?(Hash) ? ::AWSCDK::DynamoDB::CfnGlobalTable::TargetTrackingScalingPolicyConfigurationProperty.new(**target_tracking_scaling_policy_configuration.transform_keys(&:to_sym)) : target_tracking_scaling_policy_configuration
  Jsii::Type.check_type(@target_tracking_scaling_policy_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19keW5hbW9kYi5DZm5HbG9iYWxUYWJsZS5UYXJnZXRUcmFja2luZ1NjYWxpbmdQb2xpY3lDb25maWd1cmF0aW9uUHJvcGVydHkifV19fQ==")), "targetTrackingScalingPolicyConfiguration")
  @seed_capacity = seed_capacity
  Jsii::Type.check_type(@seed_capacity, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "seedCapacity") unless @seed_capacity.nil?
end

Instance Attribute Details

#max_capacityNumeric (readonly)

The maximum provisioned capacity units for the global table.



870
871
872
# File 'dynamo_db/cfn_global_table.rb', line 870

def max_capacity
  @max_capacity
end

#min_capacityNumeric (readonly)

The minimum provisioned capacity units for the global table.



875
876
877
# File 'dynamo_db/cfn_global_table.rb', line 875

def min_capacity
  @min_capacity
end

#seed_capacityNumeric? (readonly)

When switching billing mode from PAY_PER_REQUEST to PROVISIONED , DynamoDB requires you to specify read and write capacity unit values for the table and for each global secondary index.

These values will be applied to all replicas. The table will use these provisioned values until CloudFormation creates the autoscaling policies you configured in your template. CloudFormation cannot determine what capacity the table and its global secondary indexes will require in this time period, since they are application-dependent.

If you want to switch a table's billing mode from PAY_PER_REQUEST to PROVISIONED , you must specify a value for this property for each autoscaled resource. If you specify different values for the same resource in different regions, CloudFormation will use the highest value found in either the SeedCapacity or ReadCapacityUnits properties. For example, if your global secondary index my_gsi has a SeedCapacity of 10 in us-east-1 and a fixed ReadCapacityUnits of 20 in eu-west-1, CloudFormation will initially set the read capacity for my_gsi to 20. Note that if you disable ScaleIn for my_gsi in us-east-1, its read capacity units might not be set back to 10.

You must also specify a value for SeedCapacity when you plan to switch a table's billing mode from PROVISIONED to PAY_PER_REQUEST , because CloudFormation might need to roll back the operation (reverting the billing mode to PROVISIONED ) and this cannot succeed without specifying a value for SeedCapacity .



891
892
893
# File 'dynamo_db/cfn_global_table.rb', line 891

def seed_capacity
  @seed_capacity
end

#target_tracking_scaling_policy_configurationAWSCDK::IResolvable, AWSCDK::DynamoDB::CfnGlobalTable::TargetTrackingScalingPolicyConfigurationProperty (readonly)

Defines a target tracking scaling policy.



880
881
882
# File 'dynamo_db/cfn_global_table.rb', line 880

def target_tracking_scaling_policy_configuration
  @target_tracking_scaling_policy_configuration
end

Class Method Details

.jsii_propertiesObject



893
894
895
896
897
898
899
900
# File 'dynamo_db/cfn_global_table.rb', line 893

def self.jsii_properties
  {
    :max_capacity => "maxCapacity",
    :min_capacity => "minCapacity",
    :target_tracking_scaling_policy_configuration => "targetTrackingScalingPolicyConfiguration",
    :seed_capacity => "seedCapacity",
  }
end

Instance Method Details

#to_jsiiObject



902
903
904
905
906
907
908
909
910
911
# File 'dynamo_db/cfn_global_table.rb', line 902

def to_jsii
  result = {}
  result.merge!({
    "maxCapacity" => @max_capacity,
    "minCapacity" => @min_capacity,
    "targetTrackingScalingPolicyConfiguration" => @target_tracking_scaling_policy_configuration,
    "seedCapacity" => @seed_capacity,
  })
  result.compact
end