It took 2 weeks for the beans to learn some of the core commands of AWS PowerShell intermittently, and then took 2 days to assemble the knowledge points together. Currently, in addition to the official documentation of the Quick Manuals and command Daquan basically there is not much PowerShell to manage the content of AWS, most of the command beans is a search and view help hard to try out, the following share out, if you have similar needs later can save some time.
Now demonstrate how to create a highly available WordPress blog on AWS with PowerShell scripts. This is a typical high-availability scenario for AWS.
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/84/57/wKioL1eN0BuT7xdhAAdA3ToXccI699.png "title=" 0.PNG " alt= "Wkiol1en0but7xdhaada3toxcci699.png"/>
Here are the basic requirements
The user elastic Load balancer URL,ELB forwards requests through DNS to the EC2 instance of any of these word press, which accesses the remote MARIADB RDS instance via port 3309;
MySQL achieves high availability through Multiple-az;
Web server enables load balancing and high availability through ELB;
According to the CPU or other load standard, ELB inside the cluster can automatically increase, delete EC2 instance;
The server created by auto Scaling must be automatically updated to the latest version;
All the pictures and videos involved in the blog must be saved on the S3 bucket, and the CDN acceleration via CloudFront, the blog's Media resource URL automatically redirects to the CDN address for parsing.
Now look at how PowerShell implements each of these features.
My basic idea
Create EC2-S3 role, which is assigned to EC2 virtual machines so that they automatically have access to S3 content after they are created.
Create a VPC Network
Create 2 subnets of a VPC, located in different AZ
Create an Internet gateway
Configure the routing table
Create and configure the EC2 security Group to ensure that 80 and 22 ports are available
Create a highly available MARIADB database
Configure the security Group for the database to ensure that port 3306 is available
Create a S3 Bucket and configure policy
Create CloudFront distribution points, bind S3 buckets
Preparing the WordPress configuration document
Preparing the configuration document for VirtualHost
Uploading the configuration document into the S3 bucket
Configure bash shell scripts, including Lamp,wordpress,aws,crontab and S3 synchronization, and more
Create a EC2 virtual machine, specify the bootstrap command created in 14 steps
Update DNS records, point to the virtual machine
Initializing the WordPress interface
Generate image file after confirmation is correct
Configure Elb
Update DNS records to ELB address
Configuring launch Configuration
Configure Auto Scaling
The next section looks at the specific scripting implementation.
This article is from the "Mapo Tofu" blog, please be sure to keep this source http://beanxyz.blog.51cto.com/5570417/1827724
Powershell AWS Automation Management (10)-Create a highly available WordPress blog (top)