Connection between Amazon Workspaces instances - amazon-workspaces

I'm having hard time to make Amazon Workspaces multiple instances to connect other.
Here is the detail. I created 2 workspaces, say instance A and instance B.
I just want to make sure if I can ping from A to B, but no luck.
Why can't I do such a very simple thing? Is there any configurations needed other than disabling firewall on the B?
Could you please, help me on this?

As every resource within a AWS VPC, WorkSpaces use security groups that are attached to the network interface. By default there are no inbound connections allowed at the security groups attached to a WorkSpaces, connectivity between resources without opening anything will never work.
You can add a security group with inbound rules to your WorkSpaces, but be careful with that! (look at the directory config which it is).
From: Security groups for your VPC
A security group acts as a virtual firewall for your instance to control inbound and outbound traffic.
When you create a new security group, it has no inbound rules.
Therefore, no inbound traffic originating from another host to your
instance is allowed until you add inbound rules to the security group.
From: Security Groups for Your WorkSpaces
You can add a default WorkSpaces security group to a directory. After you associate a new security group with a WorkSpaces directory, new WorkSpaces that you launch or existing WorkSpaces that you rebuild will have the new security group.
You can also add this new default security group to existing WorkSpaces without rebuilding them, as explained later in this topic.

Related

Purpose of stateless ACLs in gen2 VPC?

A newbie question on using subnet ACLs with IBM gen2 VPC.
I've an internet facing application which accepts inbound requests, as well as, makes outbound requests to the peer hosts. To enable this, I've to practically open all(>1024) inbound and outbound ports on my subnets.
I'm using IBM's security groups to firewall my VMs, but just curious why make the ACLs stateless, and force the user to open all ports? I certainly see the usage of subnet to subnet ACLs but I'm asking about in my particular use case.
Am I missing something here? Would you please recommend best practice?
Stateless network acls are common for cloud providers supplying VPC. If the remote IP ranges are not fixed it will not be possible to limit them further with acls. Same with the ports where in your example most port numbers will be valid except the non-ephemeral ports that you are not using (as you mention).
You can imagine more constrained use cases where acls would add another layer of security and associated reasoning about connectivity. Say you had a Direct Link from on premises to the cloud and the IP range could be constricted, etc.

Postgres pgAdmin: Unable to connect to server: timeout expired

I'm trying to connect a local Postgres server to an AWS RDS instance. When I enter in the credentials:
I keep getting an error: Unable to connect to server: timeout expired
I searched and it seems to be an issue with the security group. I did the following but it didn't work: https://serverfault.com/questions/656079/unable-to-connect-to-public-postgresql-rds-instance
Based on the comments. The issue was that publicly accessible option in the RDS settings was disabled.
Here is some suggestions/troubleshooting steps,you can follow:
Make sure that RDS is in available state an publicly accessible. RDS instance should associated with public subnet.
2.RDS should be associated with some security group. Check rules associated with security group so that it allows traffic related to the source in and out of the DB instance. You can specify an IP address or a range of IP addresses related to source.
3.Network ACLs. Network ACLs act as a firewall for resources in a specific subnet in a VPC. If you use ACLs in your VPC, be sure that they have rules that allow inbound and outbound traffic to and from the DB instance.
Check with your local firewall setup to determine if your network allows traffic to and from the ports the DB instance uses for inbound and outbound communication.
Please refer this page. This might help you.
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.Scenarios.html
Based on Jonnel Salvador Dorotan comment on this video https://www.youtube.com/watch?v=3HPq12w-dww I was able to get it to work. Here is his comment pasted:
"For those who are getting this error: "... Connection timed out (0x0000274C/10060)", these are what I did to solve the problem:
Go to "Security group rules" (under "Connectivity & security")
Click the item "default" Security group
Click "Actions" > "Edit inbound rules" > "Add rule"
Select... Type: "All traffic", Source: "My IP", then click "Save rules"
Set inbound rules in aws to accept all traffic, select My Ip then save
Go to Modify database in aws then select security group under Network & Security. Select the security group identifier from the dropdown.
I had this same issue. In my case, my home IP had changed, and I needed to adjust the Inbound Rule for "My IP" as described in Maxime's answer.
Addition to some of the above suggestions, make sure the Route Table attached to your public subnet:
has been set as main route table. To do this: go to VPC dashboard in AWS console >> Select "Route tables" option from the left link >> Select your route table >> From the "Actions" button click on "Set main route table" from the dropdown menu
has the route for the Internet Gateway that you're using in your VPC. You can check this on the "Routes" tab in the lower pane of your route table.
In the case of IPV6, try adding IPV6 ALL in the outbound rules as well.

Workspace Unhealthy After Changing Computer Name

