> **Experimental**
>
> `@aws-cdk/aws-ec2-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# Ipam

Creates new IPAM with default public and private scope.

Extends: Construct › Resource › Ipam
Implements: IResource, IEnvironmentAware, IConstruct, IDependable

- Stability: [Experimental](/cdk/api/stability.html)
- CloudFormation: [`AWS::EC2::IPAM`](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-ec2-ipam.html)
- L1 type: [`CfnIPAM`](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.CfnIPAM.html)
- Source: [`lib/ipam.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0-alpha.0/packages/@aws-cdk/aws-ec2-alpha/lib/ipam.ts#L482)

## Example

```ts
const stack = new Stack();
const ipam = new Ipam(this, 'Ipam', {
  operatingRegions: ['us-west-1']
});
const ipamPublicPool = ipam.publicScope.addPool('PublicPoolA', {
  addressFamily: AddressFamily.IP_V6,
  awsService: AwsServiceName.EC2,
  locale: 'us-west-1',
  publicIpSource: IpamPoolPublicIpSource.AMAZON,
});
ipamPublicPool.provisionCidr('PublicPoolACidrA', { netmaskLength: 52 } );

const ipamPrivatePool = ipam.privateScope.addPool('PrivatePoolA', {
  addressFamily: AddressFamily.IP_V4,
});
ipamPrivatePool.provisionCidr('PrivatePoolACidrA', { netmaskLength: 8 } );

new VpcV2(this, 'Vpc', {
  primaryAddressBlock: IpAddresses.ipv4('10.0.0.0/24'),
  secondaryAddressBlocks: [
    IpAddresses.amazonProvidedIpv6({ cidrBlockName: 'AmazonIpv6' }),
    IpAddresses.ipv6Ipam({
      ipamPool: ipamPublicPool,
      netmaskLength: 52,
      cidrBlockName: 'ipv6Ipam',
    }),
    IpAddresses.ipv4Ipam({
      ipamPool: ipamPrivatePool,
      netmaskLength: 8,
      cidrBlockName: 'ipv4Ipam',
    }),
  ],
});
```

## Initializer

```ts
new Ipam(scope: Construct, id: string, props?: IpamProps)
```

## Construct Props

- `ipamName`: string — Name of IPAM that can be used for tagging resource.

  **Default:** If no name provided, no tags will be added to the IPAM

- `operatingRegions`: string[] — The operating Regions for an IPAM.

  **Default:** Stack.region if defined in the stack

  Operating Regions are AWS Regions where the IPAM is allowed to manage IP address CIDRs
  For more information about operating Regions, see [Create an IPAM](https://docs.aws.amazon.com//vpc/latest/ipam/create-ipam.html) in the *Amazon VPC IPAM User Guide* .

## Properties

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

- `ipamId`: string — Access to Ipam resource id that can be used later to add a custom private scope to this IPAM.

- `ipamName`: string — IPAM name to be used for tagging.

  **Default:** no tag specified

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `operatingRegions`: string[] — List of operating regions for IPAM.

- `privateScope`: [IIpamScopeBase](/cdk/api/v2/docs/@aws-cdk_aws-ec2-alpha.IIpamScopeBase.html) — Provides access to default private IPAM scope through add pool method.

  Usage: To add an Ipam Pool to a default private scope

- `PROPERTY_INJECTION_ID`: string (static) — Uniquely identifies this class.

- `publicScope`: [IIpamScopeBase](/cdk/api/v2/docs/@aws-cdk_aws-ec2-alpha.IIpamScopeBase.html) — Provides access to default public IPAM scope through add pool method.

  Usage: To add an Ipam Pool to a default public scope

- `scopes`: [IIpamScopeBase](/cdk/api/v2/docs/@aws-cdk_aws-ec2-alpha.IIpamScopeBase.html)[] — List of scopes created under this IPAM.

- `stack`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this resource is defined.

## Methods

- `addScope(scope: Construct, id: string, options: IpamScopeOptions): IIpamScopeBase` — Function to add custom scope to an existing IPAM Custom scopes can only be private.

- `applyCrossStackReferenceStrength(strength: ReferenceStrength): void` — Override the cross-stack reference strength for this resource.

  When set, any cross-stack reference to this resource will use the specified
  mechanism instead of the global default determined by the
  `@aws-cdk/core:defaultCrossStackReferences` context key. This is useful for
  selectively weakening specific references to avoid the "deadly embrace" problem
  without changing the app-wide default.

  **Parameters**

  - `strength` — - The reference strength to use for this resource.

- `applyRemovalPolicy(policy: RemovalPolicy): void` — Apply the given removal policy to this resource.

  The Removal Policy controls what happens to this resource when it stops
  being managed by CloudFormation, either because you've removed it from the
  CDK application or because you've made a change that requires the resource
  to be replaced.

  The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  Use this method instead of `instanceof` to properly detect `Construct`
  instances, even when the construct library is symlinked.

  Explanation: in JavaScript, multiple copies of the `constructs` library on
  disk are seen as independent, completely different libraries. As a
  consequence, the class `Construct` in each copy of the `constructs` library
  is seen as a different class, and an instance of one class will not test as
  `instanceof` the other class. `npm install` will not create installations
  like this, but users may manually symlink construct libraries together or
  use a monorepo tool: in those cases, multiple copies of the `constructs`
  library can be accidentally installed, and `instanceof` will behave
  unpredictably. It is safest to avoid using `instanceof`, and using
  this type-testing method instead.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `isOwnedResource(construct: IConstruct): boolean` (static) — Returns true if the construct was created by CDK, and false otherwise.

- `isResource(construct: IConstruct): boolean` (static) — Check whether the given construct is a Resource.

- `toString(): string` — Returns a string representation of this construct.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.
  Use multiple `with()` calls if subsequent mixins should apply to added
  constructs.
