Cloud Formation service that enables the creation of AWS resources in an orderly. Resources are written in text files using JSON or YAML format. The template requires a specific syntax and structure depending on the types of resources being created and managed. Your resources in JSON or YAML files with any code editor such as AWS Cloud can check into a version control system, and then CloudFormation builds the specified services in a safe, repeatable manner.
Steps To Configure and launch the EC2 using CloudFormation and create two IAM roles for the EC2 and code deploy.
Step 1: Create 2 IAM roles for the EC2 and code deploy.
(a)- IAM role for the code deployment
(b)- IAM role overview for the EC2 for access s3, code deploy.
Step2. Open the AWS account console and go to the cloud formation service. Click on the create stack option.
Step 3. After that, Prerequisite - Prepare template will be the same as default, and go to the 'specify the option' to upload the template. After selecting the template, click the option on choose file option and click on the 'Next' option.
Step4: After that, provide the stack's name and click on the 'next' option.
Step5: After this, the default setting remains the same, and click on the 'next' option to continue.
Step6: At the end, just review your configuration, tick the check box of the capability to access the IAM role in EC2, and click on the create stack option.
Step7: After that, your Stack creation starts, and you can see it running on your screen.
i). CodeCommit has managed the source control service. The host is a secure and Git-based repository.
ii). CodeCommit is an operated or source control system that about the scaling of infrastructures.
iii). Aws CodeCommit automatically encrypts your file in transit and at rest. The CodeCommit is integrated with the AWS IAM role allow for customizing user-specific access to our repositories.
iv). The CodeCommit that is all git command supports and works with your existing git tools. That is preferred to development and environment plugins, CI/CD tools systems, and graphical clients with CodeCommit
Step1. Now create a repository.
. Aws managed service to automate your Deployments.
. Scalable, it can deploy to one or thousand ec2 instances.
. AppSpec file must be in YAML format for ec2 Deployment and must be placed in the root directory.
. CodeDeploy understands only the AppSpec file’s contents.
. Contents inside the file will be executed between the BeforeInstall and AfterInstall events.
. You can specify a' permissions' for Deployment to amazon Linux, ubuntu server, or RHEL instances. You can give some special permission to any specific file.
Step1. After that, open the code in the AWS console and create a new application.
Step2. After creating an application, create a deployment for the dedicated service such as EC2, ECS, etc.
Step3. After that provide the details for the deployment and configuration.
Step 4: Select the IAM role for code deploy, which we've created above.
Step5. Select an environment and provide the tag of the resource.
Step6. After that, select the deployment configuration and check if the load balancing is enabled or not. In the end, create a deployment to click on the 'create' button.
Step 7: Now, go to CodeCommit or another resource where your code is stored and create a file with the name of "appspec.yaml".
Step 8: Now, create two more files which name as 'after.sh" and "before.sh" for the deployment of the application.
4. AWS CodePipeline:
Step1. Open the code pipeline service and click on create a pipeline.
Step 2: Provide the name of the pipeline and click on the Next button.
Step 3: After that, add the resource and see whether the code comes to the pipeline.
Step 4: Now, add the Build stage to the pipeline.
Step 5: After that, add the deployment stage to the pipeline.
Step6. In the end, check and verify and click on "create" button.
Step7. Now, if you open the deployment pipeline, it will trigger and be successfully deployed.
Step8. Now go to Google Chrome and hit the IP or domain to check whether the website is working or not.