Coder Social home page Coder Social logo

mchadds / aws-cloudformation-iac Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 13 KB

Automated (& programmatic) deployment of an EC2 instance with Security Groups and Web Server via CloudFormation stack - utilizing Infrastructure as Code.

Shell 100.00%

aws-cloudformation-iac's Introduction

AWS-CloudFormation-IaC

Automated (& programmatic) deployment of an EC2 instance with Security Groups and Web Server via CloudFormation stack - utilizing Infrastructure as Code.

Description

All commands were executed through the Cloud9 CLI to

  • Create an S3 bucket
  • Bash commands in update.sh used for copying the .yaml file to the bucket and creating the CloudFormation stack
  • template.yaml holds IaC template for the EC2 instance

Infrastructure as Code

Detailed infrastructure template found in template.yaml:

AWSTemplateFormatVersion: 2010-09-09
Description: >- 
    Infrastructure for EC2 Instance
Parameters: 
    ImageId:
        Description: AMI to use eg. ami-047a51fa27710816e
        Default: ami-047a51fa27710816e
        Type: String
    VpcId: 
        Description: The VPC used by the SG
        Type: String
Resources: 
    WebServer:
        Type: AWS::EC2::Instance
        Properties:
            InstanceType: t2.micro
            ImageId: !Ref ImageId
            SecurityGroupIds:
                !GetAtt SecurityGroup.GroupId
            UserData:
                'Fn::Base64':
                    !Sub |
                        #!/usr/bin/env bash
                        yum -y update
                        su ec2-user
                        sudo yum install httpd -y
                        sudo service httpd start
                        sudo service httpd enable
    SecurityGroup:
        Type: AWS::EC2::SecurityGroup
        Properties: 
            VpcId: !Ref VpcId
            GroupDescription: 'Open port 80'
            SecurityGroupIngress:
                -   IpProtocol: tcp
                    FromPort: 80
                    ToPort: 80
                    CidrIp: "0.0.0.0/0"
Outputs:
    PublicIp:
        Value: !GetAtt WebServer.PublicIp

Tools

  • Cloud9 Cloud IDE
  • CloudFormation Cloud provisioning with Infrastructure as Code
  • EC2 Secure and resizable compute capacity
  • S3 Cloud storage

aws-cloudformation-iac's People

Contributors

mchadds avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.