aws:aws-cloudformation_big_example
Differences
This shows you the differences between two versions of the page.
| aws:aws-cloudformation_big_example [02/04/2024 13:26] – created - external edit 127.0.0.1 | aws:aws-cloudformation_big_example [30/05/2025 09:42] (current) – removed andrew | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ===== BIG Example ===== | ||
| - | |||
| - | From a course. | ||
| - | |||
| - | <code yaml> | ||
| - | $ aws cloudformation get-template --stack-nameMyStack --query TemplateBody --output text | ||
| - | |||
| - | AWSTemplateFormatVersion: | ||
| - | Description: | ||
| - | Template to build the Web Tier | ||
| - | Parameters: | ||
| - | VPCID: | ||
| - | Description: | ||
| - | Type: String | ||
| - | PUBSUBA: | ||
| - | Description: | ||
| - | Type: String | ||
| - | PUBSUBB: | ||
| - | Description: | ||
| - | Type: String | ||
| - | AppNamePram: | ||
| - | Description: | ||
| - | Type: String | ||
| - | AppVerPram: | ||
| - | Description: | ||
| - | Type: String | ||
| - | CodeBucketPram: | ||
| - | Description: | ||
| - | Type: String | ||
| - | CodeObjectKeyPram: | ||
| - | Description: | ||
| - | Type: String | ||
| - | |||
| - | KeyName: | ||
| - | Type: AWS:: | ||
| - | Description: | ||
| - | ApiElbDns: | ||
| - | Type: String | ||
| - | Description: | ||
| - | SaveElbDns: | ||
| - | Type: String | ||
| - | Description: | ||
| - | | ||
| - | Mappings: | ||
| - | AmazonLinuxAMI: | ||
| - | ap-southeast-1: | ||
| - | AMI: ami-c9b572aa | ||
| - | ap-southeast-2: | ||
| - | AMI: ami-f2210191 | ||
| - | sa-east-1: | ||
| - | AMI: ami-1e159872 | ||
| - | |||
| - | Resources: | ||
| - | # Networking | ||
| - | AppTierSG: | ||
| - | Type: AWS:: | ||
| - | DependsOn: | ||
| - | - MadLibSiteELB | ||
| - | Properties: | ||
| - | | ||
| - | | ||
| - | Tags: | ||
| - | - Key: " | ||
| - | | ||
| - | - Key: " | ||
| - | | ||
| - | - Key: " | ||
| - | | ||
| - | | ||
| - | - IpProtocol: tcp | ||
| - | | ||
| - | | ||
| - | | ||
| - | - IpProtocol: tcp | ||
| - | | ||
| - | | ||
| - | | ||
| - | ELBsg: | ||
| - | Type: AWS:: | ||
| - | Properties: | ||
| - | | ||
| - | | ||
| - | Tags: | ||
| - | - Key: " | ||
| - | | ||
| - | - Key: " | ||
| - | | ||
| - | - Key: " | ||
| - | | ||
| - | | ||
| - | - IpProtocol: tcp | ||
| - | | ||
| - | | ||
| - | | ||
| - | MadLibSiteELB: | ||
| - | Type: " | ||
| - | DependsOn: | ||
| - | - ELBsg | ||
| - | Properties: | ||
| - | CrossZone: true | ||
| - | HealthCheck: | ||
| - | HealthyThreshold: | ||
| - | Interval: 60 | ||
| - | Target: HTTP: | ||
| - | Timeout: 59 | ||
| - | UnhealthyThreshold: | ||
| - | LoadBalancerName: | ||
| - | Listeners: | ||
| - | - InstancePort: | ||
| - | InstanceProtocol: | ||
| - | LoadBalancerPort: | ||
| - | Protocol: HTTP | ||
| - | Scheme: internet-facing | ||
| - | SecurityGroups: | ||
| - | - !Ref ELBsg | ||
| - | Subnets: | ||
| - | - !Ref PUBSUBA | ||
| - | - !Ref PUBSUBB | ||
| - | |||
| - | # IAM Setup | ||
| - | CodeDeployRole: | ||
| - | Type: " | ||
| - | Properties: | ||
| - | AssumeRolePolicyDocument: | ||
| - | Statement: | ||
| - | - Effect: " | ||
| - | Principal: | ||
| - | Service: | ||
| - | - ' | ||
| - | Action: | ||
| - | - ' | ||
| - | |||
| - | Path: '/' | ||
| - | Policies: | ||
| - | - PolicyName: " | ||
| - | PolicyDocument: | ||
| - | Statement: | ||
| - | - Effect: " | ||
| - | Action: [' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | ' | ||
| - | Resource: | ||
| - | ' | ||
| - | AppRole: | ||
| - | Type: " | ||
| - | Properties: | ||
| - | AssumeRolePolicyDocument: | ||
| - | Statement: | ||
| - | - Effect: " | ||
| - | Principal: | ||
| - | Service: | ||
| - | - ' | ||
| - | Action: | ||
| - | - ' | ||
| - | |||
| - | Path: '/' | ||
| - | Policies: | ||
| - | - PolicyName: MabLib-App-Policy | ||
| - | PolicyDocument: | ||
| - | Statement: | ||
| - | - Effect: Allow | ||
| - | Action: [' | ||
| - | ' | ||
| - | Resource: | ||
| - | ' | ||
| - | # Code Deploy | ||
| - | InstProfMadLibSite: | ||
| - | Type: " | ||
| - | | ||
| - | - AppRole | ||
| - | | ||
| - | | ||
| - | - !Ref AppRole | ||
| - | | ||
| - | MadLibsSite: | ||
| - | Type: " | ||
| - | WebAppDeplyGroup: | ||
| - | Type: " | ||
| - | DependsOn: | ||
| - | - MadLibsSite | ||
| - | - CodeDeployRole | ||
| - | Properties: | ||
| - | # AlarmConfiguration: | ||
| - | |||
| - | ApplicationName: | ||
| - | DeploymentConfigName: | ||
| - | DeploymentGroupName: | ||
| - | AutoScalingGroups: | ||
| - | - !Ref WebServersAutoScalingGroup | ||
| - | Deployment: | ||
| - | Description: | ||
| - | !Sub | | ||
| - | Deploying App ${AppNamePram} Version-${AppVerPram} | ||
| - | IgnoreApplicationStopFailures: | ||
| - | Revision: | ||
| - | RevisionType: | ||
| - | S3Location: | ||
| - | Bucket: !Ref CodeBucketPram | ||
| - | Key: !Ref CodeObjectKeyPram | ||
| - | BundleType: Zip | ||
| - | # Would Suggest you use this feature to ensure that the correct package gets deployed | ||
| - | # ETag: !Ref CodePackageETagPram | ||
| - | Ec2TagFilters: | ||
| - | - Key: App | ||
| - | Value: !Ref AppNamePram | ||
| - | Type: " | ||
| - | ServiceRoleArn: | ||
| - | WebAppDeplyConfig: | ||
| - | Type: " | ||
| - | DependsOn: | ||
| - | - MadLibsSite | ||
| - | Properties: | ||
| - | DeploymentConfigName: | ||
| - | MinimumHealthyHosts: | ||
| - | Type: " | ||
| - | Value: 50 | ||
| - | WebServersAutoScalingGroup: | ||
| - | Type: " | ||
| - | DependsOn: | ||
| - | - WebServersLaunchConfig | ||
| - | - AppTierSG | ||
| - | - MadLibSiteELB | ||
| - | UpdatePolicy: | ||
| - | AutoScalingReplacingUpdate: | ||
| - | WillReplace: | ||
| - | Properties: | ||
| - | Cooldown: 60 | ||
| - | DesiredCapacity: | ||
| - | HealthCheckGracePeriod: | ||
| - | LaunchConfigurationName: | ||
| - | LoadBalancerNames: | ||
| - | - !Ref MadLibSiteELB | ||
| - | MaxSize: 4 | ||
| - | MinSize: 1 | ||
| - | VPCZoneIdentifier: | ||
| - | - !Ref PUBSUBA | ||
| - | - !Ref PUBSUBB | ||
| - | Tags: | ||
| - | - Key: " | ||
| - | | ||
| - | | ||
| - | - Key: " | ||
| - | | ||
| - | | ||
| - | - Key: " | ||
| - | | ||
| - | | ||
| - | |||
| - | # AutoScaling | ||
| - | WebServersLaunchConfig: | ||
| - | Type: " | ||
| - | DependsOn: | ||
| - | - AppTierSG | ||
| - | - AppRole | ||
| - | Properties: | ||
| - | IamInstanceProfile: | ||
| - | ImageId: !FindInMap [AmazonLinuxAMI, | ||
| - | InstanceMonitoring: | ||
| - | InstanceType: | ||
| - | KeyName: !Ref KeyName | ||
| - | SecurityGroups: | ||
| - | - !Ref AppTierSG | ||
| - | UserData: | ||
| - | ' | ||
| - | !Sub | | ||
| - | #!/bin/bash -ex | ||
| - | |||
| - | # Env Setup | ||
| - | echo " | ||
| - | echo " | ||
| - | source ~/.bashrc | ||
| - | |||
| - | # Updates & Install | ||
| - | yum update -y | ||
| - | yum install -y ruby wget | ||
| - | |||
| - | cd / | ||
| - | wget https:// | ||
| - | chmod +x ./install | ||
| - | |||
| - | ./install auto | ||
| - | Outputs: | ||
| - | WebTierDNS: | ||
| - | Description: | ||
| - | Value: !GetAtt MadLibSiteELB.DNSName | ||
| - | |||
| - | [ec2-user@ip-10-96-10-231 ~]$ | ||
| - | </ | ||
| - | |||
| - | |||
| - | |||
| - | |||
| - | This page has been accessed for:- \\ | ||
| - | Today: {{counter|today}} \\ | ||
| - | Yesterday: {{counter|yesterday}} \\ | ||
| - | Until now: {{counter|total}} \\ | ||
| - | |||
aws/aws-cloudformation_big_example.1712064378.txt.gz · Last modified: by 127.0.0.1
