class Ipam (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.ec2.Alpha.Ipam |
Go | github.com/aws/aws-cdk-go/awsec2alpha/v2#Ipam |
Java | software.amazon.awscdk.services.ec2.alpha.Ipam |
Python | aws_cdk.aws_ec2_alpha.Ipam |
TypeScript (source) | @aws-cdk/aws-ec2-alpha ยป Ipam |
Implements
IConstruct
, IDependable
, IResource
Creates new IPAM with default public and private scope.
See also: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ipamscope.html
Example
const stack = new Stack();
const ipam = new Ipam(this, 'Ipam', {
operatingRegion: ['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
new Ipam(scope: Construct, id: string, props?: IpamProps)
Parameters
Construct Props
Name | Type | Description |
---|---|---|
ipam | string | Name of IPAM that can be used for tagging resource. |
operating | string[] | The operating Regions for an IPAM. |
ipamName?
Type:
string
(optional, default: If no name provided, no tags will be added to the IPAM)
Name of IPAM that can be used for tagging resource.
operatingRegion?
Type:
string[]
(optional, default: Stack.region if defined in the stack)
The operating Regions for an IPAM.
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 in the Amazon VPC IPAM User Guide .
Properties
Name | Type | Description |
---|---|---|
env | Resource | The environment this resource belongs to. |
ipam | string | Access to Ipam resource id that can be used later to add a custom private scope to this IPAM. |
node | Node | The tree node. |
operating | string[] | List of operating regions for IPAM. |
private | IIpam | Provides access to default private IPAM scope through add pool method. |
public | IIpam | Provides access to default public IPAM scope through add pool method. |
scopes | IIpam [] | List of scopes created under this IPAM. |
stack | Stack | The stack in which this resource is defined. |
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
ipamId
Type:
string
Access to Ipam resource id that can be used later to add a custom private scope to this IPAM.
node
Type:
Node
The tree node.
operatingRegions
Type:
string[]
List of operating regions for IPAM.
privateScope
Type:
IIpam
Provides access to default private IPAM scope through add pool method.
Usage: To add an Ipam Pool to a default private scope
See also: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ipamscope.html
publicScope
Type:
IIpam
Provides access to default public IPAM scope through add pool method.
Usage: To add an Ipam Pool to a default public scope
See also: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-ipamscope.html
scopes
Type:
IIpam
[]
List of scopes created under this IPAM.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
add | Function to add custom scope to an existing IPAM Custom scopes can only be private. |
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
Scope(scope, id, options)
addpublic addScope(scope: Construct, id: string, options: IpamScopeOptions): IIpamScopeBase
Parameters
- scope
Construct
- id
string
- options
Ipam
Scope Options
Returns
Function to add custom scope to an existing IPAM Custom scopes can only be private.
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
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
).
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.