Google
 

Wednesday, November 9, 2016

Nano Server on AWS: Step by Step

Windows server 2016 comes in many flavors. Nano server is the new addition that is optimized to be lightweight and with smaller attack surface. It has much less memory and disk footprint and much faster boot time than Windows Core and the full windows server. These characteristics make Nano a perfect OS for the cloud and similar scenarios.
However, being a headless (no GUI) OS means that no RDP connection can be made to administer the server. Also since only the very core bits are included by default means that configuring the server features is a different story than what we have in the full windows server.
In this post I'll explain how to launch and connect to a Nano instance on AWS. And then use the package management features to install IIS.

Launching an EC2 Nano server instance:

  • In the AWS console under the EC2 section, click "Launch Instance"
  • Select the "Microsoft Windows Server 2016 Base Nano" AMI.


  • In the "Choose an Instance Type" page, select "t2.nano" instance type. This instance type has 0.5GB of RAM. Yes! this will be more than enough for this experiment.
  • Use the default VPC and use the default 8GB storage.
  • In the "Configure Security Group" page things will start to be a bit different from the usual full windows server. Create a new security group and select these two inbound rules: 
    • WinRM-HTTP: Port 5985. This will be used for the remote administration.
    • HTTP: Port 80. To test IIS from our local browser.

  • Note that AWS console gives a warning regarding port 3389 which is used for RDP. We can safely ignore this rule as we'll use WinRM. RDP is not an option with Nano server.
  • Continue as usual and use an existing key pair or let AWS generate a new key pair to be used for windows password retrieval.

 

Connecting to the Nano server instance:

After the instance status becomes "running" and all status checks pass, observe the public IP of the instance. To manage this server, we'll use WinRM (Windows Remote Management) over HTTP. To be able to connect the machine, we need to add it to the trusted hosts as follows:
  • Open PowerShell in administrator mode
  • Enter the following commands to add the server : (assuming the public IP is 52.59.253.247)
$ip = "52.59.253.247"
Set-Item WSMan:\localhost\Client\TrustedHosts "$ip" -Concatenate -Force

Now we're ready to connect to the Nano server:
Enter-PSSession
-ComputerName $ip -Credential "~\Administrator"


PowerShell will ask for the password which you can retrieve from AWS console using the "Get Windows Password" menu option and uploading your key pair you saved on your local machine.

If everything goes well, all PowerShell commands you'll enter from now on will be executed on the remote server. So now let's reset the administrator password for the Nano instance:
$pass = ConvertTo-SecureString -String "MyNewPass" -AsPlainText -Force
Set-LocalUser -Name Administrator -Password $pass
Exit 

This will change the password and disconnect. To connect again, we can use the following commands and use the new password:
$session = New-PSSession -ComputerName $ip -Credential "~\Administrator"
Enter-PSSession $session



Installing IIS:

As Nano is a "Just Enough" OS. Feature binaries are not included by default. We'll use external package repositories to install other features like IIS, Containers, Clustering, etc. This is very similar to apt-get and yum tools in the Linux world and the windows alternative is OneGet. The NanoServerPackage repository has instructions regarding adding the Nano server package source which depends on the Nano server version. We know that the AWS AMI is based on the released version, but it doesn't harm to do a quick check:
Get-CimInstance win32_operatingsystem | Select-Object Version

The version in my case is 10.0.14393. So to install the provider, we'll run the following:
Save-Module -Path "$env:programfiles\WindowsPowerShell\Modules\" -Name NanoServerPackage -minimumVersion 1.0.1.0
Import-PackageProvider NanoServerPackage

Now let's explore the available packages using:
Find-NanoServerPackage
or the more generic command:
Find-Package -ProviderName NanoServerPackage


We'll find the highlighted IIS package. So let's install it and start the required services:
Install-Package -ProviderName NanoServerPackage -Name Microsoft-NanoServer-IIS-Package
Start-Service WAS
Start-Service W3SVC


Now let's point our browser to the IP address of the server. And here is our beloved IIS default page:


Uploading a basic HTML page:

Just for fun, create a basic HTML page on your local machine using your favorite tool and let's upload it and try accessing it. First enter the exit command to exit the remote management session and get back to the local computer. Note that in a previous step, we had the result of the New-PSSession in the $session variable so we'll use it to copy the HTML page to the remote server over the management session:
Copy-Item "C:\start.html"  -ToSession $session -Destination C:\inetpub\wwwroot\

Navigate to http://nanoserverip/start.html to verify the successful copy of the file.


