DEV Community

nithinalias
nithinalias

Posted on

AWS Automation

Introduction CloudFormation

Template snippets

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/CHAP_TemplateQuickRef.html

Enter fullscreen mode Exit fullscreen mode

Management Tool - cloudFormation - create new stack - Upload a template to Amazon S3 - choose file(file is shown below) - your region should be exact as ImageId - Next - add stack,keyname - Next - Next - create - click on stack name - you could see all in detail - Go to EC2 you could see your Instance

Resources:
  MyEC2Instance:
    Type: 'AWS::EC2::Instance'
    Properties:
      InstanceType: t2.micro
      ImageId: ami-0de53d8956e8dcf80
      KeyName: !Ref KeyName
      SecurityGroups:
        - !Ref InstanceSecurityGroup
      Tags:
        - Key: Name
          Value: My CF Instance
  InstanceSecurityGroup:
    Type: 'AWS::EC2::SecurityGroup'
    Properties:
      GroupName: MyDMZSecurityGroup
      GroupDescription: Enable SSH access via port 22
      SecurityGroupIngress:
        IpProtocol: tcp
        FromPort: 22
        ToPort: 22
        CidrIp: 0.0.0.0/0

Outputs: 
  InstanceID:
    Description: The Instance ID
    Value: !Ref MyEC2Instance

Enter fullscreen mode Exit fullscreen mode

Management Tool - cloudFormation - select stack - Action - Delete stack - yes Delete - Go to S3 - click on the bucket containing template - click on the template file - make public - click on the link you could see the the template - After cloudformation delete finishes you can delete this bucket.

Introduction Beanstalk

Compute - Elastic Beanstalk - Get started - add application name,platform = PHP,Enable upload your code - upload(choose index.zip file contain a __MACOSX folder and index file) - upload - create application - Now a dashboard creates - configuration contain software,Instance,Load Balancer etc.... - you will get a Url, copy and paste in webbrowser to get that application.

index file content shown below

<html>
<head><title>Hello Cloud Gurus</title></head>
<body><h1 align="center">Hello Cloud Gurus! This is webpage was provisioned using Elastic Beanstalk!</h1></body>
</html>

Enter fullscreen mode Exit fullscreen mode

Action - Delete Application - Delete

AWS OpsWorks

Top comments (0)