npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@104corp/cfn-web-module

v2.2.2

Published

Include AltoScaling Group, Application LoadBalance, S3 Bucket, Role, etc...

Downloads

18

Readme

NPM version

cfn Web Template

AWS WEB Service deployment from CloudFormation Template

Architecture

Install

Use git clone to copy template

git clone https://github.com/104corp/104isgd-devops-cfn-web.git

Or use npm install

Install Node.js and npm first!

npm i @104corp/cfn-web-module

Usage

For Prod(without scheduled action)

---
AWSTemplateFormatVersion: "2010-09-09"
Resources:
  Infra:
    Type: "AWS::CloudFormation::Stack"
    Properties:
      Parameters:
        AutoScalingDesiredMax: 4
        AutoScalingDesiredMin: 2
        AutoScalingOutPolicyHighCPU: 80
        AutoScalingOutPolicyLowCPU: 30
        ALBLogEnable: true
        ALBScheme: internal
        ALBListenerHttpsACMArn: arn:aws:acm:ap-northeast-1:685256291126:certificate/235ab25a-3bbc-43f1-8588-ad8a106fe4ae
        UserdataA: ""
        UserdataB: ""
        UserdataC: ""
        InstanceImageId: ""
        ALBLogLifecycleExpirationInDays: 30
        ProductName: aws-06-web
        VPCId: vpc-0651a7ee9874c4bbf
        VPCSubnetIdForELB: subnet-044e3e0ca5d02d47c, subnet-0755b85dfb1b14fd2
        VPCSubnetIdForEC2: subnet-044e3e0ca5d02d47c, subnet-0755b85dfb1b14fd2
      TemplateURL: "./node_modules/@104corp/cfn-web-module/templates/web.yaml"

For Dev/Stg(with scheduled action)

---
AWSTemplateFormatVersion: "2010-09-09"
Resources:
  Infra:
    Type: "AWS::CloudFormation::Stack"
    Properties:
      Parameters:
        AutoScalingDesiredMax: 4
        AutoScalingDesiredMin: 2
        AutoScalingOutPolicyHighCPU: 80
        AutoScalingOutPolicyLowCPU: 30
        ALBLogEnable: true
        ALBScheme: internal
        ALBListenerHttpsACMArn: arn:aws:acm:ap-northeast-1:685256291126:certificate/235ab25a-3bbc-43f1-8588-ad8a106fe4ae
        UserdataA: ""
        UserdataB: ""
        UserdataC: ""
        InstanceImageId: ""
        ALBLogLifecycleExpirationInDays: 30
        ProductName: aws-06-web
        VPCId: vpc-0651a7ee9874c4bbf
        VPCSubnetIdForELB: subnet-044e3e0ca5d02d47c, subnet-0755b85dfb1b14fd2
        VPCSubnetIdForEC2: subnet-044e3e0ca5d02d47c, subnet-0755b85dfb1b14fd2
        PowerOnTime: '0 0 * * *'
        PowerOffTime: '0 11 * * *'
      TemplateURL: "./node_modules/@104corp/cfn-web-module/templates/web.yaml"

Package

$ aws cloudformation package --template-file example.yml --s3-bucket <your cfn template bucket> --output-template-file packaged.yml

Deploy

$ aws cloudformation deploy --template-file packaged.yml --stack-name <your stack name>

templates/web

Description

AWS Service :

  • application loadbalancer
    • listen port 80 & 443
    • access log enable
  • autoscaling group
    • change capacity by cloudwatch cpu usage
  • iam role
    • ssm policy
  • s3 bucket
    • Application Loadbalancer log
  • security group
    • AutoScaling Group
    • Application LoadBalancer
  • cloudwatch
    • cpu alarm high and low

Parameters

AutoScalingOutPolicyHighCPU

Type: String
Description: How many percent cpu usage need to scaling up instance, default is 80 percent.

AutoScalingOutPolicyLowCPU

Type: String
Description: How many percent cpu usage need to scaling down instance, default is 30 percent.

AutoScalingDesiredMin

Type: String
Description: Autoscaling minimum instance capacity, default is 2.

AutoScalingDesiredMax

Type: String
Description: Autoscaling maximum instance capacity, default is 4.

ALBLogEnable

Type: String
Description: Enable or Disable LoadBalancer log, default is true.

ALBScheme

Type: String
Description: Choice ELB network, default is internal.

ALBListenerHttpsACMArn

Type: String
Description: Enter Your ACM ARN look like arn:aws:acm:region:123456789012:certificate/00000000-0000-0000-0000-000000000000

UserdataA

Type: String
Description: Enter Your shell script if needed, default is ""

UserdataB

Type: String
Description: Enter Your shell script if needed, default is ""

UserdataC

Type: String
Description: Enter Your shell script if needed, default is ""

InstanceImageId

Type: String
Description: Enter AMI ID.

ALBLogLifecycleExpirationInDays:

Type: String
Description: S3 Bucket Lifecycle, default is 30 days.

ProductName

Type: String
Description: Enter Your ProductName. E.G. NewWeb, Hunter etc...

VPCId

Type: AWS::EC2::VPC::Id
Description: Choice Exist VPC ID

VPCSubnetIdForELB

Type: AWS::EC2::Subnet::Id Description: Enter exist two subnet id depens on VPC For ElasticLoadbalancer.

VPCSubnetIdForEC2

Type: AWS::EC2::Subnet::Id
Description: Enter exist two subnet id depens on VPC For EC2.

InstanceType

Type: String
Description: Choice ec2 instance type, default is t3.nano

Use For Lab/Stg env if needed it(Option).

We provider ten Scheduled Action Function for usage.

Schedule Name and Parameter Name List

{sequence}
- First
- Second
- Third
- Fourth
- Fifth
- Sixth
- Seventh
- Eighth
- Ninth
- Tenth
- asgScheduledAction{sequence}:
  - ScheduledActions{sequence}
  - ScheduledActions{sequence}MaxSize
  - ScheduledActions{sequence}MinSize

ScheduledActionsFirst

Type: String
Description: Conrd format like "0 8 * * * ", default is 0 0 * * * . Time Zone is UTC(Teipei Time -8)

ScheduledActionsFirstMaxSize

Type: String
Description: scheduled action for instance max size.

ScheduledActionsFirstMinSize

Type: String
Description: scheduled action for instance min size.

Maintenance

Maintainers:

  • 104corp