Experience New Console of EC2 Launch Instance and its Volume Encryption with Custom Key
Tags: aws, ec2instance, ebsvolume, awskms
Published: 2022-05-07 10:56:20

“ I have checked the documents of AWS to experience the new console of EC2 launch and also easily be able to encrypt the volume of instance with a custom key. Pricing of Amazon EC2 depends on usage of instance and KMS custom key costs $1 per key.”

Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity in the Amazon Web Services (AWS) Cloud. Using Amazon EC2 eliminates your need to invest in hardware up front, so you can develop and deploy applications faster. You can use Amazon EC2 to launch as many or as few virtual servers as you need, configure security and networking, and manage storage. Amazon EC2 enables you to scale up or down to handle changes in requirements or spikes in popularity, reducing your need to forecast traffic.

An instance is a virtual server in the AWS Cloud. You launch an instance from an Amazon Machine Image (AMI). The AMI provides the operating system, application server, and applications for your instance.

When you sign up for AWS, you can get started with Amazon EC2 for free using the [AWS Free Tier](https://aws.amazon.com/). You can use the free tier to launch and use a t2.micro instance for free for 12 months (in Regions where t2.micro is unavailable, you can use a t3.micro instance under the free tier). If you launch an instance that is not within the free tier, you incur the standard Amazon EC2 usage fees for the instance. For more information, see [Amazon EC2 pricing](https://aws.amazon.com/ec2/pricing).

The KMS keys that you create are customer managed keys. Customer managed keys are KMS keys in your AWS account that you create, own, and manage. You have full control over these KMS keys, including establishing and maintaining their [key policies](https://docs.aws.amazon.com/kms/latest/developerguide/control-access.html), [IAM policies](https://docs.aws.amazon.com/kms/latest/developerguide/control-access.html), [and grants](https://docs.aws.amazon.com/kms/latest/developerguide/control-access.html), [enabling and disabling](https://docs.aws.amazon.com/kms/latest/developerguide/enabling-keys.html) them, [rotating their cryptographic material](https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html), adding tags, creating aliases that refer to the KMS keys, and scheduling the KMS keys for deletion.

In this post, you will experience the new console of EC2 launch instance and its volume encryption with a custom key. Here I have launched an EC2 Instance with default settings and also encrypted the volume with a custom key.

#Architecture Overview
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zuflgqd0j13k4n9un5hh.png)
The architecture diagram shows the overall deployment architecture with data flow, amazon ec2, amazon elastic block store volume and aws kms.

#Solution overview
The blog post consists of the following phases:
1. Create KMS Custom Key with Key Permissions
2. Launch of EC2 Instance in New Console and Encryption of Volume Using KMS Custom Key

##Phase 1: Create KMS Custom Key with Key Permissions  
1. Open the AWS Key Management Service console, click on create a key. Choose key type as symmetric and key usage as encrypt and decrypt and leave advanced option as default and click next. Name the key as ec2-encryption-key and leave all other options as default and create a key. We can check the key policy and key admin and user permissions. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nry5f9dqycww0reh36vj.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n9a3dxjpupacdwttvl07.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pzxxnouzhyh1sajihpqe.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cm05ba8h45wsw49dmdah.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/drwd7jxchwe1991xax1w.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iwp3sdobtfqd6ja69f2s.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/86ayboy4r6viq220h0gg.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jbh9itl2tt08i4kbzg6o.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iho5jcw9qtfxih7vy1l2.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t882t358dfaxonk72cdq.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ld0k69ve2vd9s2dfqxmu.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/04yopzfcs0gtsxmagbi0.png)

##Phase 2: Launch of EC2 Instance in New Console and Encryption of Volume Using KMS Custom Key  
1. Click on launch instance and Name the instance and tag it as per requirement. Select the OS and instance type with the new key pair. We can change the network settings as per requirement. Currently all options are set to default. Once the instance is in running state, we can check all configurations set in the instance such as checking security, networking, storage and so on.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/66ilj1zzsb5h3g12zgb1.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b9emwkfzvd2osltd7pi5.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uz2dx2r7hx0gldgvz5js.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sc43oyl79cltkbsvjmxm.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/90rit5384tgftxr27hko.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7thdbfn02wflkxfcl894.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dewehtjurui5c5j5mygn.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mrpn5zz0naeoar0ox8za.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ehpub1i2fq4k2m21aim.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t3zpd8wsfsjiuyzcp4gc.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c62vh6fd30ms4muy4thh.png)

2. Launch of a new instance with all above the same configuration just encrypted a root volume using a created custom key.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/od332wr6eo662ub4whky.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9q09suh1270sgzwss7iz.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jexrtsfwoz5r4z6mrz8m.png)

#Clean-up
Delete EC2 Instance, EC2 Volume, KMS Custom Key.

#Pricing
I review the pricing and estimated cost of this example. 

Cost of EC2 Instance = $0.07

Cost of Key Management Service = $1.0

Cost of Data Transfer = $0.0

Total Cost = $(0.07 + 1.0 + 0.0) = $1.07

#Summary
In this post, I showed “how to experience the new console of EC2 launch instance and its volume encryption with a custom key”.

For more details on EC2 Launch Instance, Checkout Get started EC2 Launch Instance, open the [EC2 Launch Instance Console](https://ap-south-1.console.aws.amazon.com/ec2/v2/home?region=ap-south-1#Instances:). To learn more, read the [EC2 Launch Instance Documentation](https://docs.aws.amazon.com/ec2/?id=docs_gateway). For more details on Key Management Service, Checkout Get started Key Management Service, open the [Key Management Service Console](https://ap-south-1.console.aws.amazon.com/kms/home?region=ap-south-1#/kms/keys). To learn more, read the [Key Management Service Documentation](https://docs.aws.amazon.com/kms/?id=docs_gateway).

Thanks for reading!

Connect with me: [Linkedin](https://www.linkedin.com/in/gargee-bhatnagar-6b7223114)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/38sdi4nsp89fnui8h7dk.png)