Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello, CloudFormation! Learning Objectives At the end of the assignment you will

ID: 3746937 • Letter: H

Question

Hello, CloudFormation!

Learning Objectives

At the end of the assignment you will be able to:

Create a CloudFormation template that uses parameters

Create a CloudFormation template that uses mappings

Install software and make configurations using a CloudFormation template

Requirements

ubuntu-nginx.yaml

Create a CloudFormation YAML template with the name, ubuntu-nginx.yaml, that will create an Ubuntu 16.04 server in the current AWS region, running the nginx web server. The nginx server must be running on your server. Hint: While developing this template, you probably want to spin up an Ubuntu 16.04 instance and do the install of nginx manually first to see what it takes.

You must have mappings for AMIs in all of the AWS regions.

Your must have template must have parameters for the following:

the key pair to use for connecting to the instance via ssh

the allowed CIDR block that ssh is allowed on, with a default of USF's CIDR block.

Your security group must allow ssh connections only from the specified CIDR block, and web connections from anywhere.

Your template must create a default index.html page in the appropriate location that displays the following: Your name in an h1 header and the title of the page. So for instance, my page would have Dr. Ventura in both the title and h1 header.

Extra Credit Also include the server's public DNS name and AWS region in index.html. For public DNS name, the naive implementation will lead to circular dependencies. Hint: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html (Links to an external site.)Links to an external site.. You are not required to do this step. However, if you do you will get 5 points (out of 100) extra credit.

What to Submit

Submit your ubuntu-nginx.yaml as an attachment to the assignment.

Explanation / Answer

Parameters

Utilize the discretionary Parameters area to modify your formats. Parameters empower you to include custom qualities to your format each time you make or refresh a stack.

Characterizing a Parameter in a Template

The accompanying case pronounces a parameter named InstanceTypeParameter. This parameter gives you a chance to determine the Amazon EC2 case compose for the stack to utilize when you make or refresh the stack.

Note that InstanceTypeParameter has a default estimation of t2.micro. This is the esteem that AWS CloudFormation uses to arrangement the stack except if another esteem is given.

JSON

"Parameters" : {

"InstanceTypeParameter" : {

"Sort" : "String",

"Default" : "t2.micro",

"AllowedValues" : ["t2.micro", "m1.small", "m1.large"],

"Depiction" : "Enter t2.micro, m1.small, or m1.large. Default is t2.micro."

}

}

YAML

Parameters:

InstanceTypeParameter:

Sort: String

Default: t2.micro

AllowedValues:

- t2.micro

- m1.small

- m1.large

Depiction: Enter t2.micro, m1.small, or m1.large. Default is t2.micro.

Referencing a Parameter inside a Template

You utilize the Ref inborn capacity to reference a parameter, and AWS CloudFormation utilizes the parameter's an incentive to arrangement the stack. You can reference parameters from the Resources and Outputs areas of a similar format.

In the accompanying case, the InstanceType property of the EC2 occasion asset references the InstanceTypeParameter parameter esteem:

JSON

"Ec2Instance" : {

"Sort" : "AWS::EC2::Instance",

"Properties" : {

"InstanceType" : { "Ref" : "InstanceTypeParameter" },

"ImageId" : "ami-0ff8a91507f77f867"

}

}

YAML

Ec2Instance:

Sort: AWS::EC2::Instance

Properties:

InstanceType:

Ref: InstanceTypeParameter

ImageId: ami-0ff8a91507f77f867

General Requirements for Parameters

The accompanying prerequisites apply when utilizing parameters:

You can have a greatest of 60 parameters in an AWS CloudFormation layout.

Every parameter must be given a sensible name (additionally called consistent ID), which must be alphanumeric and exceptional among every single legitimate name inside the layout.

Every parameter must be appointed a parameter compose that is bolstered by AWS CloudFormation. For more data, see Type.

Every parameter must be alloted an incentive at runtime for AWS CloudFormation to effectively arrangement the stack. You can alternatively determine a default an incentive for AWS CloudFormation to utilize except if another esteem is given.

Parameters must be proclaimed and referenced from inside a similar layout. You can reference parameters from the Resources and Outputs areas of the format.

JSON

"Parameters" : {

"ParameterLogicalID" : {

"Sort" : "DataType",

"ParameterProperty" : "esteem"

}

}

YAML

Parameters:

ParameterLogicalID:

Sort: DataType

ParameterProperty: esteem

Properties

AllowedPattern

A normal articulation that speaks to the examples to take into account String composes.

Required: No

AllowedValues

An exhibit containing the rundown of qualities took into account the parameter.

Required: No

ConstraintDescription

A string that clarifies an imperative when the limitation is damaged. For instance, without a limitation portrayal, a parameter that has a permitted example of [A-Za-z0-9]+ showcases the accompanying mistake message when the client indicates an invalid esteem:

Deformed information Parameter MyParameter must match design [A-Za-z0-9]+

By including a limitation portrayal, for example, should just contain letters (capitalized and lowercase) and numbers, you can show the accompanying altered mistake message:

Deformed info Parameter MyParameter should just contain capitalized and lowercase letters and numbers

Required: No

Default

An estimation of the proper kind for the format to utilize if no esteem is determined when a stack is made. In the event that you characterize requirements for the parameter, you should determine an esteem that clings to those imperatives.

Required: No

Depiction

A string of up to 4000 characters that depicts the parameter.

Required: No

MaxLength

A whole number esteem that decides the biggest number of characters you need to take into account String composes.

