- Implementing Cloud Design Patterns for AWS(Second Edition)
- Sean Keery Clive Harber Marcus Young
- 572字
- 2021-06-24 15:11:49
Cloud9
Although we said everything is going to be code, and while it is possible to create our integrated development environment (IDE) as code, we are going to use the AWS console for this exercise. Log in to the console, click the Services button, and search or scroll to the Cloud9 service. This cloud native IDE is provided for us by Amazon, so we will use it in order to simplify our security and easily integrate with other AWS services. Go ahead and create an environment (press the big orange Create environment button):

Select the smallest available option (when we were writing this book, it was the t2.micro (1 GiB RAM + 1 vCPU) instance type) for now and keep all of the other defaults. Press the button at the bottom of the page for the Next step:

Check the settings on the Review step page and confirm; you should then eventually see something like the following screenshot. Creating environments takes a few minutes:

Right-click on the cloudpatterns folder and create a new folder called ch2:

Now we will install Terraform to help us to manage our infrastructure as code configuration. Click Create File and add the following code:
#! /bin/bash
mkdir download
cd download/
wget https://releases.hashicorp.com/terraform/0.11.11/terraform_0.11.11_linux_amd64.zip
unzip terraform_0.11.11_linux_amd64.zip
mv terraform /usr/bin/terraform
terraform
exit
Save the file in your ch2 folder as terraform_install.sh, then click Run:

You will see some scrolling at the bottom of your window, then Terraform help will appear. You can close the Run window and click in the bash window:

Now that we have some source code, we need a place to keep it outside of Cloud9. We will create an AWS CodeCommit source repository using Terraform. Let's start with a new codecommit.tf file:
provider "aws" {
region = "us-east-1"
}
resource "aws_codecommit_repository" "cloudpatterns" {
repository_name = "cloudpatternsrepo"
description = "This is a demonstration repository for the AWS Cloud Patterns book."
}
We need to initialize the Terraform environment using terraform init first. This will configure the AWS provider for you. Then, you can run terraform apply:

Great! Let's put our code into our repository.
Here is some example code for creating a Cloud9 environment with Terraform, create_env.tf:
resource "aws_cloud9_environment_ec2" "cloudpatterns" {
instance_type = "t2.micro"
name = "example-env"
automatic_stop_time_minutes = "30"
description = "My Cloud Patterns Environment"
}
- Mastering vRealize Operations Manager(Second Edition)
- 發布!設計與部署穩定的分布式系統(第2版)
- Windows Phone應用程序開發
- Docker+Kubernetes應用開發與快速上云
- Windows Server 2012網絡操作系統企業應用案例詳解
- Windows Server 2019 Administration Fundamentals
- Linux運維最佳實踐
- 注冊表應用完全DIY
- 從實踐中學習Kali Linux無線網絡滲透測試
- INSTANT Galleria Howto
- Introduction to R for Quantitative Finance
- μC/OS-III內核實現與應用開發實戰指南:基于STM32
- Linux集群之美
- 電腦辦公(Windows 7+Office 2016)入門與提高
- 鴻蒙應用開發實戰