published on Friday, Nov 6, 2026 by Pulumi
published on Friday, Nov 6, 2026 by Pulumi
Manages EC2 Capacity Manager settings for the current AWS account. EC2 Capacity Manager monitors, analyzes, and helps manage EC2 capacity usage across On-Demand Instances, Spot Instances, and Capacity Reservations.
Capacity Manager can be enabled in only one Region per account (the home Region), where it aggregates capacity data from all Regions. After enabling, initial data ingestion may take several hours to complete.
Note: Destroying this resource disables EC2 Capacity Manager, which also disables Organizations access.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2.CapacityManager("example", {enabled: true});
import pulumi
import pulumi_aws as aws
example = aws.ec2.CapacityManager("example", enabled=True)
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ec2.NewCapacityManager(ctx, "example", &ec2.CapacityManagerArgs{
Enabled: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Ec2.CapacityManager("example", new()
{
Enabled = true,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.CapacityManager;
import com.pulumi.aws.ec2.CapacityManagerArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new CapacityManager("example", CapacityManagerArgs.builder()
.enabled(true)
.build());
}
}
resources:
example:
type: aws:ec2:CapacityManager
properties:
enabled: true
terraform {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_ec2_capacity_manager" "example" {
lifecycle {
create_before_destroy = true
}
enabled = true
}
Organizations Access
To aggregate data from all accounts in an AWS Organization, enable Organizations access from the management account (or a delegated administrator account):
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2.CapacityManager("example", {
enabled: true,
organizationsAccess: true,
});
import pulumi
import pulumi_aws as aws
example = aws.ec2.CapacityManager("example",
enabled=True,
organizations_access=True)
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ec2.NewCapacityManager(ctx, "example", &ec2.CapacityManagerArgs{
Enabled: pulumi.Bool(true),
OrganizationsAccess: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Ec2.CapacityManager("example", new()
{
Enabled = true,
OrganizationsAccess = true,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.CapacityManager;
import com.pulumi.aws.ec2.CapacityManagerArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new CapacityManager("example", CapacityManagerArgs.builder()
.enabled(true)
.organizationsAccess(true)
.build());
}
}
resources:
example:
type: aws:ec2:CapacityManager
properties:
enabled: true
organizationsAccess: true
terraform {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_ec2_capacity_manager" "example" {
lifecycle {
create_before_destroy = true
}
enabled = true
organizations_access = true
}
Organizations Access with a Delegated Administrator
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const delegated = aws.getCallerIdentity({});
const example = new aws.organizations.DelegatedAdministrator("example", {
accountId: delegated.then(delegated => delegated.accountId),
servicePrincipal: "ec2.capacitymanager.amazonaws.com",
});
const exampleCapacityManager = new aws.ec2.CapacityManager("example", {
enabled: true,
organizationsAccess: true,
}, {
dependsOn: [example],
});
import pulumi
import pulumi_aws as aws
delegated = aws.get_caller_identity()
example = aws.organizations.DelegatedAdministrator("example",
account_id=delegated.account_id,
service_principal="ec2.capacitymanager.amazonaws.com")
example_capacity_manager = aws.ec2.CapacityManager("example",
enabled=True,
organizations_access=True,
opts = pulumi.ResourceOptions(depends_on=[example]))
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
delegated, err := aws.GetCallerIdentity(ctx, &aws.GetCallerIdentityArgs{}, nil)
if err != nil {
return err
}
example, err := organizations.NewDelegatedAdministrator(ctx, "example", &organizations.DelegatedAdministratorArgs{
AccountId: pulumi.String(delegated.AccountId),
ServicePrincipal: pulumi.String("ec2.capacitymanager.amazonaws.com"),
})
if err != nil {
return err
}
_, err = ec2.NewCapacityManager(ctx, "example", &ec2.CapacityManagerArgs{
Enabled: pulumi.Bool(true),
OrganizationsAccess: pulumi.Bool(true),
}, pulumi.DependsOn([]pulumi.Resource{
example,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var delegated = Aws.GetCallerIdentity.Invoke();
var example = new Aws.Organizations.DelegatedAdministrator("example", new()
{
AccountId = delegated.Apply(getCallerIdentityResult => getCallerIdentityResult.AccountId),
ServicePrincipal = "ec2.capacitymanager.amazonaws.com",
});
var exampleCapacityManager = new Aws.Ec2.CapacityManager("example", new()
{
Enabled = true,
OrganizationsAccess = true,
}, new CustomResourceOptions
{
DependsOn =
{
example,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.inputs.GetCallerIdentityArgs;
import com.pulumi.aws.organizations.DelegatedAdministrator;
import com.pulumi.aws.organizations.DelegatedAdministratorArgs;
import com.pulumi.aws.ec2.CapacityManager;
import com.pulumi.aws.ec2.CapacityManagerArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var delegated = AwsFunctions.getCallerIdentity(GetCallerIdentityArgs.builder()
.build());
var example = new DelegatedAdministrator("example", DelegatedAdministratorArgs.builder()
.accountId(delegated.accountId())
.servicePrincipal("ec2.capacitymanager.amazonaws.com")
.build());
var exampleCapacityManager = new CapacityManager("exampleCapacityManager", CapacityManagerArgs.builder()
.enabled(true)
.organizationsAccess(true)
.build(), CustomResourceOptions.builder()
.dependsOn(example)
.build());
}
}
resources:
example:
type: aws:organizations:DelegatedAdministrator
properties:
accountId: ${delegated.accountId}
servicePrincipal: ec2.capacitymanager.amazonaws.com
exampleCapacityManager:
type: aws:ec2:CapacityManager
name: example
properties:
enabled: true
organizationsAccess: true
options:
dependsOn:
- ${example}
variables:
delegated:
fn::invoke:
function: aws:getCallerIdentity
arguments: {}
terraform {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
data "aws_caller_identity" "delegated" {
}
resource "aws_organizations_delegated_administrator" "example" {
lifecycle {
create_before_destroy = true
}
account_id = data.aws_caller_identity.delegated.account_id
service_principal = "ec2.capacitymanager.amazonaws.com"
}
resource "aws_ec2_capacity_manager" "example" {
depends_on = [aws_organizations_delegated_administrator.example]
lifecycle {
create_before_destroy = true
}
enabled = true
organizations_access = true
}
Create CapacityManager Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new CapacityManager(name: string, args: CapacityManagerArgs, opts?: CustomResourceOptions);@overload
def CapacityManager(resource_name: str,
args: CapacityManagerArgs,
opts: Optional[ResourceOptions] = None)
@overload
def CapacityManager(resource_name: str,
opts: Optional[ResourceOptions] = None,
enabled: Optional[bool] = None,
organizations_access: Optional[bool] = None,
region: Optional[str] = None)func NewCapacityManager(ctx *Context, name string, args CapacityManagerArgs, opts ...ResourceOption) (*CapacityManager, error)public CapacityManager(string name, CapacityManagerArgs args, CustomResourceOptions? opts = null)
public CapacityManager(String name, CapacityManagerArgs args)
public CapacityManager(String name, CapacityManagerArgs args, CustomResourceOptions options)
type: aws:ec2:CapacityManager
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "aws_ec2_capacity_manager" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args CapacityManagerArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args CapacityManagerArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args CapacityManagerArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args CapacityManagerArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args CapacityManagerArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var capacityManagerResource = new Aws.Ec2.CapacityManager("capacityManagerResource", new()
{
Enabled = false,
OrganizationsAccess = false,
Region = "string",
});
example, err := ec2.NewCapacityManager(ctx, "capacityManagerResource", &ec2.CapacityManagerArgs{
Enabled: pulumi.Bool(false),
OrganizationsAccess: pulumi.Bool(false),
Region: pulumi.String("string"),
})
resource "aws_ec2_capacity_manager" "capacityManagerResource" {
lifecycle {
create_before_destroy = true
}
enabled = false
organizations_access = false
region = "string"
}
var capacityManagerResource = new CapacityManager("capacityManagerResource", CapacityManagerArgs.builder()
.enabled(false)
.organizationsAccess(false)
.region("string")
.build());
capacity_manager_resource = aws.ec2.CapacityManager("capacityManagerResource",
enabled=False,
organizations_access=False,
region="string")
const capacityManagerResource = new aws.ec2.CapacityManager("capacityManagerResource", {
enabled: false,
organizationsAccess: false,
region: "string",
});
type: aws:ec2:CapacityManager
properties:
enabled: false
organizationsAccess: false
region: string
CapacityManager Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The CapacityManager resource accepts the following input properties:
- Enabled bool
- Whether to enable EC2 Capacity Manager for the account in the configured Region.
- Organizations
Access bool - Whether to enable cross-account data aggregation for AWS Organizations. Requires
enabledto betrue. Can only be enabled from the Organizations management account or a delegated administrator account. If not specified, AWS defaults this tofalsewhen Capacity Manager is enabled. Removing this argument does not disable Organizations access; set it tofalseexplicitly. - Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Enabled bool
- Whether to enable EC2 Capacity Manager for the account in the configured Region.
- Organizations
Access bool - Whether to enable cross-account data aggregation for AWS Organizations. Requires
enabledto betrue. Can only be enabled from the Organizations management account or a delegated administrator account. If not specified, AWS defaults this tofalsewhen Capacity Manager is enabled. Removing this argument does not disable Organizations access; set it tofalseexplicitly. - Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- enabled bool
- Whether to enable EC2 Capacity Manager for the account in the configured Region.
- organizations_
access bool - Whether to enable cross-account data aggregation for AWS Organizations. Requires
enabledto betrue. Can only be enabled from the Organizations management account or a delegated administrator account. If not specified, AWS defaults this tofalsewhen Capacity Manager is enabled. Removing this argument does not disable Organizations access; set it tofalseexplicitly. - region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- enabled Boolean
- Whether to enable EC2 Capacity Manager for the account in the configured Region.
- organizations
Access Boolean - Whether to enable cross-account data aggregation for AWS Organizations. Requires
enabledto betrue. Can only be enabled from the Organizations management account or a delegated administrator account. If not specified, AWS defaults this tofalsewhen Capacity Manager is enabled. Removing this argument does not disable Organizations access; set it tofalseexplicitly. - region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- enabled boolean
- Whether to enable EC2 Capacity Manager for the account in the configured Region.
- organizations
Access boolean - Whether to enable cross-account data aggregation for AWS Organizations. Requires
enabledto betrue. Can only be enabled from the Organizations management account or a delegated administrator account. If not specified, AWS defaults this tofalsewhen Capacity Manager is enabled. Removing this argument does not disable Organizations access; set it tofalseexplicitly. - region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- enabled bool
- Whether to enable EC2 Capacity Manager for the account in the configured Region.
- organizations_
access bool - Whether to enable cross-account data aggregation for AWS Organizations. Requires
enabledto betrue. Can only be enabled from the Organizations management account or a delegated administrator account. If not specified, AWS defaults this tofalsewhen Capacity Manager is enabled. Removing this argument does not disable Organizations access; set it tofalseexplicitly. - region str
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- enabled Boolean
- Whether to enable EC2 Capacity Manager for the account in the configured Region.
- organizations
Access Boolean - Whether to enable cross-account data aggregation for AWS Organizations. Requires
enabledto betrue. Can only be enabled from the Organizations management account or a delegated administrator account. If not specified, AWS defaults this tofalsewhen Capacity Manager is enabled. Removing this argument does not disable Organizations access; set it tofalseexplicitly. - region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
Outputs
All input properties are implicitly available as output properties. Additionally, the CapacityManager resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing CapacityManager Resource
Get an existing CapacityManager resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: CapacityManagerState, opts?: CustomResourceOptions): CapacityManager@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
enabled: Optional[bool] = None,
organizations_access: Optional[bool] = None,
region: Optional[str] = None) -> CapacityManagerfunc GetCapacityManager(ctx *Context, name string, id IDInput, state *CapacityManagerState, opts ...ResourceOption) (*CapacityManager, error)public static CapacityManager Get(string name, Input<string> id, CapacityManagerState? state, CustomResourceOptions? opts = null)public static CapacityManager get(String name, Output<String> id, CapacityManagerState state, CustomResourceOptions options)resources: _: type: aws:ec2:CapacityManager get: id: ${id}import {
to = aws_ec2_capacity_manager.example
id = "${id}"
}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Enabled bool
- Whether to enable EC2 Capacity Manager for the account in the configured Region.
- Organizations
Access bool - Whether to enable cross-account data aggregation for AWS Organizations. Requires
enabledto betrue. Can only be enabled from the Organizations management account or a delegated administrator account. If not specified, AWS defaults this tofalsewhen Capacity Manager is enabled. Removing this argument does not disable Organizations access; set it tofalseexplicitly. - Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Enabled bool
- Whether to enable EC2 Capacity Manager for the account in the configured Region.
- Organizations
Access bool - Whether to enable cross-account data aggregation for AWS Organizations. Requires
enabledto betrue. Can only be enabled from the Organizations management account or a delegated administrator account. If not specified, AWS defaults this tofalsewhen Capacity Manager is enabled. Removing this argument does not disable Organizations access; set it tofalseexplicitly. - Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- enabled bool
- Whether to enable EC2 Capacity Manager for the account in the configured Region.
- organizations_
access bool - Whether to enable cross-account data aggregation for AWS Organizations. Requires
enabledto betrue. Can only be enabled from the Organizations management account or a delegated administrator account. If not specified, AWS defaults this tofalsewhen Capacity Manager is enabled. Removing this argument does not disable Organizations access; set it tofalseexplicitly. - region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- enabled Boolean
- Whether to enable EC2 Capacity Manager for the account in the configured Region.
- organizations
Access Boolean - Whether to enable cross-account data aggregation for AWS Organizations. Requires
enabledto betrue. Can only be enabled from the Organizations management account or a delegated administrator account. If not specified, AWS defaults this tofalsewhen Capacity Manager is enabled. Removing this argument does not disable Organizations access; set it tofalseexplicitly. - region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- enabled boolean
- Whether to enable EC2 Capacity Manager for the account in the configured Region.
- organizations
Access boolean - Whether to enable cross-account data aggregation for AWS Organizations. Requires
enabledto betrue. Can only be enabled from the Organizations management account or a delegated administrator account. If not specified, AWS defaults this tofalsewhen Capacity Manager is enabled. Removing this argument does not disable Organizations access; set it tofalseexplicitly. - region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- enabled bool
- Whether to enable EC2 Capacity Manager for the account in the configured Region.
- organizations_
access bool - Whether to enable cross-account data aggregation for AWS Organizations. Requires
enabledto betrue. Can only be enabled from the Organizations management account or a delegated administrator account. If not specified, AWS defaults this tofalsewhen Capacity Manager is enabled. Removing this argument does not disable Organizations access; set it tofalseexplicitly. - region str
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- enabled Boolean
- Whether to enable EC2 Capacity Manager for the account in the configured Region.
- organizations
Access Boolean - Whether to enable cross-account data aggregation for AWS Organizations. Requires
enabledto betrue. Can only be enabled from the Organizations management account or a delegated administrator account. If not specified, AWS defaults this tofalsewhen Capacity Manager is enabled. Removing this argument does not disable Organizations access; set it tofalseexplicitly. - region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
Import
Identity Schema
Optional
accountId(String) AWS Account where this resource is managed.region(String) Region where this resource is managed.
Using pulumi import, import EC2 Capacity Manager settings using the region name. For example:
$ pulumi import aws:ec2/capacityManager:CapacityManager example us-west-2
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.
published on Friday, Nov 6, 2026 by Pulumi