Required: No

MaxValue

A numeric esteem that decides the biggest numeric esteem you need to consider Number composes.

Required: No

MinLength

A whole number esteem that decides the most modest number of characters you need to take into account String composes.

Required: No

MinValue

A numeric esteem that decides the littlest numeric esteem you need to take into consideration Number composes.

Required: No

NoEcho

Regardless of whether to veil the parameter esteem when a call is made that depicts the stack. On the off chance that you set the incentive to genuine, the parameter esteem is veiled with indicators (*****).

Required: No

Sort

The information compose for the parameter (DataType).

Required: Yes

AWS CloudFormation bolsters the accompanying parameter composes:

String

An exacting string.

For instance, clients could determine "MyUserName".

Number

A whole number or buoy. AWS CloudFormation approves the parameter esteem as a number; be that as it may, when you utilize the parameter somewhere else in your layout (for instance, by utilizing the Ref characteristic capacity), the parameter esteem turns into a string.

For instance, clients could determine "8888".

List<Number>

A variety of whole numbers or buoys that are isolated by commas. AWS CloudFormation approves the parameter esteem as numbers; be that as it may, when you utilize the parameter somewhere else in your layout (for instance, by utilizing the Ref inborn capacity), the parameter esteem turns into a rundown of strings.

For instance, clients could determine "80,20", and a Ref would result in ["80","20"].

CommaDelimitedList

A variety of exacting strings that are isolated by commas. The aggregate number of strings ought to be one more than the aggregate number of commas. Likewise, every part string is space trimmed.

For instance, clients could indicate "test,dev,prod", and a Ref would result in ["test","dev","prod"].

AWS-Specific Parameter Types

AWS esteems, for example, Amazon EC2 key combine names and VPC IDs. For more data, see AWS-Specific Parameter Types.

SSM Parameter Types

Parameters that relate to existing parameters in Systems Manager Parameter Store. You indicate a Systems Manager parameter key as the estimation of the SSM parameter, and AWS CloudFormation gets the most recent incentive from Parameter Store to use for the stack. For more data, see SSM Parameter Types.

Note

AWS CloudFormation doesn't right now bolster the SecureString Systems Manager parameter compose.

AWS-Specific Parameter Types

For AWS-particular parameter composes, layout clients must determine existing AWS esteems that are in their record. AWS CloudFormation approves these parameter esteems against existing qualities in clients' AWS accounts. AWS-particular parameter composes are useful in getting invalid qualities toward the beginning of making or refreshing a stack.

AWS CloudFormation approves input esteems for these sorts against existing qualities in a client's record. For instance, with the AWS::EC2::VPC::Id compose, a client must enter a current VPC ID that is in the client's record and in the locale in which the client is making the stack.

Upheld AWS-Specific Parameter Types

AWS CloudFormation underpins the accompanying AWS-particular composes:

AWS::EC2::AvailabilityZone::Name

An Availability Zone, for example, us-west-2a.

AWS::EC2::Image::Id

An Amazon EC2 picture ID, for example, ami-0ff8a91507f77f867. Note that the AWS CloudFormation support doesn't demonstrate a drop-down rundown of qualities for this parameter compose.

AWS::EC2::Instance::Id

An Amazon EC2 occurrence ID, for example, I-1e731a32.

AWS::EC2::KeyPair::KeyName

An Amazon EC2 key combine name.

AWS::EC2::SecurityGroup::GroupName

An EC2-Classic or default VPC security amass name, for example, my-sg-abc.

AWS::EC2::SecurityGroup::Id

A security amass ID, for example, sg-a123fd85.

AWS::EC2::Subnet::Id

A subnet ID, for example, subnet-123a351e.

AWS::EC2::Volume::Id

An Amazon EBS volume ID, for example, vol-3cdd3f56.

AWS::EC2::VPC::Id

A VPC ID, for example, vpc-a123baa3.

AWS::Route53::HostedZone::Id

An Amazon Route 53 facilitated zone ID, for example, Z23YXV4OVPL04A.

List<AWS::EC2::AvailabilityZone::Name>

A variety of Availability Zones for a district, for example, us-west-2a, us-west-2b.

List<AWS::EC2::Image::Id>

A variety of Amazon EC2 picture IDs, for example, ami-0ff8a91507f77f867, ami-0a584ac55a7631c0c. Note that the AWS CloudFormation support doesn't demonstrate a drop-down rundown of qualities for this parameter compose.

List<AWS::EC2::Instance::Id>

A variety of Amazon EC2 example IDs, for example, I-1e731a32, I-1e731a34.

List<AWS::EC2::SecurityGroup::GroupName>

A variety of EC2-Classic or default VPC security bunch names, for example, my-sg-abc, my-sg-def.

List<AWS::EC2::SecurityGroup::Id>

A variety of security bunch IDs, for example, sg-a123fd85, sg-b456fd85.

List<AWS::EC2::Subnet::Id>

A variety of subnet IDs, for example, subnet-123a351e, subnet-456b351e.

List<AWS::EC2::Volume::Id>

A variety of Amazon EBS volume IDs, for example, vol-3cdd3f56, vol-4cdd3f56.

List<AWS::EC2::VPC::Id>

A variety of VPC IDs, for example, vpc-a123baa3, vpc-b456baa3.

List<AWS::Route53::HostedZone::Id>

A variety of Amazon Route 53 facilitated zone IDs, for example, Z23YXV4OVPL04A, Z23YXV4OVPL04B.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote