Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)
-
Upload
carlos-guillermo-musumeci -
Category
Technology
-
view
195 -
download
1
Transcript of Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)
![Page 1: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/1.jpg)
PowerShell Conference Asia
DevOps on AWS with PowerShellGuillermo Musumeci@gmusumeci
#psconfasia
![Page 2: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/2.jpg)
PowerShell Conference Singapore 2016
Who is this guy?• Started my career in Microsoft, 20 years ago.• Lived in Buenos Aires, Washington DC, Madrid, Paris and Singapore.• Solutions Architect @ AWS Singapore, Microsoft SME for ASEAN.• Cloud Evangelist. Expert in automating and deploying Microsoft workloads
in Amazon Web Services, Microsoft Azure & Google Cloud.• Love to create and build stuff. Developer. Entrepreneur. Curious. • Book author. Books lover. Husband & Dad. Foodie. • Startup Mentor. I ♥ Startups.
![Page 3: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/3.jpg)
PowerShell Conference Singapore 2016
What we will cover• Tools setup• Launching EC2 instances• Tagging resources• Creating Security Groups• Finding resources using filters• Adding storage to instances• Bootstrapping instances with UserData• Configuring VPCs and Subnets
![Page 4: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/4.jpg)
PowerShell Conference Singapore 2016
What we will cover (continued)• Configuring Internet Gateways and NAT Gateways• Launching RDP Gateway servers• Launching Active Directory Domain Controllers• Launching IIS Web Servers• Single-AZ Full Stack• Multi-AZ Full Stack• Elastic Load Balancer• Auto Scaling EC2 Instances
![Page 5: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/5.jpg)
PowerShell Conference Singapore 2016
Before you get started• You need an AWS account
• PowerShell 2.0 or later installed.
• Basic knowledge of some AWS services:• EC2 instances• Security Groups• VPCs and subnets
![Page 6: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/6.jpg)
PowerShell Conference Singapore 2016
Setting up the tool• Download and install AWS Tools for Windows PowerShell
from https://aws.amazon.com/powershell/
• The installer for the Tools for Windows PowerShell installs the most recent version of the AWS SDK for .NET and also the AWS Toolkit for Visual Studio.
• If you are using an AWS EC2 instance as bastion or management server, AWS Tools for Windows PowerShell is preinstalled on the Windows machine.
![Page 7: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/7.jpg)
PowerShell Conference Singapore 2016
Installing the AWS Tools for PowerShell Core• The AWS Tools for PowerShell Core can be installed on computers that are
running Microsoft PowerShell 5.1 or a later release of PowerShell, including:
• Ubuntu 14.04 LTS and later• CentOS Linux 7• Mac OS X• Windows 8.1 Enterprise• Windows Server 2012 R2• Windows 10 for Business
• Download the AWS Tools for PowerShell Core at https://www.powershellgallery.com/packages/AWSPowerShell.NetCore
![Page 8: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/8.jpg)
Configuring Credentials
![Page 9: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/9.jpg)
PowerShell Conference Singapore 2016
Configuring the AWS Command Line Interface• To add a new profile to the AWS SDK store, call Set-AWSCredentials as follows:
where• -AccessKey – The access key.• -SecretKey – The secret key.• -StoreAs – The profile name, which must be unique.
• To specify the default profile, set the profile name to default.
![Page 10: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/10.jpg)
PowerShell Conference Singapore 2016
Configuring the AWS Command Line Interface• List profilesYou can check the current list of names as follows:
• Remove a profileTo remove a profile, use the following command:
• The -StoredCredentials parameter specifies the profile name.
![Page 11: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/11.jpg)
14 Regions
38 Availability Zones
59 Edge Locations
Build it once, repeat it everywhere
• Independent for jurisdictional boundary requirements
• Private AWS fiber links interconnect all major regions
![Page 12: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/12.jpg)
PowerShell Conference Singapore 2016
Configure the AWS region• Using the Get-AWSRegion command to list AWS regions available
![Page 13: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/13.jpg)
Exploring the AWS PowerShell Module
![Page 14: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/14.jpg)
PowerShell Conference Singapore 2016
Exploring AWS PowerShell Module• Use the Get-Command command to lists all commands in
the AWS module
![Page 15: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/15.jpg)
PowerShell Conference Singapore 2016
Exploring AWS PowerShell Module• Using Get-Command with the –Noun parameter to filter
commands
![Page 16: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/16.jpg)
PowerShell Conference Singapore 2016
Exploring AWS PowerShell Module• Using Get-Command cmdlet with –Noun and –Verb
parameters to filter commands
![Page 17: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/17.jpg)
PowerShell Conference Singapore 2016
Exploring AWS PowerShell Module• Using Help cmdlet with –Examples parameter to display
examples
![Page 18: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/18.jpg)
PowerShell Conference Singapore 2016
History of AWS cmdlets• The $AWS-History command enumerate AWS cmdlets that
are being used
![Page 19: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/19.jpg)
Building an EC2 instance
![Page 20: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/20.jpg)
PowerShell Conference Singapore 2016
Compute Services
20
Auto Scaling Elastic Load BalancingAutomated scaling
of EC2 capacityDynamic
traffic distribution
Amazon EC2Elastic virtual
serversin the cloud
EC2 EC2 EC2
EC2
EC2
EC2Actual
EC2
![Page 21: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/21.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Choosing the right AMI for your instance
![Page 22: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/22.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Select the EC2 instance type
![Page 23: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/23.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• EC2 Instance Families
![Page 24: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/24.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Configure instance details
![Page 25: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/25.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Configures EC2 instance storage
![Page 26: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/26.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Using tags to identify your EC2 instances
![Page 27: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/27.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Configure Security Groups. A security group acts as a virtual
firewall that controls the traffic for one or more instances
![Page 28: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/28.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Final step: select existing or create a key pair
![Page 29: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/29.jpg)
Building an EC2 instanceChoosing the Amazon Machine Instance
(AMI)
![Page 30: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/30.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• The Get-EC2Image cmdlet retrieves a list of AMIs that you
can use.
![Page 31: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/31.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• The Get-EC2ImageByName
cmdlet filter the list of AWS Windows AMIs based on the type of server configuration you are interested in.
![Page 32: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/32.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Getting the ImageId using the Get-EC2ImageByName
cmdlet
![Page 33: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/33.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Getting the ImageId using the Get-EC2ImageByName
cmdlet
![Page 34: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/34.jpg)
Building an EC2 instanceLaunching an EC2 instance
![Page 35: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/35.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Creating an EC2 instance using New-EC2Instance cmdlet
![Page 36: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/36.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Creating an EC2 instance using New-EC2Instance cmdlet.• Using $instance_id to capture the result of the cmdlet.
![Page 37: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/37.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Using $instance_id
to capture the result of the cmdlet.
• Getting details of EC2 instance with .Instances parameter.
![Page 38: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/38.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Using Remove-EC2Instance cmdlet to stop and terminate
the EC2 Instance stored in the $ec2 variable
• Use the Select –ExpandProperty to simplify your life
![Page 39: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/39.jpg)
Building an EC2 instanceConfiguring Security Groups
![Page 40: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/40.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Using Get-EC2SecurityGroup cmdlet to list security groups
![Page 41: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/41.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Filter Security Groups and then list rules
![Page 42: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/42.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Add a new rule to existing security group
![Page 43: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/43.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Adding the new inbound rule to the Security Group
• Using the .IpPermission parameterto verify new rule was added successfullyto the Security Group
![Page 44: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/44.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Creating a new Security Group
![Page 45: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/45.jpg)
Building an EC2 instanceTagging EC2 Instances
![Page 46: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/46.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Creating a new tag
• Filter the Get-EC2Instance cmdlet results using tags
![Page 47: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/47.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Using the Get-ECTag cmdlet to filter instances
![Page 48: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/48.jpg)
Building an EC2 instanceManaging storage
![Page 49: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/49.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Create a new EBS Block Device
• Then a Block Device Mapping
![Page 50: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/50.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Add an extra EBS drive to EC2 instance when launched
• Use Get-EC2Volume cmdlet to list volumes attached to EC2 instances
![Page 51: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/51.jpg)
PowerShell Conference Singapore 2016
Building a Windows EC2 instance• Creating a new EBS volume
• Attaching EBS volume to existing EC2 Instance
![Page 52: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/52.jpg)
Managing EC2 InstancePassword
![Page 53: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/53.jpg)
PowerShell Conference Singapore 2016
Managing EC2 Instance Password• Using the Get-EC2PasswordData cmdlet to decrypt the
administrator password for EC2 instances launched using a key pair
• If you keep all key pair files in the same folder also you can type:
![Page 54: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/54.jpg)
Bootstrapping an EC2 Instance
![Page 55: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/55.jpg)
PowerShell Conference Singapore 2016
Bootstrapping an EC2 Instance• Configuring Instances with User Data
• Note: User data is limited to 16 KB in raw form, not base64-encoded form. User data is executed only at launch.
![Page 56: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/56.jpg)
Accessing localEC2 Instance Metadata
![Page 57: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/57.jpg)
PowerShell Conference Singapore 2016
Accessing local EC2 instance Metadata• Instance metadata is
data about your instance that you can use to configure or manage the running instance.
• You can only access instance metadata and user data from within the instance itself.
![Page 58: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/58.jpg)
PowerShell Conference Singapore 2016
Accessing local EC2 instance Metadata• Retrieving the metadata information from the local machine
![Page 59: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/59.jpg)
Creating VPCsand Subnets
![Page 60: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/60.jpg)
PowerShell Conference Singapore 2016
Amazon Virtual Private Cloud (VPC)• Provision a logically isolated section of the AWS cloud
• Control your virtual networking environment• Subnets• Route Tables• Security Groups• Network ACLs
• Connect to your on-premises network via hardware VPN
• Control if and how your instances access the Internet
![Page 61: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/61.jpg)
PowerShell Conference Singapore 2016
Create a VPC with Public and Private Subnets
![Page 62: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/62.jpg)
PowerShell Conference Singapore 2016
Creating the VPC• Using the New-EC2Vpc cmdlet to create a new VPC and New-EC2Tag to tag it
![Page 63: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/63.jpg)
PowerShell Conference Singapore 2016
Creating subnets• Using the New-EC2Subnet cmdlet to create public and
private subnets and New-EC2Tag to tag them
![Page 64: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/64.jpg)
PowerShell Conference Singapore 2016
Creating the Internet Gateway• The Internet Gateway connects the VPC to the Internet and
to other AWS services
• We using the New-EC2InternetGateway cmdlet to create a new IG and Add-EC2InternetGateway cmdlet to attach the IG to the VPC
![Page 65: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/65.jpg)
PowerShell Conference Singapore 2016
Creating the NAT Gateway• The NAT gateway uses Elastic IP address. This enables
instances in the private subnet to send requests to the Internet
• We are using the New-EC2Address cmdlet to get an Elastic IP address
and then New-EC2NatGateway cmdlet to create the NAT Gateway
![Page 66: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/66.jpg)
PowerShell Conference Singapore 2016
Creating Security Groups for External Access• Create rules and security groups to allow RDP and SSH from
internet
![Page 67: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/67.jpg)
PowerShell Conference Singapore 2016
Creating Security Groups for Internal Access• Create rules and security groups to allow RDP from DMZ and
unrestricted access inside private subnet
![Page 68: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/68.jpg)
PowerShell Conference Singapore 2016
Creating Routes• Create public route table rules
• Create private route table rules
![Page 69: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/69.jpg)
Creating RDP Gateway servers
![Page 70: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/70.jpg)
PowerShell Conference Singapore 2016
Building a RDP Gateway• Using User Data script to create the Remote Desktop
Gateway
• Launching the RDP Gateway on the public subnet
![Page 71: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/71.jpg)
Creating AD Domain Controllers
![Page 72: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/72.jpg)
PowerShell Conference Singapore 2016
Building a AD Domain Controller• Using User Data script to create an Active Directory domain
controller
![Page 73: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/73.jpg)
PowerShell Conference Singapore 2016
Building a AD Domain Controller• Using the New-EC2Instance cmdlet and user data to
automate the launch of an Active Directory domain controller on the private subnet
![Page 74: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/74.jpg)
CreatingWeb Servers
![Page 75: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/75.jpg)
PowerShell Conference Singapore 2016
Building a IIS Web Servers• Using User Data script to configure the IIS Web Server
• Launching the IIS Web Server on the private subnet
![Page 76: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/76.jpg)
Multi-AZ Deployments
![Page 77: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/77.jpg)
PowerShell Conference Singapore 2016
Example 3-tier Web App architecture
![Page 78: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/78.jpg)
Configuring ELB (Elastic Load Balancer)
![Page 79: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/79.jpg)
PowerShell Conference Singapore 2016
Creating an ELB• Creating a Security Group for the ELB
• Creating the ELB Listener
![Page 80: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/80.jpg)
PowerShell Conference Singapore 2016
Creating an ELB (continues)• Using the New-ELBLoadBalancer cmdlet to launch the ELB
• Configuring ELB health check settings with the Set-ELBHealthCheck cmdlet
![Page 81: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/81.jpg)
Configuring EC2 Auto Scaling
![Page 82: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/82.jpg)
PowerShell Conference Singapore 2016
Creating an Auto Scaling group• Creating a Security Group for the Auto Scaling Group
• User Data to bootstrap the web server
![Page 83: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/83.jpg)
PowerShell Conference Singapore 2016
Creating an Auto Scaling group (continues)• Using the New-ASLaunchConfiguration cmdlet to
configure the EC2 instance configuration
• Finally, using the New-ASAutoScalingGroup cmdlet to create and launch the Auto Scaling Group
![Page 84: Dev Ops on AWS with PowerShell (PowerShell Conference Asia 2016)](https://reader033.fdocuments.net/reader033/viewer/2022042707/586e73461a28ab99598b5407/html5/thumbnails/84.jpg)
PowerShell Conference Singapore 2016
Sample code available athttps://github.com/guillermo-musumeci/PowerShell
Thank you!Guillermo Musumeci
@gmusumeci