You can easily deploy static files stored in a folder to an Amazon S3 Bucket. If you configure your S3 Bucket for static website hosting, you can access all files via HTTPS from any browser or tool. Using the AWS Cloud Development Kit in TypeScript, your CloudFormation Stack can look like this. After the deployment is done, the domain name to access the uploaded content will be exposed as a CloudFormation Stack Output.
import * as CDK from "@aws-cdk/core";
import * as S3 from "@aws-cdk/aws-s3";
import * as S3Deployment from "@aws-cdk/aws-s3-deployment";
const path = "./files";
export class WebsiteStack extends CDK.Stack {
constructor(app: CDK.App, id: string, props?: CDK.StackProps) {
super(app, id, props);
const bucket = new S3.Bucket(this, "Files", {
websiteIndexDocument: "index.html",
publicReadAccess: true,
});
new S3Deployment.BucketDeployment(this, "Deployment", {
sources: [S3Deployment.Source.asset(path)],
destinationBucket: bucket,
});
new CDK.CfnOutput(this, "BucketDomain", {
value: bucket.bucketWebsiteDomainName,
});
}
}
-
December 17 th, 2020
486 Words
To decouple services on AWS, it’s a common pattern to use Amazon SQS and Amazon SNS. With AWS Key Management Service, you can encrypt the messages stored in the SNS topic and SQS queue. For the AWS Cloud Development Kit using TypeScript, you can easily create an architecture for secure message processing.
-
December 11 th, 2020
270 Words
With AWS CloudFormation StackSets you can deploy a CloudFormation template to multiple AWS Accounts or AWS Regions. You can use the AWS Management Console, the AWS CLI, or CloudFormation to use StackSets. Before using StackSets, you need to configure specific IAM roles to be used with CloudFormation StackSets.
-
December 7 th, 2020
380 Words
Most people only use Amazon API Gateway as an HTTP interface to invoke AWS Lambda functions. But, the service has way more to offer. For example, you can easily create an HTTP interface for nearly any AWS Service; not only AWS Lambda. Based on the previous post, on how to create a State Machine with AWS Step Functions and AWS Cloud Development Kit, this post describes how to create an HTTP interface to start an execution of a State Machine using the AWS CDK.
-
December 7 th, 2020
327 Words
Most people know Amazon API Gateway from using it to build HTTP interfaces for AWS Lambda functions. But, in general, you can use API Gateway to call a variety AWS APIs using HTTPS. This post shows how to create an HTTPS interface for Amazon SQS using the AWS Cloud Development Kit.
-
December 6 th, 2020
435 Words
With AWS Step Functions, you can easily orchestrate serverless functions and sequence them with other AWS services to a bundle application. You can create AWS Step Functions with CloudFormation, the AWS Cloud Development Kit, or - of course - using the visual interface available in the AWS Management Console. This post shows how to orchestrate AWS Lambda functions to a simple State Machine using AWS Step Functions.
-
December 6 th, 2020
463 Words
Using the AWS Cloud Development Kit, deploying a AWS Lambda function using Docker container images is pure gold. The installation of dependencies for Lambda functions always stressed me out. Regardless of using Node.js or Python, managing dependencies for AWS Lambda was never fun.
-
December 5 th, 2020
195 Words
The AWS Cloud Development Kit supports building docker images for AWS Lambda. With the most recent version, the CDK builds your docker images if needed and can push the image directly to AWS Elastic Container Registry. Personally, I think this is a great feature. With supporting docker images, AWS Lambda has immutable deployment artifacts!