<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rob Patton on Medium]]></title>
        <description><![CDATA[Stories by Rob Patton on Medium]]></description>
        <link>https://medium.com/@robpatton_2196?source=rss-4cb1b26c4f56------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*M2DjdjJ0xh0Hj6Ob58JQfQ.png</url>
            <title>Stories by Rob Patton on Medium</title>
            <link>https://medium.com/@robpatton_2196?source=rss-4cb1b26c4f56------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 22:52:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@robpatton_2196/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Creating a GitHub Action Workflow to Publish NuGet Packages]]></title>
            <link>https://medium.com/@robpatton_2196/creating-a-github-action-workflow-to-publish-nuget-packages-13c10b75833c?source=rss-4cb1b26c4f56------2</link>
            <guid isPermaLink="false">https://medium.com/p/13c10b75833c</guid>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[nuget]]></category>
            <dc:creator><![CDATA[Rob Patton]]></dc:creator>
            <pubDate>Fri, 06 Dec 2024 14:09:30 GMT</pubDate>
            <atom:updated>2024-12-06T14:33:54.539Z</atom:updated>
            <content:encoded><![CDATA[<p>The title pretty much says it all, but I’ll add that this is intended to be brief as well as written versus video so you can skim for what might help you.</p><h3>Use Case:</h3><p>You have a .Net project which you build, package and publish to a NuGet Gallery just fine from your development machine using the CLI or IDE tooling, but you want to have the packaging and publishing handled by GitHub instead.</p><h3>Assumptions:</h3><ul><li>The specific trigger used here is when you use the “release” functionality in GitHub, but it should be fairly straightforward to repurpose for other triggers and I will note what needs to be looked at for that</li><li>The NuGet gallery I use is within GitHub itself, with authentication handled via token, but again it should be trivial to repurpose for nuget.org or something else</li><li>This example uses a single branch, “main” (though the name is irrelevant for this)</li></ul><h3>Skip to the YAML File…</h3><p>The following shows the contents of the file &lt;repo root&gt;/.github/workflows/nuget.yaml</p><pre>name: &quot;Publish to NuGet Gallery&quot;<br><br>on: <br>  release:<br>    types: [published]<br><br>env:<br>  PROJECT_PATH: &lt;Path to your csproj file&gt;<br>  PACKAGE_OUTPUT_DIRECTORY: ${{ github.workspace }}/output<br>  NUGET_SOURCE_URL: &quot;&#39;https://nuget.pkg.github.com/&lt;GH Team&gt;/index.json&#39;&quot;<br><br>jobs:<br>  publish:<br>    name: &quot;Publish to NuGet Gallery&quot;<br>    runs-on: &quot;windows-latest&quot;<br>    steps:<br>      - name: &quot;Checkout&quot;<br>        uses: actions/checkout@v4<br>        <br>      - name: &quot;Install Dotnet&quot;<br>        uses: actions/setup-dotnet@v4<br>        with:<br>          dotnet-version: &quot;9.0.x&quot;<br>          <br>      - name: &quot;Restore packages&quot;<br>        run: dotnet restore ${{ env.PROJECT_PATH }}<br>        <br>      - name: &quot;Build project&quot;<br>        run: dotnet build ${{ env.PROJECT_PATH }} --no-restore --configuration Release<br>        <br>      - name: &quot;Pack project&quot;<br>        run: dotnet pack ${{ env.PROJECT_PATH }} -p:PackageVersion=${{ github.event.release.name }} --no-restore --no-build --configuration Release --include-symbols --output ${{ env.PACKAGE_OUTPUT_DIRECTORY }}<br><br>      - name:  &quot;Push package&quot;<br>        run: dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIRECTORY }}/&lt;Solution Name&gt;.${{ github.event.release.name }}.nupkg -s ${{ env.NUGET_SOURCE_URL }} -k ${{ secrets.NUGET_AUTH_TOKEN }}</pre><h3>What You Need to Edit …</h3><p>Some of the script is specific to the solution, project and environment so I’ll note that here:</p><ul><li>The environment variable PROJECT_PATH should point to your csproj file. The root is assumed to be the root of Git repository, so you don’t need to know anything else such as where GitHub is actually putting your files after checkout etc. In my case, my repo on my local disk is in ~/Documents/Repositories/MyLibraryRepo and my project is in ~/Documents/Repositories/MyLibraryRepo/src/MyProject/MyProject.csproj so I have PROJECT_PATH=src/MyProject/MyProject.csproj</li><li>The environment variable NUGET_SOURCE_URL should be set to the URL of … your gallery. Wrapped in single-quotes, because it will be passed on the command line. Here I am using a GitHub gallery, replace with your own.</li><li>The “Push package” step has a reference to the file for the NuGet package, the assumption here is that the file is named after your solution, thus &lt;solution name&gt;.</li><li>The “Push package” step given has the option to supply a token for authentication, the “-k” near the end. I’m using a GitHub secret to store the token value, specifically a “Repository” secret named NUGET_AUTH_TOKEN. You can rework this how you like, but I strongly suggest you use a secret for this value.</li></ul><h3>Versioning &amp; the Release Trigger</h3><p>The workflow picks up the version for the NuGet package from the name of the GitHub “release”. This assumes the release is named using a convention which is usable without manipulation, so “0.7.9” and not “v0.7.9”. In my case, I will name the release with a semantic version, and create a tag for it with the prefixed ‘v’ during the release process. There are many different ways you could manage the version, adjust this to meet your needs.</p><p>Note the dependencies on the version in the package and push steps. The version is assigned in the package step using the “-p:PackageVersion” option, and is used during the push step to construct the expected file name.</p><p>If you need to use a different trigger other than release, it is easy to adjust the trigger itself. For example you can tie it to a push to the main branch, or a “release” branch depending on your approach. You will have to get the version number some other way. For myself, I landed on using release because every other way I looked at doing it seemed goofy at best, violating the KISS principle.</p><h3>What a drag it is getting old</h3><p>This job relies on very little, just a couple actions maintained by GitHub and the dotnet CLI so there isn’t much which should age out. Check for the most recent version of the actions, watch the dotnet version you want to use, that’s about it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13c10b75833c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using AWS SAM with .NET Core, Part 1: AWS Toolkit for Visual Studio vs. SAM]]></title>
            <link>https://medium.com/@robpatton_2196/using-aws-sam-with-net-core-part-1-aws-toolkit-for-visual-studio-vs-sam-3525e99bc3c2?source=rss-4cb1b26c4f56------2</link>
            <guid isPermaLink="false">https://medium.com/p/3525e99bc3c2</guid>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[sam]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Rob Patton]]></dc:creator>
            <pubDate>Tue, 24 Aug 2021 00:14:31 GMT</pubDate>
            <atom:updated>2021-08-29T15:56:41.426Z</atom:updated>
            <content:encoded><![CDATA[<h3>Using AWS SAM with .NET Core</h3><h4>Part 1: Why SAM at the Command Line is Better than the AWS Toolkit for Visual Studio</h4><h4>Context</h4><p>Hi! I’m starting a series of articles on using the AWS Serverless Application Model (SAM) for deployment of .NET Core applications in AWS. A few hints as to the context:<br>* This was written in August, 2021<br>* .NET Core 3.1<br>* AWS environment with multiple accounts and multiple VPC’s per account<br>* No CI/CD pipeline, this is aimed at early stage automation of build/deploy</p><h4>Topic</h4><p>.NET developers have several choices of build and deploy toolsets when it comes to developing for a serverless environment in AWS:</p><p>1 VS Code + the AWS CLI<br>2 Visual Studio + the AWS Toolkit for Visual Studio<br>3 Visual Studio + SAM at the Command Line<br>4 Jet Brains tooling, other 3rd party IDE’s</p><p>For this specific article we are focused on options 2 and 3, due to the more prevalent usage in corporate/enterprise environments. Due to how SAM itself works, the bulk of this series will be focused on content that is applicable across all scenarios.</p><p>This very brief discussion of tooling is an intro to the broader subject of using SAM for .NET Core</p><h4>Visual Studio + the AWS Toolkit for Visual Studio</h4><p><strong>Pros:</strong> The toolkit is visually integrated with Visual Studio and is very easy to install and get running with. I think the AWS dev team did an outstanding job of making AWS usage at a basic level fit right into VS. You can see your resources, you can deploy to them, all with a click or two. The VS templates included make it work pretty much out of the box for simple applications.</p><p><strong>Cons:</strong> The challenge comes when you have a “real” AWS environment, with multiple accounts, VPC’s, sets of SSM parameters, Secrets, etc. Here the toolkit falls short, I suspect because it is trying to make SAM even easier than it already is. It does not allow for deploying to multiple environments with different configurations.</p><p>The toolkit hits a valid need — developers new to AWS just doing a proof of concept and trying to get up and running in that type of environment ASAP. But it fails at handling that real environment (and yes, CI/CD etc. would address this but then we don’t need the toolkit anyway)</p><p>Example: The Toolkit’s “Publish to Lambda” does not have a way to select a particular configuration to feed account X’s parameter values into the SAM template.</p><p>Finally, a head’s up: the toolkit does use SAM under the covers, but it takes away the flexibility.</p><h4>Visual Studio + SAM at the Command Line</h4><p><strong>Pros:</strong> SAM as a <em>command line tool</em> is pretty great for building and deploying. The tool itself accommodates multiple environments, a single pair of files to maintain, and as a command line interface the calls to it are easily scriptable within the context of a broader build and deploy process. In brief, you write two configuration templates per deployable unit, and you get automated build and deployment steps for as many environments as you have. Basically, a template for how to deploy to environment X, then a template that supplies environment-specific values for X (Dev, QA, Prod etc.). This means you have a fully automated, reviewable and reproducible deployment across all of your environments.</p><p>These two templates are:<br>* <em>template.yaml </em>which is the file declaring the resources being built and deployed<br>* <em>samconfig.toml</em> which is the file supplying global and environment specific parameters to the above template</p><p>Note: You can change the names of the files, what I show is what I’ve standardized on with my team.</p><p><strong>Cons: </strong>Using SAM at the command line requires… dropping down to the command line outside of the IDE. You’re out of the VS environment, because Microsoft doesn’t see a need to incorporate a terminal in their IDE. This is some astounding weaksauce from the Visual Studio team, but ultimately not much of a con.</p><h4>My Take</h4><p>Probably obvious already. <strong>SAM at the command line is the way to go</strong>. I would not even get started using the AWS Toolkit for Visual Studio, it will lead you into poor practices with your SAM templates. For example, incorrect file extensions (so syntax checking and highlighting don’t apply) and maintaining a template per environment. If you’re doing a prototype to show the value of AWS in a .NET environment for your boss, sure, use the toolkit and save a few days of learning SAM in a real environment. If you’re leading a team developing or re-architecting a platform for AWS — use SAM at the command line to get rolling until you have time to sort out the CI/CD tooling available.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3525e99bc3c2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Guide to Setting up an Amazon Linux 2 VM on MacOS with VirtualBox]]></title>
            <link>https://medium.com/@robpatton_2196/guide-to-setting-up-an-amazon-linux-2-vm-on-macos-with-virtualbox-45d25a70f6d5?source=rss-4cb1b26c4f56------2</link>
            <guid isPermaLink="false">https://medium.com/p/45d25a70f6d5</guid>
            <category><![CDATA[virtualbox]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Rob Patton]]></dc:creator>
            <pubDate>Sun, 05 Jan 2020 04:49:41 GMT</pubDate>
            <atom:updated>2020-01-05T04:49:41.969Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*vCaiioqlGfDdI_022NWdXA.png" /><figcaption>The end goal: ssh’d in to a local VM running Amazon Linux 2</figcaption></figure><p>I needed to run Amazon’s Linux distribution locally in order to work on administrative scripts while off the corporate network and at times not on any network at all. My challenges were:</p><ul><li>I’m not familiar with VirtualBox or any of the other options for playing VMs locally</li><li>The online documentation for getting the OS running this way was vague enough to only get me 80% of the way to the goal. Blog posts, Reddit etc., they all assume bits of knowledge that I didn’t have, and in some cases had frustrating mistakes in their posted solution code.</li></ul><p>What follows is a configuration process that works for me, an attempt to present a more complete process for the whole effort along with config files that are correctly formatted. This is functional as of January 1st, 2020 and I have tested the full process using copy and paste from this guide so I’m fairly confident that I didn’t introduce a typo that wastes anyone’s time. So to get started…</p><h4><strong>End Result of This Guide</strong></h4><p>A local virtual machine running Amazon Linux that has the same network access as the host machine, and can be connected to from the host via ssh.</p><h4><strong>Assumptions</strong></h4><ul><li>You’re running on MacOS 10.14.x (I have not tested any higher versions, but I suspect this will generally work on any modern MacOS)</li><li>You have installed <a href="https://www.virtualbox.org/">Oracle VirtualBox</a> (I tested on v6.1)</li><li>You want your VM to have access to the same networks that your host machine can access, and you want to be able to use network clients on your host machine to connect to the VM</li><li>You do <strong>not</strong> need to assign a static IP to your VM</li><li>You are ok with using password authentication for the ssh connection</li><li>You will initially set up the VM with only a root account, then add additional accounts as needed</li><li>Your host machine uses wifi for networking. This is an assumption, but if you use a wired connection I think you can adjust very simply.</li></ul><h4>Step 1: Set Up Your Folder Structure and Download the Image</h4><p>This is my take on how to set up the structure to hold your virtual machines and related files, but the details are not critical to the end result. Meaning: feel free to diverge if you prefer a different structure, or have an existing structure.</p><p>Create a root directory for your virtual machines, then sub-directories for configuration and actual VM’s. For our purposes, this will look like:<br>~/VirtualMachines/<br>~/VirtualMachines/AmazonLinux2Config/<br>~/VirtualMachines/AmazonLinux2Config/seedconfig/<br>~/VirtualMachines/AmazonLinux2VMs/</p><p>The AmazonLinux2Config directory will hold the original copy of the Amazon Linux 2 image and the initial configuration files to set up that image.</p><p>To that end, now download the image appropriate for VirtualBox and save / move it to the ~/VirtualMachines/AmazonLinux2Config/ directory. Open the <a href="https://cdn.amazonlinux.com/os-images/latest/virtualbox/">download location</a> and download the obviously large file ending in .vdi into the target directory.</p><h4>Step 2: Understand (Enough) and Create the Configuration Files</h4><p>There are two very simple and brief configuration files that you will need to use. These are only used during the first startup of the new VM, and what I present here is how to get you to VM #1. There is a minor tweak to get you to additional VMs, which I will explain at the end (basically, just change a host name variable). Think of these files and the resulting ISO file (next section) as sending parameters to the new VM as it configures itself for the first time.</p><p><strong>user-data File</strong><br>There is a user-data file (that should be the exact name) which contains the user accounts which will be created in the new VM. In this case we will just create the root user and set a password for it. Open a text editor which is Linux friendly (line endings with \n or linefeed). I use SublimeText. Then:</p><ol><li>Open a new file</li><li>Paste in the text below these steps</li><li>Edit the text “SET-YOUR-OWN-PASSWORD” to be the password for the root account</li><li>Save the file as “user-data” into ~/VirtualMachines/AmazonLinux2Config/seedconfig/</li></ol><pre>#cloud-config<br>#vim:syntax=yaml<br>users:<br># A user by the name `ec2-user` is created in the image by default.<br>  - default<br>chpasswd:<br>  list: |<br>    ec2-user:SET-YOUR-OWN-PASSWORD<br># In the above line, DO NOT add any spaces after &#39;ec2-user:&#39;.<br># Do not add any comments above the first line given here</pre><p><strong>meta-data File</strong></p><p>There is a meta-data file (that should be the exact name) which contains some basic network configuration for the new VM. In this case we will use DHCP to set up the key configuration values. This should work given typical routers, what you would run into at work, home or cafe’s. Open a text editor which is Linux friendly (line endings with \n or linefeed). I use SublimeText. Then:</p><ol><li>Open a new file</li><li>Paste in the text below these steps</li><li>Edit the text “SET-YOUR-HOSTNAME” to be the host name for your new VM</li><li>Save the file as “meta-data” into ~/VirtualMachines/AmazonLinux2Config/seedconfig/</li></ol><pre>local-hostname: SET-YOUR-HOSTNAME</pre><pre># ----------------------------------------------------------<br># Use DHCP to have an IP address assigned<br># ----------------------------------------------------------<br>network-interfaces: |<br>  auto eth0<br>  iface eth0 inet dhcp</pre><p>You can write this configuration file in such a way as to use a static IP, but I found that to be far more complex and time consuming. My assumption is that if we’re running this on our local machines it is for development purposes, and no static IP is needed so I avoid that complexity. The trade off for this is that each time I launch the VM, I have to use the VirtualBox console to find out what internal IP has been picked up. This takes a few seconds.</p><h4>Step 3: Build the Boot Image for the New VM</h4><p>The following commands will build an ISO file from the configuration files created in step 2. This ISO file is used to configure the VM the first time it boots, to pass on the decisions you made in the files listed above to the vanilla Amazon Linux 2 instance.</p><ol><li>Open a terminal shell</li><li>cd ~/VirtualMachines/AmazonLinux2Config/</li><li>hdiutil makehybrid -o seed.iso -hfs -joliet -iso -default-volume-name cidata seedconfig/</li></ol><p>The command hdiutil was new to me, and to be honest I don’t know the details on it but it comes with MacOS out of the box, and works as advertised by AWS in their own instructions. FWIW, I have immense respect for the people involved in maintaining such low level tools, and those who understand them enough to help us mortals use them.</p><h4>Step 4: Create the VM in VirtualBox</h4><p>Everything up to this point was pretty well covered by the blogs noted at the end of this guide. Here we get specific to a VirtualBox implementation of the VM. I chose VirtualBox because out of the supported VM containers it:</p><ul><li>Is free (and not just for personal use, it’s free for commercial/enterprise use)</li><li>Has a simple website without a lot of options for what to buy or marketecture fluff (see <a href="https://www.vmware.com/">VMWare</a> for a tedious experience of figuring out which product is simply a VM player on MacOS and what the pricing is)</li></ul><p>Ahead are some screenshots and steps. All I can say is: look at them, <strong>read along</strong>, or you will repeat mistakes I made assuming I knew what was the most likely setting.</p><p><strong>Create the Virtual Machine</strong></p><ol><li>Copy the Amazon Linux 2 image downloaded in Step 1 into ~/VirtualMachines/AmazonLinux2VMs/ (we copy it because the process of loading the image into a VM with the boot ISO modifies the file, and by keeping the original we can create more similar VMs without having to download the image each time)</li><li>Start VirtualBox</li><li>Select “New” on the toolbar top of the window, and use the image below as an example of how to fill it out. The key elements are to set the “Name” to whatever you like, set the Machine folder to the directory you created earlier for the VMs (it will create a sub-directory based on your “Name” value) and <strong>very importantly</strong>: Select the Type and Version shown below. There is no Amazon Linux 2 in the drop down, so use these settings. Then, click on the <strong>Continue</strong> button.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6g1eH5WA5gVJmiju-Sw4bg.png" /><figcaption>The “New” dialog window</figcaption></figure><p>4. Set the Memory Size how you like, I use the default of 1 GB. Click <strong>Continue</strong>.<br>5. Now a <strong>CRITICAL</strong> step: On the hard disk screen, you need to select the .vdi file you downloaded and copied to the ~/VirtualMachines/AmazonLinux2VMs/ directory previously. You do this by selecting the option for “<em>use an existing virtual hard disk file</em>” and then clicking on the unobtrusive folder icon to the right of the text box below that option. That opens a dialog where you need to “Add” your VM image, as below, then with it highlighted press “Choose”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*01DS5PbJWXC97lzKiIiDOw.png" /><figcaption>Making VirtualBox aware of your Amazon Linux 2 image</figcaption></figure><p>After choosing the image, your config should like below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cuTpgzKglKvFij0UiY9WWw.png" /><figcaption>The new VM is configured to use your Amazon Linux 2 virtual hard disk</figcaption></figure><p>6) Finally, select “Create” to finish the creation of the VM.</p><p><strong>Do not launch your new VM yet! </strong>If you did by mistake, in VirtualBox remove the VM you created with the option to delete all files, then start step 4 over.</p><h4>Step 5: Configure the Settings for the VM</h4><p>We have to configure three elements for the VM before launching it:</p><ol><li>The display, so it is readable on most Apple devices and not tiny tiny <a href="https://youtu.be/M2Hq4AzOhds">tiny</a></li><li>The storage, setting up the boot image we created before</li><li>The network, setting up a bridge to the host network config</li></ol><p>After Step 4, your new VM will be shown on the left of the VirtualBox window. Select the new VM, then press “Settings” underneath the title bar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gN_bHH89f0ZjwYFeiTZ3MQ.png" /></figure><p><strong>Display Settings</strong></p><p>I use a MacBook Pro (2018 vintage), retina screen etc and the default display settings for the console are barely readable for me. The change here is to adjust the UI scale. This is only important for some initial work to configure SSHD, from there on in we will be using an SSH client to talk to the OS.</p><p>With the Settings dialog open, select the “Display” header, and adjust the “Scale Factor” as you like. I suggest 250%.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0uXzpPPbLWCH_4mdXX5BYA.png" /><figcaption>Setting the Scale factor</figcaption></figure><p><strong>Storage Settings</strong></p><ol><li>Staying on the Settings screen, select the “Storage” option along the top, along the left you will see your controllers, specifically select the controller for SATA (which has your virtual disk under it).</li><li>Below that panel are a few small icons, select the one that is a floppy disk with a + symbol on it (this is to add a new storage attachment).</li><li>Select “Optical Drive” from the popup</li><li>Now you see a screen where you have to add your “seed.iso” file, similar to how you added the .vdi file during the VM creation. Do so, remembering that it is in your AmazonLinux2Config directory. The highlight the seed.iso file, and select “Choose”</li><li>The end result should look like below</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BhgQXPtljK9DwhGohue0Ig.png" /><figcaption>The boot image has been added to the VM</figcaption></figure><p><strong>Network Settings</strong></p><p>Going back to our assumptions, we want a VM that has the same network access as our host machine, and our host machine can connect to it. Basically the VM looks like just a server on the same network as our host machine.</p><p>To achieve this, we want the VM network to be “Bridged”, but it is set to “NAT” by default. So..</p><ol><li>Still in the Settings window, select “Network” from the top</li><li>Where there is a selection for “Attached to”, change the setting to “Bridged Adapter”</li><li>Check the “Name” setting to ensure it is picking up the right adapter on your host, in my case I use wireless.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lFHj8XHAfnqKRls85Zgz7w.png" /></figure><p><strong>Finally</strong>, click “Ok” on the Settings window and it will save the settings.</p><h4>Step 6: Launch the VM</h4><p>With your new VM selected, press the “Start” button. A new window launches, a console to the new VM. It will go through a startup process, and eventually present a login. Sometimes I have seen the image show the login prompt, but then after a few moments carry out an automatic update so if you’re not watching closely you don’t notice that when the update finishes the system is still waiting for your username input (though the login: prompt is long gone).</p><p>Log in with “ec2-user” and the password you chose in the “user-data” file.</p><h4>Step 7: Configure SSHD on the VM to Allow Password Authentication</h4><p>The SSH daemon is set up to work well out of the box, except for our ease of use need to allow passwords for authentication. These are not servers, they’re not in formal development or production environments, they are images running behind multiple layers of network abstraction so imho password auth is ok. But it is not allowed in Amazon Linux 2 by default so we need to allow it. This is as simple as editing the SSHD configuration file to allow it. So…</p><ol><li>Bring up the VirtualBox console window for the running instance</li><li>Open the file /etc/ssh/sshd_config for editing, using vi for example</li><li>Find the line for #PasswordAuthentication yes and uncomment it</li><li>Restart sshd ( sudo systemctl restart sshd.service )</li></ol><h4>Step 8: Test Networking</h4><p>Test outbound networking from the new VM in a manner allowed by your network firewall. In my case, I ping 8.8.8.8 from the VM console</p><p>Test inbound networking by checking the VM’s internal IP address (using DHCP so this may change, check it each time you start the VM ) using something like hostname -I from the VM console, then open a terminal on your host MacOS machine and ssh to that address. (for ex. ssh ec2-user@192.168.1.91 )</p><p>You (should) now have a usable Amazon Linux 2 VM for local work!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*uIg8uRmrMkrU5BHYYYR1Fg.png" /></figure><h4>Finally, My Thanks, Sources and Inputs</h4><p>The following were sources I found useful while working through this process. Obviously I did not find anything that got me all the way through, but these were very well written and informative articles written by people who clearly put in the time and brainpower to help others:<br>- <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/amazon-linux-2-virtual-machine.html">AWS Documentation</a> <br>- <a href="http://blog.bradlucas.com/posts/2018-11-10-run-a-local-amazon-linux-2-instance/">Brad Lucas’ blog</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45d25a70f6d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>