class Accelerator (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.GlobalAccelerator.Accelerator |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsglobalaccelerator#Accelerator |
![]() | software.amazon.awscdk.services.globalaccelerator.Accelerator |
![]() | aws_cdk.aws_globalaccelerator.Accelerator |
![]() | aws-cdk-lib » aws_globalaccelerator » Accelerator |
Implements
IConstruct
, IDependable
, IResource
, IAccelerator
The Accelerator construct.
Example
// Create an Accelerator
const accelerator = new globalaccelerator.Accelerator(this, 'Accelerator');
// Create a Listener
const listener = accelerator.addListener('Listener', {
portRanges: [
{ fromPort: 80 },
{ fromPort: 443 },
],
});
// Import the Load Balancers
const nlb1 = elbv2.NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(this, 'NLB1', {
loadBalancerArn: 'arn:aws:elasticloadbalancing:us-west-2:111111111111:loadbalancer/app/my-load-balancer1/e16bef66805b',
});
const nlb2 = elbv2.NetworkLoadBalancer.fromNetworkLoadBalancerAttributes(this, 'NLB2', {
loadBalancerArn: 'arn:aws:elasticloadbalancing:ap-south-1:111111111111:loadbalancer/app/my-load-balancer2/5513dc2ea8a1',
});
// Add one EndpointGroup for each Region we are targeting
listener.addEndpointGroup('Group1', {
endpoints: [new ga_endpoints.NetworkLoadBalancerEndpoint(nlb1)],
});
listener.addEndpointGroup('Group2', {
// Imported load balancers automatically calculate their Region from the ARN.
// If you are load balancing to other resources, you must also pass a `region`
// parameter here.
endpoints: [new ga_endpoints.NetworkLoadBalancerEndpoint(nlb2)],
});
Initializer
new Accelerator(scope: Construct, id: string, props?: AcceleratorProps)
Parameters
- scope
Construct
- id
string
- props
Accelerator
Props
Construct Props
Name | Type | Description |
---|---|---|
accelerator | string | The name of the accelerator. |
enabled? | boolean | Indicates whether the accelerator is enabled. |
ip | Ip | The IP address type that an accelerator supports. |
ip | string[] | IP addresses associated with the accelerator. |
acceleratorName?
Type:
string
(optional, default: resource ID)
The name of the accelerator.
enabled?
Type:
boolean
(optional, default: true)
Indicates whether the accelerator is enabled.
ipAddressType?
Type:
Ip
(optional, default: "IPV4")
The IP address type that an accelerator supports.
For a standard accelerator, the value can be IPV4 or DUAL_STACK.
ipAddresses?
Type:
string[]
(optional, default: undefined. IP addresses will be from Amazon's pool of IP addresses.)
IP addresses associated with the accelerator.
Optionally, if you've added your own IP address pool to Global Accelerator (BYOIP), you can choose IP addresses from your own pool to use for the accelerator's static IP addresses when you create an accelerator. You can specify one or two addresses, separated by a comma. Do not include the /32 suffix.
Only one IP address from each of your IP address ranges can be used for each accelerator. If you specify only one IP address from your IP address range, Global Accelerator assigns a second static IP address for the accelerator from the AWS IP address pool.
Note that you can't update IP addresses for an existing accelerator. To change them, you must create a new accelerator with the new addresses.
Properties
Name | Type | Description |
---|---|---|
accelerator | string | The ARN of the accelerator. |
dns | string | The Domain Name System (DNS) name that Global Accelerator creates that points to your accelerator's static IP addresses. |
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
dual | string | The DNS name that points to the dual-stack accelerator's four static IP addresses: two IPv4 addresses and two IPv6 addresses. |
ipv4 | string[] | The array of IPv4 addresses in the IP address set. |
ipv6 | string[] | The array of IPv6 addresses in the IP address set. |
acceleratorArn
Type:
string
The ARN of the accelerator.
dnsName
Type:
string
The Domain Name System (DNS) name that Global Accelerator creates that points to your accelerator's static IP addresses.
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.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
dualStackDnsName?
Type:
string
(optional)
The DNS name that points to the dual-stack accelerator's four static IP addresses: two IPv4 addresses and two IPv6 addresses.
ipv4Addresses?
Type:
string[]
(optional)
The array of IPv4 addresses in the IP address set.
ipv6Addresses?
Type:
string[]
(optional)
The array of IPv6 addresses in the IP address set.
Methods
Name | Description |
---|---|
add | Add a listener to the accelerator. |
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | import from attributes. |
addListener(id, options)
public addListener(id: string, options: ListenerOptions): Listener
Parameters
- id
string
- options
Listener
Options
Returns
Add a listener to the accelerator.
applyRemovalPolicy(policy)
public 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
).
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
static fromAcceleratorAttributes(scope, id, attrs)
public static fromAcceleratorAttributes(scope: Construct, id: string, attrs: AcceleratorAttributes): IAccelerator
Parameters
- scope
Construct
- id
string
- attrs
Accelerator
Attributes
Returns
import from attributes.