Skip to content

Commit

Permalink
Added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
GavinZZ committed Feb 22, 2024
1 parent c96d3d9 commit 6d6240b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/aws-cdk-lib/aws-ec2/lib/nat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ export abstract class NatProvider {
*
* @see https://docs.aws.amazon.com/vpc/latest/userguide/VPC_NAT_Instance.html
*
* @deprecated use instanceV2
* @deprecated use instanceV2. 'instance' is deprecated since NatInstanceProvider
* uses a instance image that has reached EOL on Dec 31 2023
*/
public static instance(props: NatInstanceProps): NatInstanceProvider {
return new NatInstanceProvider(props);
Expand Down Expand Up @@ -290,7 +291,8 @@ class NatGatewayProvider extends NatProvider {
/**
* NAT provider which uses NAT Instances
*
* @deprecated use NatInstanceProviderV2
* @deprecated use NatInstanceProviderV2. NatInstanceProvider is deprecated since
* the instance image used has reached EOL on Dec 31 2023
*/
export class NatInstanceProvider extends NatProvider implements IConnectable {
private gateways: PrefSet<Instance> = new PrefSet<Instance>();
Expand All @@ -314,7 +316,7 @@ export class NatInstanceProvider extends NatProvider implements IConnectable {
(this.props.allowAllTraffic ?? true ? NatTrafficDirection.INBOUND_AND_OUTBOUND : NatTrafficDirection.OUTBOUND_ONLY);

// Create the NAT instances. They can share a security group and a Role.
const machineImage = this.props.machineImage || new NatInstanceImage();
const machineImage = this.props.machineImage ?? new NatInstanceImage();
this._securityGroup = this.props.securityGroup ?? new SecurityGroup(options.vpc, 'NatSecurityGroup', {
vpc: options.vpc,
description: 'Security Group for NAT instances',
Expand Down Expand Up @@ -444,7 +446,9 @@ export class NatInstanceProviderV2 extends NatProvider implements IConnectable {
const defaultDirection = this.props.defaultAllowedTraffic ??
(this.props.allowAllTraffic ?? true ? NatTrafficDirection.INBOUND_AND_OUTBOUND : NatTrafficDirection.OUTBOUND_ONLY);

// Create the NAT instances. They can share a security group and a Role.
// Create the NAT instances. They can share a security group and a Role. The new NAT instance created uses latest
// Amazon Linux 2023 image. This is important since the original NatInstanceProvider uses an instance image that has
// reached EOL on Dec 31 2023
const machineImage = this.props.machineImage || new AmazonLinuxImage({ generation: AmazonLinuxGeneration.AMAZON_LINUX_2023 });
this._securityGroup = this.props.securityGroup ?? new SecurityGroup(options.vpc, 'NatSecurityGroup', {
vpc: options.vpc,
Expand Down

0 comments on commit 6d6240b

Please sign in to comment.