Skip to main content

Get in CloudFormation; A Timeline learning IaC for AWS

 A big shoutout to Pluralsight for their free weekend, and James Millar for a great introductory course. For the longest time, I couldn't see how people found this easy, but this helped.

(Why did we make up so many programming languages that only work based upon the correct formatting of spaces and tabs? Readability is important, but when you're just beginning, how I learn, I'm interested in 'it works' first and 'it's pretty' second).

Anyway, let's see what I learned from CloudFormation.

You can use a nifty GUI getup to drag and drop elements to create a JSON file;

 

 


It's not as easy at it seems, as I had to ask myself important questions:

 

What's the difference between a host and an instance?

Minutia; One's more expensive per hour.

 

 This required me to make Mac Virtual Machines; A first. It seems to only be avaiable in the East Virginia region through EC2; No word on if it's the same in CloudFormation.

If I have an EC2 Instance, what phrase would I need to tie it to a Firewall I make? (ex. 'SecurityGroupIds' ties to the security group being made in the file. Would it be FirewallIds?)


Tasks:

Create a KeyPair (Easy)
Place in A Firewall with rules about access (Hm.)
Look at it in JAMF on a web portal (Another fun challenge!)

The Firewall part had the clearest documentation in AWS' CloudFormation section.

Type: AWS::NetworkFirewall::Firewall
Properties: 
  DeleteProtection: Boolean
  Description: String
  FirewallName: String
  FirewallPolicyArn: String
  FirewallPolicyChangeProtection: Boolean
  SubnetChangeProtection: Boolean
  SubnetMappings: 
    - SubnetMapping
  Tags: 
    - Tag
  VpcId: String

The 'header', so to speak, section is the part right after Type - AWS::NetworkFirewall::Firewall.

But somehow, they didn't have a page for the header type for integrating Key Pairs that I found. It doesn't go where I thought it should go, it goes under Parameters for the Instance.

Turns out, lots of people haven't migrated to Firewalls in CF yet. Security Groups, at a basic level, get the job done for their purposes. At least I have a good start on using AWS Firewalls.

 

 

Another thing is how touchy AWS is about putting certain resources in certain regions.

API: ec2:RunInstances Not authorized for images showed up when I tried to push a sample stack - This is a sample AWS gave me, and it didn't work in the Ohio region. Some samples are limited to certain regions - something I learned from a third-party video. Consider making Amazon-given samples accessible to all regions.

A lot of things were straightened out the more I learned - like hitting Template and Edit in Designer when a stack failed to launch.

The fact that it doesn't check the fields of things that must be specified until the end is a real pain. To its credit, it will throw all of the errors at you if they relate to other network elements - If there are errors in the EC2 instance, those are separate from those in a Firewall.

I didn't have a lot of the Properties under my AWS::EC2::Route section; Remember the documentation says a lot of them aren't required. And yet;



So is there another part of my template making it necessary? Such as 'Oh, you have part A, now you need part B so it all works'?

I was eventually lead down the path of circular dependencies; Shout out to the 2nd piece of useful documentation I've come across about AWS CloudFormation.


Also got to use curl and AWS CLI. Once again, AWS Documentation was a little too high level for a beginner, so Cloud Academy came through with how to actually set it up after it was installed. At least 3 times on Twitter I had to ask the general population if it was intended to be this unclear, and 3 times the AWS team apologized and told me to submit feedback. I thought it was just me, but no, their documentation confuses many people.

To their credit, AWS did come through with the actual commands; Well done! I connected via the console and bungled setting up the credentials through 'aws configuration' line. Luckily, I learned that's a very insecure method of securing an EC2 instance, and found a better way that involves policies and IAMs.



Their course on Udemy is great, and thank you again to a LI connection for the gifted course!

There are quirks in the programming; Most of the time, I've found !Ref works. But when making a firewall, it preferred Fn::GetAtt [name,name].


After lots of trial, error, and help, I managed to push an instance and some buckets - I can even log into the instance!

Comments

Popular posts from this blog

What Do You Need? [AKA; List of Offered Services / My Next Role] (2020)

UPDATED 2021 I am a trusted outsourced remote consultant for your company.   I enjoy having the flexibility to take on temporary projects from time to time! I start at part-time, temp work for now. If we like each other, we can renegotiate. If anything sounds weird, out there, or unusual - Feel free to e-mail me .  3 Services Offered Technical: Cloud Technician     Azure [ See tag ] WORKING ON: Infrastructure As Code (Specifically Terraform/Azure and CloudFormation/AWS)  Support [Web: Example Job Description ] [Text : Example Description ]     I help you with adjustments in HTML, CSS, and Javascript.     When you email a business a question and they answer? That's me.   IT Operations Tech [ Example Job Description ]     Hardware and SaaS support.     Cisco routing and switching (Networking). CCNA, A+, Sec+, Azure certified WORKING ON: Junos Networking  Writing :      You want to pay me to write more of *waves hand* this blog? I am game .     I write B2C e-mails going out to o

Contactless Tech’s Role in the New Guest Experience ft. Intelity and The George

 Contactless hospitality technology is growing. You want to get away, and you'll be damned if a little thing like a deadly virus will stop you! But you still don't want to touch things. Ew. During the chat between INTELITY CEO Robert Stevenson and THE GEORGE Director of Operations Kerrie Hunter, you’ll learn how the historic boutique hotel has adapted a mobile-first guest experience in the wake of COVID-19—and how they see contactless technology affecting the future of hospitality. I don't remember how I found INTELITY (probably hoping to score a position with them), but I liked them enough to stay on the e-mail lists.  

Connecting IoT Devices to a Registration Server (Packet Tracer, Cisco)

In Packet Tracer, a demo software made by Cisco Systems. It certainly has changed a lot since 2016. It's almost an Olympic feat to even get started with it now, but it does look snazzy. This is for the new CCNA, that integrates, among other things, IoT and Automation, which I've worked on here before. Instructions here . I don't know if this is an aspect of "Let's make sure people are paying attention and not simply following blindly", or an oversight - The instructions indicate a Meraki Server, when a regular one is the working option here. I have to enable the IoT service on this server. Also, we assign the server an IPv4 address from a DHCP pool instead of giving it a static one. For something that handles our IoT business, perhaps that's safer; Getting a new IPv4 address every week or so is a minimal step against an intruder, but it is a step. There are no devices associated with this new server; In an earlier lab (not shown), I attached them to 'H