Conclusion:

Nano server is a huge step forward to enable higher density of infrastructure and applications especially on the cloud. However it requires adopting a new mindset and a set of tools to get the best of it.
In this post I just scratched the surface of using Nano Server on AWS. In future posts we'll explore deploying applications on it to get real benefits.

70 comments:

Fletcher Bush said...

Thanks for your post. I tried to replicate unsucessfully. I did exactly as specified but still I could not connect to the server using WinRM.

The differences I noted were that I could not find the AMI with that id (ami-e4e61f8b) and could not find a 'Datacenter Edition' of Nano.

Hesham A. Amin said...

The AMI id differs from a region to another. The region I used is Frankfurt. and the image name was "Microsoft Windows Server 2016 Base Nano" with description: "Microsoft Windows 2016 Datacenter Edition Nano. [English]".

Anonymous said...

I followed your instructions but when attempting to connect to the Nano Server instance, I get the following error:

PS C:\> Enter-PSSession -ComputerName $ip -Credential "~\Administrator"
Enter-PSSession : Connecting to remote server xxx.xxx.xxx.xxx failed with the following error message : WinRM
cannot complete the operation. Verify that the specified computer name is valid, that the computer is
accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access
from this computer. By default, the WinRM firewall exception for public profiles limits access to remote
computers within the same local subnet. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ Enter-PSSession -ComputerName $ip -Credential "~\Administrator"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (xxx.xxx.xxx.xxx:String) [Enter-PSSession], PSRemotingTransportExc
eption
+ FullyQualifiedErrorId : CreateRemoteRunspaceFailed


I've checked it is in the trustedhosts.

PS C:\> Get-Item WSMan:\localhost\Client\TrustedHosts


WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Client

Type Name SourceOfValue Value
---- ---- ------------- -----
System.String TrustedHosts xxx.xxx.xxx.xxx

And PINGing the server results in timeout:

PS C:\> ping $ip

Pinging xxx.xxx.xxx.xxx with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for xxx.xxx.xxx.xxx:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

NOTE: I have masked my IP address in the statements above.

Hesham A. Amin said...

@Anonymous
These are some troubleshooting steps:
-Make sure you're using the public IP not the internal IP?
-try "telnet xxx.xxx.xxx.xxx 5985" and observe the result
-Double check your security group setting.
-Make sure the problem is not with your corporate firewall.

isabellaJoseph said...

I’m really impressed with your blog article, such great & useful knowledge you mentioned here.Thanks for sharing.Any course related details learn.. Dot Net Training in Chennai
Selenium Training in Chennai

Olivia Princess said...

Really a great addition. I have read this marvelous post.
hacking forum

sai venkat said...

The great service in this blog and the nice technology is visible in this blog. I am really very happy for the nice approach is visible in this blog and thank you very much for using the nice technology in this blog


Aws Online Training

Yasmin Priya said...

Hi, I have read your blog. Really very informative and excellent post I had ever seen about AWS. Thank you for sharing such a wonderful blog to our vision. Learn AWS Training in Bangalore to know more details about this technology. AWS Training in Chennai.

sai venkat said...

Nice blog has been shared by you. it will be really helpful to many peoples who are all working under the technology.thank you for sharing this blog.
Aws Online Training

Unknown said...

Not sure why anybody would even want to use IIS given a choice or IIS on a Nano Server but I would recommend just following the relatively clear and comprehensive AWS documentation.

Sorry to say there's nothing "great" or "marvelous" or a "great addition" about regurgitating some AWS material. I really wish people would reserve praise for praiseworthy contributions, not a copy-paste job.

rose said...

Appreciation for really being thoughtful and also for deciding on certain marvelous guides most people really want to be aware of.

Java Training in Bangalore|

ari kesavan said...

It’s great to come across a blog every once in a while that isn’t the same out of date rehashed material. Fantastic read.
I’ve bookmarked your site, and I’m adding your RSS feeds to my Google account.
java training in bangalore

mary Brown said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Training in Chennai. or learn thru ASP.NET Essential Training Online . Nowadays Dot Net has tons of job opportunities on various vertical industry.
or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry.

DAVIS MILLER said...

Your good knowledge and kindness in playing with all the pieces were
very useful. I don’t know what I would have done if I had not
encountered such a step like this.


AWS Training in Bangalore


AWS Training in Bangalore

suresh H said...

Great Article… I love to read your articles because your writing style is too good, it is very very helpful for all of us and I never get bored while reading your article because they are becomes a more and more interesting from the starting lines until the end.
Hadoop Training in Chennai
Big Data Training in Chennai

Joel Wong said...

Hi! Just leaving a comment on how great your website looks! It's an amazing mix of color and the content is great too! If you ever need to register a business, do let me know, we are the best singapore company incorporation provider, accounting company today!

Peshawar Air Services said...

where to get computer name

Hesham A. Amin said...

@Peshawar Air Services
I used the public IP address to connect to the instance. You can find it in the EC2 instance details in the AWS console.

SachinVarshan said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging
aws training in chennai
selenium training in chennai

UX Business Solutions said...

I'm trying to connect to a newly spun up AWS EC2 Windows Nano Server from my OS X machine. is it possible?

AWS Authorized Training Partner chennai

sri krishna kumar said...


Really usable post...thank u


Sap MM Training In Chennai | Mainframe Training In Chennai | Hadoop Training In Chennai

John Alert said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here.
Kindly keep blogging. If anyone wants to become a Java developer learn from Java EE Online Training from India.
or learn thru Java EE Online Training from India . Nowadays Java has tons of job opportunities on various vertical industry.

Anonymous said...

Nice information about test automation tools my sincere thanks for sharing post Please continue to share this post.

Weblogic Application Server training

Dissertation Writing Services said...

I read this article. I think You put a lot of effort to create this article. I appreciate your work.
Dissertation Writing Services

PLC Training Chennai said...

PLC Training in Chennai | PLC Training Institute in Chennai | PLC Training Center in Chennai | PLC SCADA Training in Chennai | PLC SCADA DCS Training in Chennai | Best PLC Training in Chennai | Best PLC Training Institute in Chennai | PLC Training Centre in Chennai | Embedded System Training in Chennai | Embedded Training in Chennai | VLSI Training in Chennai | VLSI Training Institute in Chennai

PLC Training Chennai said...

PLC Training in Chennai | PLC Training Institute in Chennai | PLC Training Center in Chennai | PLC SCADA Training in Chennai | PLC SCADA DCS Training in Chennai | Best PLC Training in Chennai | Best PLC Training Institute in Chennai | PLC Training Centre in Chennai | PLC SCADA Training in Chennai | Automation Training Institute in Chennai | PLC Training in Kerala

Embedded Systems Course in Chennai said...

Embedded Training in Chennai | Best Embedded Training in Chennai | Embedded System Training in Chennai | Embedded System Training Institute in Chennai | Best Embedded System Training Institute in Chennai | Embedded Course in Chennai | Embedded System Training Institutes in Chennai | Embedded System Training Center in Chennai | Best Embedded System Training in Chennai | Embedded Systems Training in Chennai | VLSI Training in Chennai | VLSI Training Institute in Chennai

VLSI Training Chennai said...

VLSI Training in Chennai | Best VLSI Training in Chennai | VLSI Training Centres in Chennai | VLSI Courses in Chennai | VLSI Training Courses in Chennai | VLSI Training Institute in Chennai | VLSI Training Institutes in Chennai | Best VLSI Training Institute in Chennai

shabaz r said...

Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating

aws training in chennai

shabaz r said...

Appreciation for really being thoughtful and also for deciding on certain marvelous guides most people really want to be aware of.

aws training in chennai

Lathika Honey said...

This Blog Provides Very Useful and great Information. United States Medical Licensing Examination Thanks for sharing.

aravinth periyaswami said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as

aws training in chennai

selenium training in chennai

for IT the said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Training in Chennai. or learn thru Dot Net Training in Chennai. Nowadays Dot Net has tons of job opportunities on various vertical industry.
or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry.

john jersy said...

Hey, would you mind if I share your blog with my twitter group? There’s a lot of folks that I think would enjoy your content. Please let me know. Thank you.
Click here:
Microsoft azure training in chennai
Click here:
angularjs6 Training in Chennai
Click here:
angularjs Training in online

sai said...

I prefer to study this kind of material. Nicely written information in this post, the quality of content is fine and the conclusion is lovely. Things are very open and intensely clear explanation of issues
Click here:
Microsoft azure training in chennai
Click here:
Microsoft azure training in online
Click here:
Microsoft azure training in tambaram
Click here:
Microsoft azure training in chennai
Click here:
Microsoft azure training in annanagar

ummi ari said...

Awesome..You have clearly explained …Its very useful for me to know about new things..Keep on blogging..
Blueprism training in Chennai

