Steps to deploy code to EC2

  • Step 1: Create a Key Pair – If not present, create a key pair to access virtual machine with Amazon EC2. 
  • Step 2: Enter the CodeDeploy Console – In the AWS CodeDeploy Console, click Get Started Now. Select Sample Deployment and click Next Step.
  • Step 3: Launch a Virtual Machine – AWS virtual machines or Amazon EC2 instances, or just ‘instances’, are launched as per available templates by selecting
    • Operating System: OS of EC2 Instance
    • Instance Type:  Select instance type as per varying combinations of CPU, memory, storage, and networking capacity. The t1.micro instance type is selected in this example.
    • Key Pair Name: Select key pair to connect to Amazon EC2 instances.
    • Tag Key and Value: AWS CodeDeploy will use tag key and value to locate the instances during deployments.
  • Step 4: Click Launch Instances. Name Application and Review Application Revision
  • Step 5: Create a Deployment Group – set of individual EC2 instances that CodeDeploy deploys revisions to and has individually tagged instances, Amazon EC2 instances in Auto Scaling groups, or both. Following is to be done by specifying the Amazon EC2 instances to deploy by entering the key-value pair
  • Step 6: Create a Service Role – Grant AWS CodeDeploy permission to deploy to instances by creating a role for it.
  • Step 7: Deploy Application – select a deployment configuration and then initiate the deployment to EC2 instances.
  • Step 8: Clean Up Instances – The deployed EC2 instances will be running till terminated. Delete if instance is not needed
Menu