Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added changes #53

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions 11-parameter-store/11-1-1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
AWSTemplateFormatVersion: '2010-09-09'
Description: 'Lab 11.1.1'

Parameters:
Name:
Type: String

UserName:
Type: String

Title:
Type: String

StreetAddress:
Type: String

City:
Type: String

State:
Type: String
Default: MD
MaxLength: "2"
MinLength: "2"
AllowedPattern: "^[A-Z]{2}$"

TimeZone:
Type: String
Default: EST
MaxLength: "3"
MinLength: "3"

StartDate:
Type: String
Default: "2022-06-20"

Team:
Type: String

Resources:
ineerUserName:
Type: AWS::SSM::Parameter
Properties:
Name: !Sub /${UserName}/UserName
Type: String
Value: !Ref UserName

ineerName:
Type: AWS::SSM::Parameter
Properties:
Name: !Sub /${UserName}/Name
Type: String
Value: !Ref Name

ineerAddress:
Type: AWS::SSM::Parameter
Properties:
Name: !Sub /${UserName}/Address
Type: String
Value: !Ref StreetAddress

ineerTitle:
Type: AWS::SSM::Parameter
Properties:
Name: !Sub /${UserName}/Title
Type: String
Value: !Ref Title

ineerState:
Type: AWS::SSM::Parameter
Properties:
Name: !Sub /${UserName}/State
Type: String
Value: !Ref State

ineerCity:
Type: AWS::SSM::Parameter
Properties:
Name: !Sub /${UserName}/City
Type: String
Value: !Ref City

ineerTimeZone:
Type: AWS::SSM::Parameter
Properties:
Name: !Sub /${UserName}/TimeZone
Type: String
Value: !Ref TimeZone

ineerTeam:
Type: AWS::SSM::Parameter
Properties:
Name: !Sub /${UserName}/Team
Type: String
Value: !Ref Team

ineerStartDate:
Type: AWS::SSM::Parameter
Properties:
Name: !Sub /${UserName}/StartDate
Type: String
Value: !Ref StartDate
182 changes: 182 additions & 0 deletions 11-parameter-store/11-1-3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
TopLevelParameter:
Type: AWS::SSM::Parameter::Name
Default: /fidelis.ogunsanmi.labs/UserName
Description: "User Name for the engineer"

UserName:
Type: AWS::SSM::Parameter::Value<String>
Default: /fidelis.ogunsanmi.labs/UserName

Name:
Type: AWS::SSM::Parameter::Value<String>
Default: /fidelis.ogunsanmi.labs/Name

StreetAddress:
Type: AWS::SSM::Parameter::Value<String>
Default: /fidelis.ogunsanmi.labs/Address

City:
Type: AWS::SSM::Parameter::Value<String>
Default: /fidelis.ogunsanmi.labs/City

Team:
Type: AWS::SSM::Parameter::Value<String>
Default: /fidelis.ogunsanmi.labs/Team

StartDate:
Type: AWS::SSM::Parameter::Value<String>
Default: /fidelis.ogunsanmi.labs/StartDate

Timezone:
Type: AWS::SSM::Parameter::Value<String>
Default: /fidelis.ogunsanmi.labs/TimeZone

Title:
Type: AWS::SSM::Parameter::Value<String>
Default: /fidelis.ogunsanmi.labs/Title

State:
Type: AWS::SSM::Parameter::Value<String>
Default: /fidelis.ogunsanmi.labs/State

Resources:
ALBSG:
Type: "AWS::EC2::SecurityGroup"
Properties:
GroupDescription: "security group for ALB"
GroupName: "test-ALB-SG"
VpcId: !ImportValue fidelisVpc
SecurityGroupIngress:
-
CidrIp: "0.0.0.0/0"
FromPort: 80
IpProtocol: "tcp"
ToPort: 80
-
CidrIp: "0.0.0.0/0"
FromPort: 443
IpProtocol: "tcp"
ToPort: 443

ALB:
Type: "AWS::ElasticLoadBalancingV2::LoadBalancer"
Properties:
Name: "test-Application-Load-Balancer"
Scheme: "internet-facing"
Type: "application"
Subnets:
- !ImportValue fidelisPubSubnet
- !ImportValue fidelisPubSubnet2
SecurityGroups:
- !Ref ALBSG
IpAddressType: "ipv4"

TargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
HealthCheckEnabled: true
HealthCheckPath: "/BADindex.html"
HealthCheckPort: "traffic-port"
HealthCheckProtocol: HTTP
HealthyThresholdCount: 2
UnhealthyThresholdCount: 2
HealthCheckIntervalSeconds: 30
HealthCheckTimeoutSeconds: 5
VpcId: !ImportValue fidelisVpc
Protocol: HTTP
Port: 80
Matcher:
HttpCode: "200"
TargetGroupAttributes:
- Key: deregistration_delay.timeout_seconds
Value: "20"

MyAlbListener:
Type: AWS::ElasticLoadBalancingV2::Listener
Properties:
LoadBalancerArn: !Ref ALB
Port: 80
Protocol: "HTTP"
DefaultActions:
- Order: 1
TargetGroupArn: !Ref TargetGroup
Type: "forward"

WebServerAsg:
Type: 'AWS::AutoScaling::AutoScalingGroup'
Properties:
AutoScalingGroupName: 'AutomationBoxes'
VPCZoneIdentifier:
- !ImportValue fidelisPubSubnet
- !ImportValue fidelisPubSubnet2
DesiredCapacity: '3'
HealthCheckType: 'ELB'
HealthCheckGracePeriod: 30
LaunchConfigurationName: !Ref WebServersLC
MaxSize: '3'
MinSize: '3'
TargetGroupARNs:
- !Ref TargetGroup

WebServersLC:
Type: 'AWS::AutoScaling::LaunchConfiguration'
Properties:
ImageId: 'ami-0cff7528ff583bf9a'
InstanceType: 't2.micro'
LaunchConfigurationName: 'SimpleWebServerLC'
SecurityGroups:
- !ImportValue InstancegroupID
UserData:
Fn::Base64:
Fn::Sub: |
#!/bin/bash -xe

yum install -y aws-cfn-bootstrap

# Install the files and packages from the metadata
/opt/aws/bin/cfn-init -v \
--stack ${AWS::StackName} \
--resource WebServersLC \
--configsets All \
--region ${AWS::Region}

# Signal the status from cfn-init
/opt/aws/bin/cfn-signal -e $? \
--stack ${AWS::StackName} \
--resource WebServersLC \
--region ${AWS::Region}

Metadata:
'AWS::CloudFormation::Init':
configSets:
All:
- ConfigureStelligentProject
ConfigureStelligentProject:
packages:
yum:
nginx: []
files:
/usr/share/nginx/html/index.html:
content: !Sub |
<H1>Automation for ${TopLevelParameter}</H1>
<p>UserName: ${UserName}</p>
<p>Full Name: ${Name}</p>
<p>Title: ${Title}</p>
<p>Address: ${StreetAddress}, ${City}, ${State}</p>
<p>Time Zone: ${Timezone}</p>
<p>Team Name: ${Team}</p>
<p>Start Date ${StartDate}</p>
mode: '000644'
owner: root
group: root
services:
sysvinit:
nginx:
enabled: 'true'
ensureRunning: 'true'




Loading