Blueprism training in Bangalore

Blueprism training in Pune

Blueprism online training

Blueprism training in tambaram

johnsy sai said...

Thanks you for sharing this unique useful information content with us. Really awesome work. keep on blogging

DevOps online Training|DevOps Training in USA
Devops Training in Chennai

Devops Training in Bangalore

Deepika Analy said...

Great work. Quite a useful post, I learned some new points here.I wish you luck as you continue to follow that passion.

AWS Training
AWS Training in Chennai

geetha sridhar said...

Well done! Pleasant post! This truly helps me to discover the solutions for my inquiry. Trusting, that you will keep posting articles having heaps of valuable data. You're the best! 
Data Science course in kalyan nagar | Data Science course in OMR
Data Science course in chennai | Data science course in velachery
Data science course in jaya nagar | Data science training in tambaram

sudha P said...

Its really an Excellent post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog. Thanks for sharing....
java training in annanagar | java training in chennai

java training in chennai | java training in electronic city

Surendra SriyaEdu said...

Amazon has a simple web services interface that you can use to store and retrieve any amount of data, at any time, from anywhere on the web. Amazon Web Services (AWS) is a secure cloud services platform, offering compute power, database storage, content delivery and other functionality to help businesses scale and grow.For more information visit.
aws online training | aws training in hyderabad | aws online training in hyderabad

Anonymous said...

You got an extremely helpful website I actually have been here reading for regarding an hour. I’m an initiate and your success is incredibly a lot of a concept on behalf of me.

angularjs online Training

angularjs Training in marathahalli

angularjs interview questions and answers

angularjs Training in bangalore

angularjs Training in bangalore

angularjs online Training

Anbarasan14 said...

Thanks for sharing a worthy information. This is really helpful. Keep doing more.

Spoken English Institutes in Bangalore
Spoken English Coaching Classes near me
English Speaking Classes in Bangalore
Spoken English Training Institute in Bangalore
Best Spoken English Coaching in Bangalore
English Speaking Course in Bangalore
English Spoking Coaching in Bangalore

yuva rani said...

This information is impressive. I am inspired with your post writing style & how continuously you describe this topic. Eagerly waiting for your new blog keep doing more.
ccna Course in Bangalor
ccna Training in Bangalore
Best ccna Institute in Bangalore
ccna Institute in Bangalore
cloud computing training institutes in bangalore
best cloud computing training in bangalore
cloud computing certification in bangalore

Praylin S said...

Hey! Your article is well researched and well executed. Your articles are helping me out in various ways. keep updating. Looking forward for more posts from you.
Javascript Training in Chennai | Javascript Training Institute in Chennai | Javascript Training Courses | Javascript Course in Chennai

Safety Professionals said...

This is an awesome post. Really very informative and creative contents. These concept is a good way to enhance the knowledge.
fire and safety course in chennai

gp007 said...

You won't believe me, but I was planning to write a blog very similar to the one you have posted here. Great work!

AWS Training In Chennai

Hadoop Training In Chennai

Muralidhara Raju Indukuri said...

Complete aws training in hyderabad from top institutes.

brindhaajay said...

To be honest this is an really useful blog for this technology. Many people would get useful information
about this technology and will be interested inb doing this course. Thanks for posting it.
Software testing course in coimbatore
English speaking course
spoken english classes
spoken english course

jefrin adams said...

Impressive to read the post
best azure certification training in chennai

Priya Rajesh said...

Thanks for sharing this information admin, it helps me to learn new things. Continue sharing more like this.
Azure Training in Chennai
Microsoft Azure Training in Chennai
R Training in Chennai
R Programming Training in Chennai
Data Science Training in Chennai
Data Science course in Chennai
RPA Training in Chennai
Azure Training in Velachery
Azure Training in Tambaram

Lucky Patcher said...

whatsapp group links

Praylin S said...
This comment has been removed by the author.
Vicky Ram said...

Awesome post. Really you are shared very informative concept... Thank you for sharing. Keep on
updating...

linuxhacks
Education

Vicky Ram said...

Excellent post! keep sharing such a post

Article submission sites
Technology

Praylin S said...

Wonderful blog with great piece of information. I've been following your blogs for a while and I'm really impressed by your works. Keep sharing more such blogs.
IoT Training in Chennai
IoT Courses in Chennai
Tally Course in Chennai
Tally Classes in Chennai
Embedded System Course Chennai
Embedded Training in Chennai
IoT Training in Porur
IoT Training in Adyar

Saurav Singh said...

Thanks for such a great article here. I was searching for something like this for quite a long time and at last, I’ve found it on your blog. It was definitely interesting for me to read about their market situation nowadays.
AWS Training in Gurgaon

Aruna Ram said...

I think this is one of the best posts on this topic. I am very happy to see your amazing post and thank you for your sharing with us. I like a more advanced level of information from your post and please keep it up...
SAS Training in Chennai
SAS Course in Chennai
Social Media Marketing Courses in Chennai
Tableau Training in Chennai
Html5 Training in Chennai
Node JS Training in Chennai
Informatica Training in Chennai
SAS Training in Adyar
SAS Training in Velachery

pavithra dass said...

Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information.
Java Training in Chennai
Java course in Chennai
Software Testing Training in Chennai
Web Designing Course in chennai
PHP Training in Chennai
Java Training in Tambaram

Kayal m said...

I got more info from your attractive post!!! I am very inspired by your explanation method and this post is very easily understanding to readers. Please continuing...
Excel Training in Chennai
Advanced Excel Training in Chennai
Excel Course in Chennai
Pega Training in Chennai
Oracle DBA Training in Chennai
Unix Training in Chennai
Excel Training in Chennai
Advanced Excel Training in Chennai

ajay prakash said...

Very nice blog, Thank you for providing good information.
Aviation Academy in Chennai
Air hostess training in Chennai
Airport management courses in Chennai
Ground staff training in Chennai
aviation training in chennai
cabin crew training institute in chennai
airlines training chennai
airport ground staff training in chennai

cynthia williams said...

Great, this article is quite awesome and I have bookmarked this page for my future reference. Keep blogging like this with the latest info.
DevOps course in Chennai
Best DevOps Training in Chennai
AWS Training in Chennai
AWS Certification in Chennai
Cloud Computing Courses in Chennai
Cloud Training in chennai
AWS Training in OMR
DevOps Training in Chennai

sasireka said...

I appreciate that you produced this wonderful article to help us get more knowledge about this topic. I know, it is not an easy task to write such a big article in one day, I've tried that and I've failed. But, here you are, trying the big task and finishing it off and getting good comments and ratings. That is one hell of a job done!

informatica mdm online training

apache spark online training

angularjs online training

devops online training

aws online training

priya said...

I was recommended this web site by means of my cousin. I am now not certain whether this post is written through him as nobody else recognise such precise about my difficulty. You're amazing! Thank you!
Microsoft Azure online training
Selenium online training
Java online training
Python online training
uipath online training

Sai Elakiyaa said...

Worth for my valuable time, I am very much satisfied with your blog. Thanks for sharing.

RPA Training in Chennai
Java Training in Chennai
Spoken English Classes in Chennai
Best Spoken English Class in Chennai
English Coaching Classes in Chennai

janakikrishnan said...

Very nice blog. The contents are valuable. Do well and Keep going.
AWS Training in Bangalore
AWS Course in Bangalore
Best AWS Training in Bangalore
AWS Training Institutes in Bangalore
AWS Certification Training in Bangalore
AWS Training Center in Bangalore

janakikrishnan said...

Blog taught the things that freshers need to know. Thank you and keep going.

Embedded Course in Coimbatore.
Embedded Training Institute in Coimbatore.
Embedded Training in Coimbatore
Best Embedded Training Institute in Coimbatore
Embedded Systems Course in Coimbatore
Embedded Systems Training in Coimbatore

sellakumar said...

Thank you for the informative post about Security challenges in AWS , Found it useful . cloud migration services have now become secured and with no-risk

cloud migration services

aws cloud migration services

Ramya Krishnan said...

This is the exact information I am been searching for, Thanks for sharing the required infos with the clear update and required points. To appreciate this I like to share some useful information regarding Microsoft Azure which is latest and newest,

Regards,
Ramya

Azure Training in Chennai
Azure Training Center in Chennai
Best Azure Training in Chennai
Azure Devops Training in Chenna
Azure Training Institute in Chennai
Azure Training in Chennai OMR
Azure Training in Chennai Velachery
Azure Online Training
Azure Training in Chennai Credo Systemz
DevOps Training in Chennai Credo Systemz
Best Cloud Computing Service Providers

IT Tutorials said...

Really useful information. Thank you so much for sharing.It will help everyone.Keep Post. RPA training in chennai | RPA training in Chennai with placement | UiPath training in Chennai | UiPath certification in Chennai with cost