createCapacityProvider method
- required String capacityProviderName,
- required CapacityProviderPermissionsConfig permissionsConfig,
- required CapacityProviderVpcConfig vpcConfig,
- CapacityProviderScalingConfig? capacityProviderScalingConfig,
- InstanceRequirements? instanceRequirements,
- String? kmsKeyArn,
- PropagateTags? propagateTags,
- Map<
String, String> ? tags,
Creates a capacity provider that manages compute resources for Lambda functions
May throw CapacityProviderLimitExceededException.
May throw InvalidParameterValueException.
May throw ResourceConflictException.
May throw ServiceException.
May throw TooManyRequestsException.
Parameter capacityProviderName :
The name of the capacity provider.
Parameter permissionsConfig :
The permissions configuration that specifies the IAM role ARN used by the
capacity provider to manage compute resources.
Parameter vpcConfig :
The VPC configuration for the capacity provider, including subnet IDs and
security group IDs where compute instances will be launched.
Parameter capacityProviderScalingConfig :
The scaling configuration that defines how the capacity provider scales
compute instances, including maximum vCPU count and scaling policies.
Parameter instanceRequirements :
The instance requirements that specify the compute instance
characteristics, including architectures and allowed or excluded instance
types.
Parameter kmsKeyArn :
The ARN of the KMS key used to encrypt data associated with the capacity
provider.
Parameter propagateTags :
The tag propagation configuration for the capacity provider. Specifies
tags to apply to managed resources at launch.
Parameter tags :
A list of tags to associate with the capacity provider.
Implementation
Future<CreateCapacityProviderResponse> createCapacityProvider({
required String capacityProviderName,
required CapacityProviderPermissionsConfig permissionsConfig,
required CapacityProviderVpcConfig vpcConfig,
CapacityProviderScalingConfig? capacityProviderScalingConfig,
InstanceRequirements? instanceRequirements,
String? kmsKeyArn,
PropagateTags? propagateTags,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'CapacityProviderName': capacityProviderName,
'PermissionsConfig': permissionsConfig,
'VpcConfig': vpcConfig,
if (capacityProviderScalingConfig != null)
'CapacityProviderScalingConfig': capacityProviderScalingConfig,
if (instanceRequirements != null)
'InstanceRequirements': instanceRequirements,
if (kmsKeyArn != null) 'KmsKeyArn': kmsKeyArn,
if (propagateTags != null) 'PropagateTags': propagateTags,
if (tags != null) 'Tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/2025-11-30/capacity-providers',
exceptionFnMap: _exceptionFns,
);
return CreateCapacityProviderResponse.fromJson(response);
}