If you don’t have any account with AWS, choose I’m a New User; Otherwise, select enter your credentials.
Enter your login information, contact and billing information and read/accept AWS terms. During the account creation process, you will need to enter a code into your phone for verification purposes.
Go to the list of key pairs by going to this link.
Select the Create Key Pair button and enter ditc in the Key Pair Name field and the Create button. Save the file onto your computer for future use. Click the Close button.
Launch an AWS Utility instance using CloudFormation
Click this link to launch an AWS command-line interface instance. This template is provided courtesy of AWS Training.
Click Continue.
In the KeyName field, enter the key pair (i.e. ditc) that you created in the previous section. Select the checkbox next to I acknowledge that this template may create IAM resources and click Continue.
Click Continue again, then Close.
Once the status in CloudFormation is CREATE_COMPLETE, select the checkbox next to AWSCLI.
Select the Outputs tab in the bottom panel and copy the DNS name for the instance into your clipboard
Find the ditc.pem file on your computer. If you are are a *nix-based computer, you will need to modify the permissions to 400.
1
$ chmod 400 ditc.pem
From the directory where your ditc.pem is located, enter the command below to SSH into the utility instance. In the example below, the DNS name is ec2-23-20-4-122.compute-1.amazonaws.com. Yours will be different.
Create a new S3 bucket. This will be used to host your build artifacts. Call it something like ditcxyzartifacts where xyz are your initials. I’m calling my bucket stelligentlabs throughout this LiveLesson.
Enter the name of the bucket you you just created (e.g. “ditcxyzartifacts”) and click Continue.
Click Continue again, then Close.
Once the status in CloudFormation is CREATE_COMPLETE, the policy has been applied to your S3 bucket.
Create an S3 bucket to host credentials
Create a new S3 bucket and call it ditcxyzcreds – where xyz are your initials. Write down both of these S3 buckets (ditcxyzcreds and ditcxyzartifacts) as you will use them several times throughout this LiveLesson.
Create SQS queues
Go to the SQS tab and create two new queues. One called CloudFormationStacks and the other called Deployment. Set the Default Visibility Timeout to 0.
Click the Fork button. A message will display “Where do you want to fork this to?”. Click on the button that says Fork to YOURUSERID.
Create an SSH keypair by SSH’ing to the AWSCLI instance you created by launching the CloudFormation stack in the section above. In the example below, I’m using the email address that’s registered with my GitHub account. You can find yours by going to https://github.com/settings/profile/. Accept the defaults after running this command.
Display the contents of the public key and copy the contents to your clipboard.
1
$ cat ~/.ssh/id_rsa.pub
After logging into your GitHub account, go to your GitHub SSH Keys settings at https://github.com/settings/ssh/. Click on the Add SSH Key button, give it a name and paste the contents of the public key into the Key text field. Then, click the Add key button. Enter your GitHub password when prompted.
Go back to the AWS CLI instance, go to the root directory and type the following from the command line. Replace bvajjala with your GitHub userid.
Type ls from the command prompt. You should see sample_app and devopsinthecloud as subdirectories.
You can also setup the same environment on your local computer. This way it’s easier to use the IDE of your choice.
Checkin application code to GitHub
From the root directory of your EC2 instance change directory to sample_app.
Open the home.html.erb file
1
$ sudo vim home.html.erb
Make a modification to the contents of the file and save it.
Change directory to sample_app.
Add the file in Git
1
$ git add .
Commit the file to Git
1
$ git commit -m "Modify the application code"
Push it to the Git master.
1
$ git push
SPECIAL: Synchronize your GitHub fork with latest bvajjala/devopsinthecloud repository
By default, GitHub will not update changes from the https://github.com/stelligent/devopsinthecloud GitHub repository. Since I will be making changes and updates after the video publication, you will want to go through the following steps to merge the changes we make at stelligent/devopsinthecloud with your forked repository.
Clone your repository. Replace bvajjala with your GitHub username.