Skip to content

Commit

Permalink
fix: Disable public IP address for Linux, Windows, and RStudio when A…
Browse files Browse the repository at this point in the history
…ppStream is enabled(awslabs#731)
  • Loading branch information
nguyen102 authored Oct 6, 2021
1 parent e55f3be commit ed8f29d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Conditions:
IamPolicyEmpty: !Equals [!Ref IamPolicyDocument, '{}']
EgressStoreIamPolicyEmpty: !Equals [!Ref EgressStoreIamPolicyDocument, '{}']
AppStreamEnabled: !Equals [!Ref IsAppStreamEnabled, 'true']
AppStreamDisabled: !Equals [!Ref IsAppStreamEnabled, 'false']

Resources:
InstanceRolePermissionBoundary:
Expand Down Expand Up @@ -198,7 +199,7 @@ Resources:
Encrypted: true
KmsKeyId: !Ref EncryptionKeyArn
NetworkInterfaces:
- AssociatePublicIpAddress: 'true'
- AssociatePublicIpAddress: !If [ AppStreamEnabled, 'false', 'true' ]
DeviceIndex: '0'
GroupSet:
- !Ref SecurityGroup
Expand Down Expand Up @@ -230,6 +231,7 @@ Outputs:

Ec2WorkspacePublicIp:
Description: Public IP address of the EC2 workspace instance
Condition: AppStreamDisabled
Value: !GetAtt [EC2Instance, PublicIp]

Ec2WorkspaceInstanceId:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Conditions:
IamPolicyEmpty: !Equals [!Ref IamPolicyDocument, '{}']
EgressStoreIamPolicyEmpty: !Equals [!Ref EgressStoreIamPolicyDocument, '{}']
AppStreamEnabled: !Equals [!Ref IsAppStreamEnabled, 'true']
AppStreamDisabled: !Equals [!Ref IsAppStreamEnabled, 'false']

Resources:
InstanceRolePermissionBoundary:
Expand Down Expand Up @@ -212,7 +213,7 @@ Resources:
Encrypted: true
KmsKeyId: !Ref EncryptionKeyArn
NetworkInterfaces:
- AssociatePublicIpAddress: 'true'
- AssociatePublicIpAddress: !If [ AppStreamEnabled, 'false', 'true' ]
DeviceIndex: '0'
GroupSet:
- !Ref SecurityGroup
Expand Down Expand Up @@ -244,10 +245,11 @@ Outputs:

Ec2WorkspacePublicIp:
Description: Public IP address of the EC2 workspace instance
Condition: AppStreamDisabled
Value: !GetAtt [EC2Instance, PublicIp]

Ec2WorkspacePrivateIp:
Description: Public IP address of the EC2 workspace instance
Description: Private IP address of the EC2 workspace instance
Value: !GetAtt [EC2Instance, PrivateIp]

Ec2WorkspaceInstanceId:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Conditions:
IamPolicyEmpty: !Equals [!Ref IamPolicyDocument, '{}']
EgressStoreIamPolicyEmpty: !Equals [!Ref EgressStoreIamPolicyDocument, '{}']
AppStreamEnabled: !Equals [!Ref IsAppStreamEnabled, 'true']
AppStreamDisabled: !Equals [!Ref IsAppStreamEnabled, 'false']

Resources:
InstanceRolePermissionBoundary:
Expand Down Expand Up @@ -265,7 +266,7 @@ Resources:
KmsKeyId: !Ref EncryptionKeyArn
DeleteOnTermination: true
NetworkInterfaces:
- AssociatePublicIpAddress: true
- AssociatePublicIpAddress: !If [ AppStreamEnabled, 'false', 'true' ]
DeviceIndex: '0'
GroupSet:
- !Ref SecurityGroup
Expand Down Expand Up @@ -376,6 +377,7 @@ Outputs:
Ec2WorkspacePublicIp:
Description: Public IP address of the EC2 workspace instance
Condition: AppStreamDisabled
Value: !GetAtt [EC2Instance, PublicIp]
Ec2WorkspaceInstanceId:
Expand Down

0 comments on commit ed8f29d

Please sign in to comment.