We decided to move dev machines (PC's) into the cloud in the form of Amazon Workspaces. In simple terms, a provisioned workspace is very similar to a PC accessed via RDP. However, the scaffolding for the service assigns a 'unqiue' computer name to each workspace. We wanted to set a specific computer name and therefore we connected to the workspace and used the standard Windows technique of going into Properties on "This PC". Windows prompted to restart, which we did. Thereafter the workspace was unreachable from the Windows WorkSpaces client stating the status was Unhealthy. The WorkSpaces Management status was initially REBOOTING then PENDING. Finally it showed UNHEALTHY.
It is not unusual to want to change the computer name, particularly if modelling a current physical config into the cloud. However it looks like this derails / confuses the workspaces scaffolding.
Question: How to make the workspace reachable again, especially if much time investment has been made configuring it?
I shall provide the answer that solved the issue for me, which I leave for others hitting this issue and in the hope that it helps.
I found the basis of this answer in the Amazon Workspaces forum from the same question asked by JoeA in 2016. It took me a while to find - see the original post here. which I shall paraphrase following in case this precious link breaks in the future.
Amazon's answer was:
Changing the computer name on your WorkSpace will cause the PCoIP application to fail, so you won't be able to connect to it using the Amazon client.
To connect to the workspace, you can edit the security group associated with the workspace's ENI and allow TCP traffic on port 3389 so you can RDP into it.
Once you are connected to the WorkSpace, rename it back to the original name and reboot it and you should be able to connect again.
JoeA responded:
Thank you very much for your reply, there is hope! I'm a newbie with AWS and Workspaces. Can you provide more details, or point me to a document, on how to access the Workspace using RDP? I searched the forum, but no luck.
Specifically, I don't know how to "edit the security group associated with the workspace's ENI and allow TCP traffic on port 3389 so you can RDP into it" as you state. I did find under the "Directories" setting that my "Security Group" is set to "None selected". (FYI, I have only this one Workspace.) "Access to Internet" is set to "Enable", if that is a factor. Thanks.
JoeA then followed up with the solution which was, in his words:
The changes to open the port are under the EC2 console, not the Workspaces console where I was originally looking. I found the Security Group for Workspaces, and changed Inbound traffic to allow RDP (port 3389). Then also on the EC2 console, I found Network Interfaces that shows the public IP. (I first tried to RDP using the IP shown in Workspaces console properties ("WorkSpace IP"), but that must be a local IP inside that network.) RDP'ing to the public IP, I connected and put back the original machine name, restarted, and now I can connect again using the Workspaces client again.
Thanks JoeA for that good work.

How do I host my script in a Google Cloud server?

So I have created something small which is a image-rehost where I wish to use Python script where I have a URL such as https://i.imgur.com/VBPNX9p.jpg but with my rehost it would be
https://ip:port/abc123def456
so whenever I access that page it would give me the url that I posted here.
However the issue I am having is that I have no clue how to actually host the server that I made by node-js. Right now I just used the external IP with port of 5000. When I tried to send the image through my home ip by using the
https://external_ip:5000/abc123
the server doesn't recognize anything and nothing is being sent to the server which I in that case think I have setup something wrong.
I am using Google cloud server and I would wish to know how I can host my own server in the google cloud?
As you are having trouble adding a firewall rule, I'm going to suggest make sure port 5000 is open and not 8888.
To open the firewall rule for port 5000 in Google Cloud Platform follow these steps.
1) Navigate to VPC Network > Firewall rules > Create firewall rule.
2) In the 'Create a firewall rule' page, select these settings:
Name - choose a name for this firewall rule
Network - select the name of the network your instance belongs to, most probably
'default' unless you've configured a custom network.
Direction of traffic - 'Ingress'.
Action on match - 'Allow'.
Targets - 'All instances in the network'.
Source filter - 'IP ranges'.
Source IP ranges - '0.0.0.0/0'.
Second source filter - 'None'.
Specified protocols and ports - 'tcp:5000' or 'udp:5000' depending on whether the protocol you are using uses tcp or udp.
3) Hit 'Create'.
This will create a rule allowing traffic on port 5000 to all instances in your network from all IP address sources.
My advice would be to see if these settings work, and then once confirming this, lock down the settings by specifying a specific IP address or range of IP addresses in the 'Source IP ranges' text box, and adding a target tag to you instance and specifying 'Specified target tags' so the port is only open to the instance.
If this doesn't work, you may have a firewall rule turned on within the instance, which you would need to configure (or turn it off).
For more detailed information about setting firewall rules please see here.
For running Node.sj on GCE VM I will suggest you use the Bitnami Node.js package on GCP Marketplace which includes the latest version of Node.js, Apache, Python, and Redis. Using a pre-configured Node.js environment gets you up and running quickly because everything works out of the box. Manually configuring an environment can be a difficult and time-consuming hurdle to developing an application.
Also if you wish to do URL redirection you can use URL map feature provided with Google Cloud HTTP load balancer. This feature allows you to direct traffic to different instances based on the incoming URL. For example, you can send requests for http://www.example.com/audio to one backend service, which contains instances configured to deliver audio files, and requests for http://www.example.com/video to another backend service, which contains instances configured to deliver video files. You find steps to configure and more information here.

Edit Group Policy to turn off firewall using Powershell

I know I can use Set-NetFirewallProfile –Enabled False to turn off the firewall but if I restart the server, the firewall becomes enabled. The only thing that works if if I edit the local group policy (computer config -> admin templates -> network -> network connections -> windows firewall -> standard profile -> "Windows Firewall: Protect all network connections" set to Disabled).
Does anyone know how I can do the above steps in a Powershell command?
What I generally do is have a standalone DC just for creating group policies to apply to my images prior to domain join. You can create a GPO with the settings to off in the firewall, export it and apply it with localgpo.exe as a last step. that should overwrite any settings enabling it. then run NETSH ADVFIREWALL SET ALLPROFILES STATE OFF to disable the active profiles, and never turn the service off. It's should be named better, like Windows Firewall and Network Filter service or something. Lots of APIs in the windows env rely on it. Also, you could create domain policies on the target domain to override local settings as well, so if you want a template to have the FW on until domain join.
Remember
L S D O
::Order of policy application
Local
Site
Domain
OU
Microsoft LGPO Reference