Amazon EC2 CodeDeploy GitHub -Part 2

Part 2:

On Part 1 -mentioned that we will create another role on IAM Console on this part before creating an application lets create the role now for

Get the Service Role ARN (Console)

To use the IAM console to get the ARN of the service role:

Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/.

In the navigation pane, choose Roles.

In the Filter box, type CodeDeployServiceRole, and then press Enter.

Choose CodeDeployServiceRole.

Make a note of the value of the Role ARN field.

NOW LETS CREATE THE APPLICATION:

Create an application and deployment group (console)

Sign in to the AWS Management Console and open the AWS CodeDeploy console at https://console.aws.amazon.com/codedeploy.

Note

Sign in with the same account or IAM user information you used in Getting Started with AWS CodeDeploy.

On the Applications page, choose Create application.

Note

If you haven’t created any applications yet and the AWS CodeDeploy start page is displayed, choose Get Started Now, complete a deployment using the Sample deployment wizard, and then return to this topic.

In the Application name box, type CodeDeployGitHubDemo-App.

In the Deployment group name box, type CodeDeployGitHubDemo-DepGrp.

In Deployment type, choose In-place deployment.

In Environment configuration, depending on the type of instance you are using, choose the Amazon EC2 instances tab or the On-premises instances tab.

In the Key and Value boxes, type the instance tag key and value that was applied to your instance as part of Step 4: Provision an Instance ont the earlier Wiki part 1.

In the Service role ARN drop-down list, choose your service role ARN. (Follow the instructions in Get the Service Role ARN (Console) if you need to find your service role ARN.)

Choose Create application, and continue to the next step.

Deployment:

1) On the Application details page, in Deployment groups, choose the button next to CodeDeployGitHubDemo-DepGrp.

2) In the Actions menu, choose Deploy new revision.

3) On the Create deployment page, in the Repository type area, choose My application is stored in GitHub.

4) In Connect to GitHub, do one of the following:

To create a connection for AWS CodeDeploy applications to a GitHub account, sign out of GitHub in a separate web browser tab.

In GitHub account, type a name to identify this connection, and then choose Connect to GitHub. The web page prompts you to authorize AWS CodeDeploy to interact with GitHub for the application named CodeDeployGitHubDemo-App.

5)Follow the instructions on the Sign in page to sign in with your GitHub account.

6)To use a connection you have already created, in GitHub account, select its name, and then choose Connect to GitHub.

7) To create a connection to a different GitHub account, sign out of GitHub in a separate web browser tab. Choose Connect to a different GitHub account, and then choose Connect to GitHub. Continue to step 5.

Follow the instructions on the Sign in page to sign in with your GitHub account.

On the Authorize application page, choose Authorize application.

On the AWS CodeDeploy Create deployment page, in the Repository name box, type the GitHub user name you used to sign in, followed by a forward slash (/), followed by the name of the repository where you pushed your application revision (for example, my-github-user-name/CodeDeployGitHubDemo).

If you are unsure of the value to type, or if you want to specify a different repository:

In a separate web browser tab, go to your GitHub dashboard.

In Your repositories, hover your mouse pointer over the target repository name. A tooltip appears, displaying the GitHub user or organization name, followed by a forward slash character (/), followed by the name of the repository. Type this displayed value into the Repository name box.

Note

If the target repository name is not displayed in Your repositories, use the Search GitHub box to find the target repository and corresponding GitHub user or organization name.

In the Commit number click then will display commit details page where you can obtain Commit ID. Copy it then Paste the commit ID into the Commit ID box on Amazon CodeDeploy console.

Choose Deploy, and continue to the next step.

Step 7:

In this step, you will use the AWS CodeDeploy console or the AWS CLI to verify the success of the deployment. You will use your web browser to view the web page that was deployed to the instance you created or configured.

Note

If you’re deploying to an Ubuntu Server instance, use your own testing strategy to determine whether the deployed revision works as expected on the instance, and then go to the next step.

Last Steps:

To delete the AWS CodeDeploy deployment component records

Sign in to the AWS Management Console and open the AWS CodeDeploy console at https://console.aws.amazon.com/codedeploy.

Note

Sign in with the same account or IAM user information you used in Getting Started with AWS CodeDeploy.

If the Applications page is not displayed, on the AWS CodeDeploy menu, choose Applications.

Choose CodeDeployGitHubDemo-App.

On the Application details page, in Deployment groups, choose the button next to the deployment group. On the Actions menu, choose Delete. When prompted, type the name of the deployment group to confirm you want to delete it, and then choose Delete.

At the bottom of the Application details page, choose Delete application.

When prompted, type the name of the application to confirm you want to delete it, and then choose Delete.