- 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"
}
- 發(fā)布!設(shè)計(jì)與部署穩(wěn)定的分布式系統(tǒng)(第2版)
- 阿里云數(shù)字新基建系列:云原生操作系統(tǒng)Kubernetes
- Linux Shell編程從入門到精通(第2版)
- 奔跑吧 Linux內(nèi)核(入門篇)
- 嵌入式實(shí)時(shí)操作系統(tǒng)μC/OS原理與實(shí)踐
- 蘋果OS X Mavericks 10.9應(yīng)用大全
- Application Development in iOS 7
- Linux系統(tǒng)最佳實(shí)踐工具:命令行技術(shù)
- HTML5 Enterprise Application Development
- Linux網(wǎng)絡(luò)操作系統(tǒng)項(xiàng)目教程(RHEL 7.4/CentOS 7.4)(第3版)(微課版)
- 電腦辦公(Windows 10 + Office 2016)入門與提高(超值版)
- OpenHarmony開發(fā)與實(shí)踐:基于紅莓RK2206開發(fā)板
- 電腦辦公(Windows 7+Office 2016)入門與提高
- 基于Arduino的嵌入式系統(tǒng)入門與實(shí)踐
- Windows 8玩全不求人