diff --git a/.projenrc.ts b/.projenrc.ts index 5009388..6a3b0ab 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -5,9 +5,9 @@ const excludes = ['.idea/', 'cdk.out/', 'cdk.context.json', 'yarn-error.log']; const project = new awscdk.AwsCdkConstructLibrary({ author: 'Yohta Kimura', authorAddress: 'kitakita7617@gmail.com', - name: 'easy-cerver', + name: 'low-cost-ecs', description: 'Easy and low-cost ECS on EC2 server without a load balancer', - repositoryUrl: 'https://github.com/rajyan/easy-cerver.git', + repositoryUrl: 'https://github.com/rajyan/low-cost-ecs.git', license: 'MIT', cdkVersion: '2.37.0', defaultReleaseBranch: 'main', @@ -26,8 +26,8 @@ const project = new awscdk.AwsCdkConstructLibrary({ stability: 'experimental', python: { - distName: 'easy-cerver', - module: 'eascy_cerver', + distName: 'low-cost-ecs', + module: 'low_cost_ecs', }, npmignore: excludes, diff --git a/API.md b/API.md index 54bd49d..ecd2a22 100644 --- a/API.md +++ b/API.md @@ -2,39 +2,39 @@ ## Constructs -### EasyCerver +### LowCostECS -#### Initializers +#### Initializers ```typescript -import { EasyCerver } from 'easy-cerver' +import { LowCostECS } from 'low-cost-ecs' -new EasyCerver(scope: Construct, id: string, props: EasyCerverProps) +new LowCostECS(scope: Construct, id: string, props: LowCostECSProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | -| scope | constructs.Construct | *No description.* | -| id | string | *No description.* | -| props | EasyCerverProps | *No description.* | +| scope | constructs.Construct | *No description.* | +| id | string | *No description.* | +| props | LowCostECSProps | *No description.* | --- -##### `scope`Required +##### `scope`Required - *Type:* constructs.Construct --- -##### `id`Required +##### `id`Required - *Type:* string --- -##### `props`Required +##### `props`Required -- *Type:* EasyCerverProps +- *Type:* LowCostECSProps --- @@ -42,22 +42,22 @@ new EasyCerver(scope: Construct, id: string, props: EasyCerverProps) | **Name** | **Description** | | --- | --- | -| toString | Returns a string representation of this construct. | -| addDependency | Add a dependency between this stack and another stack. | -| addTransform | Add a Transform to this stack. A Transform is a macro that AWS CloudFormation uses to process your template. | -| exportValue | Create a CloudFormation Export for a value. | -| formatArn | Creates an ARN from components. | -| getLogicalId | Allocates a stack-unique CloudFormation-compatible logical identity for a specific resource. | -| regionalFact | Look up a fact value for the given fact for the region of this stack. | -| renameLogicalId | Rename a generated logical identities. | -| reportMissingContextKey | Indicate that a context key was expected. | -| resolve | Resolve a tokenized value in the context of the current stack. | -| splitArn | Splits the provided ARN into its components. | -| toJsonString | Convert an object, potentially containing tokens, to a JSON string. | +| toString | Returns a string representation of this construct. | +| addDependency | Add a dependency between this stack and another stack. | +| addTransform | Add a Transform to this stack. A Transform is a macro that AWS CloudFormation uses to process your template. | +| exportValue | Create a CloudFormation Export for a value. | +| formatArn | Creates an ARN from components. | +| getLogicalId | Allocates a stack-unique CloudFormation-compatible logical identity for a specific resource. | +| regionalFact | Look up a fact value for the given fact for the region of this stack. | +| renameLogicalId | Rename a generated logical identities. | +| reportMissingContextKey | Indicate that a context key was expected. | +| resolve | Resolve a tokenized value in the context of the current stack. | +| splitArn | Splits the provided ARN into its components. | +| toJsonString | Convert an object, potentially containing tokens, to a JSON string. | --- -##### `toString` +##### `toString` ```typescript public toString(): string @@ -65,7 +65,7 @@ public toString(): string Returns a string representation of this construct. -##### `addDependency` +##### `addDependency` ```typescript public addDependency(target: Stack, reason?: string): void @@ -76,19 +76,19 @@ Add a dependency between this stack and another stack. This can be used to define dependencies between any two stacks within an app, and also supports nested stacks. -###### `target`Required +###### `target`Required - *Type:* aws-cdk-lib.Stack --- -###### `reason`Optional +###### `reason`Optional - *Type:* string --- -##### `addTransform` +##### `addTransform` ```typescript public addTransform(transform: string): void @@ -109,7 +109,7 @@ stack.addTransform('AWS::Serverless-2016-10-31') ``` -###### `transform`Required +###### `transform`Required - *Type:* string @@ -117,7 +117,7 @@ The transform to add. --- -##### `exportValue` +##### `exportValue` ```typescript public exportValue(exportedValue: any, options?: ExportValueOptions): string @@ -168,19 +168,19 @@ Instead, the process takes two deployments: - Don't forget to remove the `exportValue()` call as well. - Deploy again (this time only the `producerStack` will be changed -- the bucket will be deleted). -###### `exportedValue`Required +###### `exportedValue`Required - *Type:* any --- -###### `options`Optional +###### `options`Optional - *Type:* aws-cdk-lib.ExportValueOptions --- -##### `formatArn` +##### `formatArn` ```typescript public formatArn(components: ArnComponents): string @@ -202,13 +202,13 @@ The required ARN pieces that are omitted will be taken from the stack that the 'scope' is attached to. If all ARN pieces are supplied, the supplied scope can be 'undefined'. -###### `components`Required +###### `components`Required - *Type:* aws-cdk-lib.ArnComponents --- -##### `getLogicalId` +##### `getLogicalId` ```typescript public getLogicalId(element: CfnElement): string @@ -224,7 +224,7 @@ This method uses the protected method `allocateLogicalId` to render the logical ID for an element. To modify the naming scheme, extend the `Stack` class and override this method. -###### `element`Required +###### `element`Required - *Type:* aws-cdk-lib.CfnElement @@ -232,7 +232,7 @@ The CloudFormation element for which a logical identity is needed. --- -##### `regionalFact` +##### `regionalFact` ```typescript public regionalFact(factName: string, defaultValue?: string): string @@ -256,19 +256,19 @@ not have to worry about regional facts. If `defaultValue` is not given, it is an error if the fact is unknown for the given region. -###### `factName`Required +###### `factName`Required - *Type:* string --- -###### `defaultValue`Optional +###### `defaultValue`Optional - *Type:* string --- -##### `renameLogicalId` +##### `renameLogicalId` ```typescript public renameLogicalId(oldId: string, newId: string): void @@ -279,19 +279,19 @@ Rename a generated logical identities. To modify the naming scheme strategy, extend the `Stack` class and override the `allocateLogicalId` method. -###### `oldId`Required +###### `oldId`Required - *Type:* string --- -###### `newId`Required +###### `newId`Required - *Type:* string --- -##### `reportMissingContextKey` +##### `reportMissingContextKey` ```typescript public reportMissingContextKey(report: MissingContext): void @@ -302,7 +302,7 @@ Indicate that a context key was expected. Contains instructions which will be emitted into the cloud assembly on how the key should be supplied. -###### `report`Required +###### `report`Required - *Type:* aws-cdk-lib.cloud_assembly_schema.MissingContext @@ -310,7 +310,7 @@ The set of parameters needed to obtain the context. --- -##### `resolve` +##### `resolve` ```typescript public resolve(obj: any): any @@ -318,13 +318,13 @@ public resolve(obj: any): any Resolve a tokenized value in the context of the current stack. -###### `obj`Required +###### `obj`Required - *Type:* any --- -##### `splitArn` +##### `splitArn` ```typescript public splitArn(arn: string, arnFormat: ArnFormat): ArnComponents @@ -337,7 +337,7 @@ and a Token representing a dynamic CloudFormation expression (in which case the returned components will also be dynamic CloudFormation expressions, encoded as Tokens). -###### `arn`Required +###### `arn`Required - *Type:* string @@ -345,7 +345,7 @@ the ARN to split into its components. --- -###### `arnFormat`Required +###### `arnFormat`Required - *Type:* aws-cdk-lib.ArnFormat @@ -353,7 +353,7 @@ the expected format of 'arn' - depends on what format the service 'arn' represen --- -##### `toJsonString` +##### `toJsonString` ```typescript public toJsonString(obj: any, space?: number): string @@ -361,13 +361,13 @@ public toJsonString(obj: any, space?: number): string Convert an object, potentially containing tokens, to a JSON string. -###### `obj`Required +###### `obj`Required - *Type:* any --- -###### `space`Optional +###### `space`Optional - *Type:* number @@ -377,23 +377,23 @@ Convert an object, potentially containing tokens, to a JSON string. | **Name** | **Description** | | --- | --- | -| isConstruct | Checks if `x` is a construct. | -| isStack | Return whether the given object is a Stack. | -| of | Looks up the first stack scope in which `construct` is defined. | +| isConstruct | Checks if `x` is a construct. | +| isStack | Return whether the given object is a Stack. | +| of | Looks up the first stack scope in which `construct` is defined. | --- -##### ~~`isConstruct`~~ +##### ~~`isConstruct`~~ ```typescript -import { EasyCerver } from 'easy-cerver' +import { LowCostECS } from 'low-cost-ecs' -EasyCerver.isConstruct(x: any) +LowCostECS.isConstruct(x: any) ``` Checks if `x` is a construct. -###### `x`Required +###### `x`Required - *Type:* any @@ -401,37 +401,37 @@ Any object. --- -##### `isStack` +##### `isStack` ```typescript -import { EasyCerver } from 'easy-cerver' +import { LowCostECS } from 'low-cost-ecs' -EasyCerver.isStack(x: any) +LowCostECS.isStack(x: any) ``` Return whether the given object is a Stack. We do attribute detection since we can't reliably use 'instanceof'. -###### `x`Required +###### `x`Required - *Type:* any --- -##### `of` +##### `of` ```typescript -import { EasyCerver } from 'easy-cerver' +import { LowCostECS } from 'low-cost-ecs' -EasyCerver.of(construct: IConstruct) +LowCostECS.of(construct: IConstruct) ``` Looks up the first stack scope in which `construct` is defined. Fails if there is no stack up the tree. -###### `construct`Required +###### `construct`Required - *Type:* constructs.IConstruct @@ -443,31 +443,31 @@ The construct to start the search from. | **Name** | **Type** | **Description** | | --- | --- | --- | -| node | constructs.Node | The tree node. | -| account | string | The AWS account into which this stack will be deployed. | -| artifactId | string | The ID of the cloud assembly artifact for this stack. | -| availabilityZones | string[] | Returns the list of AZs that are available in the AWS environment (account/region) associated with this stack. | -| bundlingRequired | boolean | Indicates whether the stack requires bundling or not. | -| dependencies | aws-cdk-lib.Stack[] | Return the stacks this stack depends on. | -| environment | string | The environment coordinates in which this stack is deployed. | -| nested | boolean | Indicates if this is a nested stack, in which case `parentStack` will include a reference to it's parent. | -| notificationArns | string[] | Returns the list of notification Amazon Resource Names (ARNs) for the current stack. | -| partition | string | The partition in which this stack is defined. | -| region | string | The AWS region into which this stack will be deployed (e.g. `us-west-2`). | -| stackId | string | The ID of the stack. | -| stackName | string | The concrete CloudFormation physical stack name. | -| synthesizer | aws-cdk-lib.IStackSynthesizer | Synthesis method for this stack. | -| tags | aws-cdk-lib.TagManager | Tags to be applied to the stack. | -| templateFile | string | The name of the CloudFormation template file emitted to the output directory during synthesis. | -| templateOptions | aws-cdk-lib.ITemplateOptions | Options for CloudFormation template (like version, transform, description). | -| urlSuffix | string | The Amazon domain suffix for the region in which this stack is defined. | -| nestedStackParent | aws-cdk-lib.Stack | If this is a nested stack, returns it's parent stack. | -| nestedStackResource | aws-cdk-lib.CfnResource | If this is a nested stack, this represents its `AWS::CloudFormation::Stack` resource. | -| terminationProtection | boolean | Whether termination protection is enabled for this stack. | - ---- - -##### `node`Required +| node | constructs.Node | The tree node. | +| account | string | The AWS account into which this stack will be deployed. | +| artifactId | string | The ID of the cloud assembly artifact for this stack. | +| availabilityZones | string[] | Returns the list of AZs that are available in the AWS environment (account/region) associated with this stack. | +| bundlingRequired | boolean | Indicates whether the stack requires bundling or not. | +| dependencies | aws-cdk-lib.Stack[] | Return the stacks this stack depends on. | +| environment | string | The environment coordinates in which this stack is deployed. | +| nested | boolean | Indicates if this is a nested stack, in which case `parentStack` will include a reference to it's parent. | +| notificationArns | string[] | Returns the list of notification Amazon Resource Names (ARNs) for the current stack. | +| partition | string | The partition in which this stack is defined. | +| region | string | The AWS region into which this stack will be deployed (e.g. `us-west-2`). | +| stackId | string | The ID of the stack. | +| stackName | string | The concrete CloudFormation physical stack name. | +| synthesizer | aws-cdk-lib.IStackSynthesizer | Synthesis method for this stack. | +| tags | aws-cdk-lib.TagManager | Tags to be applied to the stack. | +| templateFile | string | The name of the CloudFormation template file emitted to the output directory during synthesis. | +| templateOptions | aws-cdk-lib.ITemplateOptions | Options for CloudFormation template (like version, transform, description). | +| urlSuffix | string | The Amazon domain suffix for the region in which this stack is defined. | +| nestedStackParent | aws-cdk-lib.Stack | If this is a nested stack, returns it's parent stack. | +| nestedStackResource | aws-cdk-lib.CfnResource | If this is a nested stack, this represents its `AWS::CloudFormation::Stack` resource. | +| terminationProtection | boolean | Whether termination protection is enabled for this stack. | + +--- + +##### `node`Required ```typescript public readonly node: Node; @@ -479,7 +479,7 @@ The tree node. --- -##### `account`Required +##### `account`Required ```typescript public readonly account: string; @@ -508,7 +508,7 @@ implement some other region-agnostic behavior. --- -##### `artifactId`Required +##### `artifactId`Required ```typescript public readonly artifactId: string; @@ -520,7 +520,7 @@ The ID of the cloud assembly artifact for this stack. --- -##### `availabilityZones`Required +##### `availabilityZones`Required ```typescript public readonly availabilityZones: string[]; @@ -543,7 +543,7 @@ To specify a different strategy for selecting availability zones override this m --- -##### `bundlingRequired`Required +##### `bundlingRequired`Required ```typescript public readonly bundlingRequired: boolean; @@ -555,7 +555,7 @@ Indicates whether the stack requires bundling or not. --- -##### `dependencies`Required +##### `dependencies`Required ```typescript public readonly dependencies: Stack[]; @@ -567,7 +567,7 @@ Return the stacks this stack depends on. --- -##### `environment`Required +##### `environment`Required ```typescript public readonly environment: string; @@ -591,7 +591,7 @@ region/account-agnostic. --- -##### `nested`Required +##### `nested`Required ```typescript public readonly nested: boolean; @@ -603,7 +603,7 @@ Indicates if this is a nested stack, in which case `parentStack` will include a --- -##### `notificationArns`Required +##### `notificationArns`Required ```typescript public readonly notificationArns: string[]; @@ -615,7 +615,7 @@ Returns the list of notification Amazon Resource Names (ARNs) for the current st --- -##### `partition`Required +##### `partition`Required ```typescript public readonly partition: string; @@ -627,7 +627,7 @@ The partition in which this stack is defined. --- -##### `region`Required +##### `region`Required ```typescript public readonly region: string; @@ -656,7 +656,7 @@ implement some other region-agnostic behavior. --- -##### `stackId`Required +##### `stackId`Required ```typescript public readonly stackId: string; @@ -676,7 +676,7 @@ The ID of the stack. ``` -##### `stackName`Required +##### `stackName`Required ```typescript public readonly stackName: string; @@ -697,7 +697,7 @@ you can use `Aws.STACK_NAME` directly. --- -##### `synthesizer`Required +##### `synthesizer`Required ```typescript public readonly synthesizer: IStackSynthesizer; @@ -709,7 +709,7 @@ Synthesis method for this stack. --- -##### `tags`Required +##### `tags`Required ```typescript public readonly tags: TagManager; @@ -721,7 +721,7 @@ Tags to be applied to the stack. --- -##### `templateFile`Required +##### `templateFile`Required ```typescript public readonly templateFile: string; @@ -735,7 +735,7 @@ Example value: `MyStack.template.json` --- -##### `templateOptions`Required +##### `templateOptions`Required ```typescript public readonly templateOptions: ITemplateOptions; @@ -747,7 +747,7 @@ Options for CloudFormation template (like version, transform, description). --- -##### `urlSuffix`Required +##### `urlSuffix`Required ```typescript public readonly urlSuffix: string; @@ -759,7 +759,7 @@ The Amazon domain suffix for the region in which this stack is defined. --- -##### `nestedStackParent`Optional +##### `nestedStackParent`Optional ```typescript public readonly nestedStackParent: Stack; @@ -771,7 +771,7 @@ If this is a nested stack, returns it's parent stack. --- -##### `nestedStackResource`Optional +##### `nestedStackResource`Optional ```typescript public readonly nestedStackResource: CfnResource; @@ -785,7 +785,7 @@ If this is a nested stack, this represents its `AWS::CloudFormation::Stack` reso --- -##### `terminationProtection`Optional +##### `terminationProtection`Optional ```typescript public readonly terminationProtection: boolean; @@ -800,45 +800,45 @@ Whether termination protection is enabled for this stack. ## Structs -### EasyCerverProps +### LowCostECSProps -#### Initializer +#### Initializer ```typescript -import { EasyCerverProps } from 'easy-cerver' +import { LowCostECSProps } from 'low-cost-ecs' -const easyCerverProps: EasyCerverProps = { ... } +const lowCostECSProps: LowCostECSProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | -| analyticsReporting | boolean | Include runtime versioning information in this Stack. | -| description | string | A description of the stack. | -| env | aws-cdk-lib.Environment | The AWS environment (account/region) where this stack will be deployed. | -| stackName | string | Name to deploy the stack with. | -| synthesizer | aws-cdk-lib.IStackSynthesizer | Synthesis method to use while deploying this stack. | -| tags | {[ key: string ]: string} | Stack tags that will be applied to all the taggable resources and the stack itself. | -| terminationProtection | boolean | Whether to enable termination protection for this stack. | -| email | string | Email for expiration emails to register to your let's encrypt account. | -| hostedZoneDomain | string | Domain name of the hosted zone. | -| awsCliDockerTag | string | Docker image tag of amazon/aws-cli. | -| certbotDockerTag | string | Docker image tag of certbot/dns-route53 to create certificates. | -| certbotScheduleInterval | number | Certbot task schedule interval in days to renew the certificate. | -| containerInsights | boolean | Enable container insights or not. | -| hostInstanceSpotPrice | string | The maximum hourly price (in USD) to be paid for any Spot Instance launched to fulfill the request. | -| hostInstanceType | string | Instance type of the ECS host instance. | -| logGroup | aws-cdk-lib.aws_logs.ILogGroup | Log group of the certbot task and the aws-cli task. | -| recordDomainNames | string[] | Domain names for A records to elastic ip of ECS host instance. | -| removalPolicy | aws-cdk-lib.RemovalPolicy | Removal policy for the file system and log group (if using default). | -| securityGroup | aws-cdk-lib.aws_ec2.SecurityGroup | Security group of the ECS host instance. | -| serverTaskDefinition | aws-cdk-lib.aws_ecs.Ec2TaskDefinition | Task definition for the server ecs task. | -| vpc | aws-cdk-lib.aws_ec2.IVpc | Vpc of the ECS host instance and cluster. | - ---- - -##### `analyticsReporting`Optional +| analyticsReporting | boolean | Include runtime versioning information in this Stack. | +| description | string | A description of the stack. | +| env | aws-cdk-lib.Environment | The AWS environment (account/region) where this stack will be deployed. | +| stackName | string | Name to deploy the stack with. | +| synthesizer | aws-cdk-lib.IStackSynthesizer | Synthesis method to use while deploying this stack. | +| tags | {[ key: string ]: string} | Stack tags that will be applied to all the taggable resources and the stack itself. | +| terminationProtection | boolean | Whether to enable termination protection for this stack. | +| email | string | Email for expiration emails to register to your let's encrypt account. | +| hostedZoneDomain | string | Domain name of the hosted zone. | +| awsCliDockerTag | string | Docker image tag of amazon/aws-cli. | +| certbotDockerTag | string | Docker image tag of certbot/dns-route53 to create certificates. | +| certbotScheduleInterval | number | Certbot task schedule interval in days to renew the certificate. | +| containerInsights | boolean | Enable container insights or not. | +| hostInstanceSpotPrice | string | The maximum hourly price (in USD) to be paid for any Spot Instance launched to fulfill the request. | +| hostInstanceType | string | Instance type of the ECS host instance. | +| logGroup | aws-cdk-lib.aws_logs.ILogGroup | Log group of the certbot task and the aws-cli task. | +| recordDomainNames | string[] | Domain names for A records to elastic ip of ECS host instance. | +| removalPolicy | aws-cdk-lib.RemovalPolicy | Removal policy for the file system and log group (if using default). | +| securityGroup | aws-cdk-lib.aws_ec2.SecurityGroup | Security group of the ECS host instance. | +| serverTaskDefinition | aws-cdk-lib.aws_ecs.Ec2TaskDefinition | Task definition for the server ecs task. | +| vpc | aws-cdk-lib.aws_ec2.IVpc | Vpc of the ECS host instance and cluster. | + +--- + +##### `analyticsReporting`Optional ```typescript public readonly analyticsReporting: boolean; @@ -851,7 +851,7 @@ Include runtime versioning information in this Stack. --- -##### `description`Optional +##### `description`Optional ```typescript public readonly description: string; @@ -864,7 +864,7 @@ A description of the stack. --- -##### `env`Optional +##### `env`Optional ```typescript public readonly env: Environment; @@ -938,7 +938,7 @@ new MyStack(app, 'Stack1'); ``` -##### `stackName`Optional +##### `stackName`Optional ```typescript public readonly stackName: string; @@ -951,7 +951,7 @@ Name to deploy the stack with. --- -##### `synthesizer`Optional +##### `synthesizer`Optional ```typescript public readonly synthesizer: IStackSynthesizer; @@ -964,7 +964,7 @@ Synthesis method to use while deploying this stack. --- -##### `tags`Optional +##### `tags`Optional ```typescript public readonly tags: {[ key: string ]: string}; @@ -977,7 +977,7 @@ Stack tags that will be applied to all the taggable resources and the stack itse --- -##### `terminationProtection`Optional +##### `terminationProtection`Optional ```typescript public readonly terminationProtection: boolean; @@ -990,7 +990,7 @@ Whether to enable termination protection for this stack. --- -##### `email`Required +##### `email`Required ```typescript public readonly email: string; @@ -1004,7 +1004,7 @@ Email for expiration emails to register to your let's encrypt account. --- -##### `hostedZoneDomain`Required +##### `hostedZoneDomain`Required ```typescript public readonly hostedZoneDomain: string; @@ -1016,7 +1016,7 @@ Domain name of the hosted zone. --- -##### `awsCliDockerTag`Optional +##### `awsCliDockerTag`Optional ```typescript public readonly awsCliDockerTag: string; @@ -1031,7 +1031,7 @@ This image is used to associate elastic ip on host instance startup, and run cer --- -##### `certbotDockerTag`Optional +##### `certbotDockerTag`Optional ```typescript public readonly certbotDockerTag: string; @@ -1046,7 +1046,7 @@ Docker image tag of certbot/dns-route53 to create certificates. --- -##### `certbotScheduleInterval`Optional +##### `certbotScheduleInterval`Optional ```typescript public readonly certbotScheduleInterval: number; @@ -1059,7 +1059,7 @@ Certbot task schedule interval in days to renew the certificate. --- -##### `containerInsights`Optional +##### `containerInsights`Optional ```typescript public readonly containerInsights: boolean; @@ -1072,7 +1072,7 @@ Enable container insights or not. --- -##### `hostInstanceSpotPrice`Optional +##### `hostInstanceSpotPrice`Optional ```typescript public readonly hostInstanceSpotPrice: string; @@ -1089,7 +1089,7 @@ Host instance asg would use spot instances if hostInstanceSpotPrice is set. --- -##### `hostInstanceType`Optional +##### `hostInstanceType`Optional ```typescript public readonly hostInstanceType: string; @@ -1102,7 +1102,7 @@ Instance type of the ECS host instance. --- -##### `logGroup`Optional +##### `logGroup`Optional ```typescript public readonly logGroup: ILogGroup; @@ -1115,7 +1115,7 @@ Log group of the certbot task and the aws-cli task. --- -##### `recordDomainNames`Optional +##### `recordDomainNames`Optional ```typescript public readonly recordDomainNames: string[]; @@ -1128,7 +1128,7 @@ Domain names for A records to elastic ip of ECS host instance. --- -##### `removalPolicy`Optional +##### `removalPolicy`Optional ```typescript public readonly removalPolicy: RemovalPolicy; @@ -1141,7 +1141,7 @@ Removal policy for the file system and log group (if using default). --- -##### `securityGroup`Optional +##### `securityGroup`Optional ```typescript public readonly securityGroup: SecurityGroup; @@ -1154,7 +1154,7 @@ Security group of the ECS host instance. --- -##### `serverTaskDefinition`Optional +##### `serverTaskDefinition`Optional ```typescript public readonly serverTaskDefinition: Ec2TaskDefinition; @@ -1167,7 +1167,7 @@ Task definition for the server ecs task. --- -##### `vpc`Optional +##### `vpc`Optional ```typescript public readonly vpc: IVpc; diff --git a/README.md b/README.md index 4454bfd..3bccb43 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -[![NPM version](https://badge.fury.io/js/easy-cerver.svg)](https://www.npmjs.com/package/easy-cerver) -[![PyPI version](https://badge.fury.io/py/easy-cerver.svg)](https://pypi.org/project/easy-cerver/0.0.4/) -[![Release](https://github.com/rajyan/easy-cerver/workflows/release/badge.svg)](https://github.com/rajyan/easy-cerver/actions/workflows/release.yml) -[](https://constructs.dev/packages/easy-cerver) +[![NPM version](https://badge.fury.io/js/low-cost-ecs.svg)](https://www.npmjs.com/package/low-cost-ecs) +[![PyPI version](https://badge.fury.io/py/low-cost-ecs.svg)](https://pypi.org/project/low-cost-ecs/0.0.4/) +[![Release](https://github.com/rajyan/low-cost-ecs/workflows/release/badge.svg)](https://github.com/rajyan/low-cost-ecs/actions/workflows/release.yml) +[](https://constructs.dev/packages/low-cost-ecs) -# Easy Cerver +# Low-Cost ECS A CDK construct that provides easy and low-cost ECS on EC2 server setup without a load balancer. TLS/SSL certificates are installed automatically on startup of the server and renewed by a scheduled state machine using [certbot-dns-route53](https://certbot-dns-route53.readthedocs.io/en/stable/). @@ -13,11 +13,11 @@ TLS/SSL certificates are installed automatically on startup of the server and re # Try it out! The easiest way to see what this construct creates is to clone this repository and deploying sample server. -Edit settings in `bin/easy-cerver.ts` and deploy cdk construct. [Public hosted zone](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/AboutHZWorkingWith.html) with your own domain is required. +Edit settings in `bin/low-cost-ecs.ts` and deploy cdk construct. [Public hosted zone](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/AboutHZWorkingWith.html) with your own domain is required. ``` -git clone https://github.com/rajyan/easy-cerver.git -# edit settings in bin/easy-cerver.ts +git clone https://github.com/rajyan/low-cost-ecs.git +# edit settings in bin/low-cost-ecs.ts npx cdk deploy ``` @@ -28,23 +28,23 @@ Access to configured `recordDomainNames` and see that the nginx sample server ha To use this construct in your own cdk stack as a library, ``` -npm install easy-cerver +npm install low-cost-ecs ``` ```ts import { Stack, StackProps } from 'aws-cdk-lib'; import { Construct } from 'constructs'; -import { EasyCerver } from 'easy-cerver'; +import { LowCostECS } from 'low-cost-ecs'; class SampleStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { super(scope, id, props); - const vpc = /** Your VPC */ - const securityGroup = /** Your security group */ - const serverTaskDefinition = /** Your task definition */ + const vpc = /** Your VPC */; + const securityGroup = /** Your security group */; + const serverTaskDefinition = /** Your task definition */; - new EasyCerver(this, 'EasyCerver', { + new LowCostECS(this, 'LowCostECS', { hostedZoneDomain: "rajyan.net", email: "kitakita7617@gmail.com", vpc: vpc, @@ -56,7 +56,7 @@ class SampleStack extends Stack { ``` The required fields are `hostedZoneDomain` and `email`. -Set your own task definition, and other props. Read [`EasyCerverProps` documentation](https://github.com/rajyan/easy-cerver/blob/main/API.md#easy-cerver.EasyCerverProps) for details. +Set your own task definition, and other props. Read [`LowCostECSProps` documentation](https://github.com/rajyan/low-cost-ecs/blob/main/API.md#low-cost-ecs.LowCostECSProps) for details. # Why @@ -73,7 +73,7 @@ This construct aims to automate these work and deploying resources to run low-co All resources except Route53 HostedZone should be included in [AWS Free Tier](https://docs.aws.amazon.com/whitepapers/latest/how-aws-pricing-works/get-started-with-the-aws-free-tier.html) ***if you are in the 12 Months Free period***. -After your 12 Months Free period, setting [`hostInstanceSpotPrice`](https://github.com/rajyan/easy-cerver/blob/main/API.md#easy-cerver.EasyCerverProps.property.hostInstanceSpotPrice) to use spot instances is recommended. +After your 12 Months Free period, setting [`hostInstanceSpotPrice`](https://github.com/rajyan/low-cost-ecs/blob/main/API.md#low-cost-ecs.LowCostECSProps.property.hostInstanceSpotPrice) to use spot instances is recommended. * EC2 * t2,micro 750 instance hours (12 Months Free Tier) @@ -84,7 +84,7 @@ After your 12 Months Free period, setting [`hostInstanceSpotPrice`](https://gith * Usage is very small, it should be free * Cloud Watch * Usage is very small, and it should be included in the free tier - * Enabling [`containerInsights`](https://github.com/rajyan/easy-cerver/blob/main/API.md#easy-cerver.EasyCerverProps.property.containerInsights) will charge for custom metrics + * Enabling [`containerInsights`](https://github.com/rajyan/low-cost-ecs/blob/main/API.md#low-cost-ecs.LowCostECSProps.property.containerInsights) will charge for custom metrics # Debugging diff --git a/bin/easy-cerver.ts b/bin/low-cost-ecs.ts similarity index 81% rename from bin/easy-cerver.ts rename to bin/low-cost-ecs.ts index 8954bd2..6774bb2 100644 --- a/bin/easy-cerver.ts +++ b/bin/low-cost-ecs.ts @@ -1,9 +1,9 @@ import { App } from "aws-cdk-lib"; -import { EasyCerver } from '../src'; +import { LowCostECS } from '../src'; const app = new App(); -new EasyCerver(app, "EasyCerverStack", { +new LowCostECS(app, "LowCostECSStack", { env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION, diff --git a/cdk.json b/cdk.json index 0ead7b1..55acca3 100644 --- a/cdk.json +++ b/cdk.json @@ -1,3 +1,3 @@ { - "app": "npx ts-node --prefer-ts-exts bin/easy-cerver.ts" + "app": "npx ts-node --prefer-ts-exts bin/low-cost-ecs.ts" } diff --git a/package.json b/package.json index 0df2af7..5a05e3d 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { - "name": "easy-cerver", + "name": "low-cost-ecs", "description": "Easy and low-cost ECS on EC2 server without a load balancer", "repository": { "type": "git", - "url": "https://github.com/rajyan/easy-cerver.git" + "url": "https://github.com/rajyan/low-cost-ecs.git" }, "scripts": { "build": "npx projen build", @@ -123,8 +123,8 @@ "outdir": "dist", "targets": { "python": { - "distName": "easy-cerver", - "module": "eascy_cerver" + "distName": "low-cost-ecs", + "module": "low_cost_ecs" } }, "tsc": { diff --git a/src/index.ts b/src/index.ts index 33730d8..8af59fa 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1 +1 @@ -export * from './easy-cerver'; \ No newline at end of file +export * from './low-cost-ecs'; diff --git a/src/easy-cerver.ts b/src/low-cost-ecs.ts similarity index 98% rename from src/easy-cerver.ts rename to src/low-cost-ecs.ts index ce37d46..b13fdba 100644 --- a/src/easy-cerver.ts +++ b/src/low-cost-ecs.ts @@ -13,7 +13,7 @@ import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; import * as sfn_tasks from 'aws-cdk-lib/aws-stepfunctions-tasks'; import { Construct } from 'constructs'; -export interface EasyCerverProps extends lib.StackProps { +export interface LowCostECSProps extends lib.StackProps { /** * Domain name of the hosted zone. */ @@ -120,8 +120,8 @@ export interface EasyCerverProps extends lib.StackProps { readonly serverTaskDefinition?: ecs.Ec2TaskDefinition; }; -export class EasyCerver extends lib.Stack { - constructor(scope: Construct, id: string, props: EasyCerverProps) { +export class LowCostECS extends lib.Stack { + constructor(scope: Construct, id: string, props: LowCostECSProps) { super(scope, id, props); const vpc = diff --git a/test/__snapshots__/easy-cerver.test.ts.snap b/test/__snapshots__/low-cost-ecs.test.ts.snap similarity index 100% rename from test/__snapshots__/easy-cerver.test.ts.snap rename to test/__snapshots__/low-cost-ecs.test.ts.snap diff --git a/test/easy-cerver.test.ts b/test/low-cost-ecs.test.ts similarity index 89% rename from test/easy-cerver.test.ts rename to test/low-cost-ecs.test.ts index d368f29..951f9dc 100644 --- a/test/easy-cerver.test.ts +++ b/test/low-cost-ecs.test.ts @@ -1,10 +1,10 @@ import { App } from 'aws-cdk-lib'; import { Template } from 'aws-cdk-lib/assertions'; -import { EasyCerver } from '../src'; +import { LowCostECS } from '../src'; test('Template matches snapshot', () => { const app = new App(); - const stack = new EasyCerver(app, 'MyTestStack', { + const stack = new LowCostECS(app, 'MyTestStack', { env: { account: 'dummy-id', region: 'dummy-region',