Book Image

Implementing AWS: Design, Build, and Manage your Infrastructure

By : Yohan Wadia, Rowan Udell, Lucas Chan, Udita Gupta
Book Image

Implementing AWS: Design, Build, and Manage your Infrastructure

By: Yohan Wadia, Rowan Udell, Lucas Chan, Udita Gupta

Overview of this book

With this Learning Path, you’ll explore techniques to easily manage applications on the AWS cloud. You’ll begin with an introduction to serverless computing, its advantages, and the fundamentals of AWS. The following chapters will guide you on how to manage multiple accounts by setting up consolidated billing, enhancing your application delivery skills, with the latest AWS services such as CodeCommit, CodeDeploy, and CodePipeline to provide continuous delivery and deployment, while also securing and monitoring your environment's workflow. It’ll also add to your understanding of the services AWS Lambda provides to developers. To refine your skills further, it demonstrates how to design, write, test, monitor, and troubleshoot Lambda functions. By the end of this Learning Path, you’ll be able to create a highly secure, fault-tolerant, and scalable environment for your applications. This Learning Path includes content from the following Packt products: • AWS Administration: The Definitive Guide, Second Edition by Yohan Wadia • AWS Administration Cookbook by Rowan Udell, Lucas Chan • Mastering AWS Lambda by Yohan Wadia, Udita Gupta
Table of Contents (29 chapters)
Title Page
Copyright and Credits
About Packt
Contributors
Preface
Index

Creating a key pair


A key pair is used to access your instances via SSH. This is the quickest and easiest way to access your instances.

 

 

Getting ready

To perform this recipe, you must have your AWS CLI tool configured correctly.

How to do it...

  1. Create the key pair, and save it to disk:
      aws ec2 create-key-pair \
--key-name MyEC2KeyPair \
--query 'KeyMaterial' \
--output text > ec2keypair.pem
  1. Change the permissions on the created file:
chmod 600 ec2keypair.pem

How it works...

This call requests a new private key from EC2. The response is then parsed using a JMESPath query, and the private key (in the KeyMaterial property) is saved to a new key file with the .pem extension.

Finally, we change the permissions on the key file so that it cannot be read by other users—this is required before SSH will allow you to use it.