Configuring Our AWS Workspace
Here, we'll configure an `AWS Workspace` or `AWS EC2 Instance` as the development environment to use for developing for AWS Lambda.
Remote Workspace - (Optional)#
Now that our AWS Account is largely configured - it is possible to configure an AWS Workspace
or AWS EC2 Instance
as the development environment to use for developing for AWS Lambda.
These tools are best used for cases where developers are unable to install the required development software onto their local development machine due to technical limitations or permissions issues. See pricing info before using any of these
AWS Workspaces - Standard with Amazon Linux 2#
AWS Workspaces provides persistent computer workspaces (complete with a GUI) that can be used from almost any client that has access to internet. AWS provides a free-tier eligible workspace bundle called Standard with Amazon Linux 2
- and that should work just fine with everything shown in this course. It's possible to connect to Amazon Linux Workspaces from Windows, Mac OS, ChromeOS, Android, and iOS. At this time - Linux can connect to some Amazon Linux 2 Workspaces via Firefox or Chrome - though it can connect to Windows workspaces. Hopefully future updates will resolve that issue. If a remote solution is needed for Linux, consider using EC2, as shown below
Workspace Pricing information (Important if not using free-tier!) : https://aws.amazon.com/workspaces/pricing/.
Instructions for launching an AWS Workspace : https://docs.aws.amazon.com/workspaces/latest/adminguide/getting-started.html
AWS EC2 Instance (Amazon Linux 2)#
It is also possible to use a plain Amazon Linux 2 EC2 Instance for developing for Lambda. The setup for this is more complex than for AWS Workspaces, but works fine for users familiar with EC2 already.
Remember to select a free-tier qualifying instance (such as t2.micro
) if that is important, and ensure that the instance has an AWS Security group that is locked down tight. A standard GUI will not be available easily when taking this path, but this course is very oriented to terminal usage anyhow. Instructions are provided below for using VSCode over SSH, which is recommended when using this setup.
Connect VSCode to remote SSH : https://code.visualstudio.com/docs/remote/ssh
Configure Local AWS Credentials#
If we created our own user in the Create an Administrator Account for Yourself step above, we do not need to create credentials again. The CSV downloaded at the last step of user creation will have the necessary information present.
Otherwise, we'll need to create a set of credentials using the instructions below.
Navigate to the IAM console
Click
Users
on the leftSelect our user name from the list of users to the right
Click the
Security Credentials
TabClick the
Create access key
button underneath theAccess keys
header.On the pop-up which appears, click
Download .csv file
and save that file to a secure, local location.
Do not commit access keys or share them
Never commit any file that contains the secret access key to source control, and do not leave any file that contains it on a shared server, even internally. EC2 Servers and application code should never use a secret key to connect to any other EC2 services.
IAM Roles
(discussed in later chapters) are the ONLY acceptable way to authenticate for applications.If we ever accidentally commit code with a secret key present, or otherwise find ourselves in a situation where the key may have been leaked - go to the same page where the key was added and click
deactivate key
immediately. It will be required to re-provision a new key in that leaked key's place.
With our API Access Credentials in hand (check the Credentials.csv
file from step above), we can now pre-configure our local development machine to store those values so that they will be used with the AWS tooling.
To do this, follow the instructions provided by AWS to Create a shared Credentials File. If you already have a shared credentials file configured, you probably do not need to update it unless you are using a different account and IAM user for Lambda development.
We'll hold off on further configuration steps, like setting a default region, until we've got the aws cli
tool installed.
Configure Local Development Machine#
That's it for the AWS-specific portion of setup. Next up, we'll need to configure our local development machine