Welcome to the Coding Challenge! This project demonstrates the deployment of a full-stack application on AWS using AWS Cloud Development Kit (CDK) and CloudFormation. The stack includes the following AWS resources:
- AWS Lambda Function
- Amazon S3 Bucket
- Amazon API Gateway
- Amazon DynamoDB Table
Before you begin, ensure you have the following installed:
Configure your AWS account and region by setting the necessary environment variables.
set CDK_DEFAULT_ACCOUNT=your-account-id
set CDK_DEFAULT_REGION=your-region
set AWS_REGION=your-region
set AWS_DEFAULT_REGION=your-region
set AWS_ACCESS_KEY_ID=your-access-key-id
set AWS_SECRET_ACCESS_KEY=your-access-key-secret
export CDK_DEFAULT_ACCOUNT=your-account-id
export CDK_DEFAULT_REGION=your-region
export AWS_REGION=your-region
export AWS_DEFAULT_REGION=your-region
export AWS_ACCESS_KEY_ID=your-access-key-id
export AWS_SECRET_ACCESS_KEY=your-access-key-secret
-
Install AWS CLI
Install the AWS CLI by following the instructions here.
-
Configure AWS CLI
Run the following command and follow the prompts to configure your AWS CLI with your credentials:
aws configure
-
Install AWS CDK
Install the AWS CDK globally using npm:
npm install -g aws-cdk
-
Clone the Repository
Clone this repository to your local machine and navigate into the project directory:
git clone https://github.com/Devansh-ops/aws-cdk-demo-project.git cd aws-cdk-demo-project
-
Set Environment Variables
Export or set the environment variables as shown in the previous section.
-
Deploy the Stack
Deploy the stack to AWS. This command will also install npm packages and create the necessary configuration:
npm run deploy
-
Run the Frontend
Navigate to the frontend directory and start the development server:
cd file-upload npm start
-
Access the Application
Open your web browser and navigate to
http://localhost:3000
to access the application.
The project is organized as follows:
- infrastructure: Contains the CDK stack definitions and resource configurations.
- lambda: Contains the source code for the Lambda function.
- file-upload: The React frontend application.
- AWS Lambda: Handles backend logic and interacts with DynamoDB.
- Amazon S3: Stores uploaded files securely.
- Amazon API Gateway: Provides a RESTful API to interact with the Lambda function.
- Amazon DynamoDB: Stores metadata and application data.
For any questions or issues, please open an issue on this repository or contact the maintainer.
This project showcases the deployment of a serverless application on AWS using modern development tools and practices. Happy coding!