Manage products with ease using this CRUD (Create, Read, Update, Delete) API powered by Amazon DynamoDB as the underlying database. To get started, follow the steps below to configure your AWS CLI profile and integrate it with the appsettings.json
file.
Before you begin, ensure you have the following prerequisites installed:
Follow these steps to configure your AWS CLI profile:
-
Install the AWS CLI by referring to the official installation guide.
-
Open your terminal or command prompt and run the following command, replacing
your-profile-name
with your chosen AWS profile name:aws configure --profile your-profile-name
-
You'll be prompted to provide your AWS Access Key ID, AWS Secret Access Key, default region name, and output format. Enter the required information based on your AWS account setup.
In the appsettings.json
file of the API project, include your AWS profile name as follows:
{
"AWS": {
"Profile": "your-profile-name",
"Region": "your-aws-region"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
// Other settings...
}
Replace "your-profile-name"
with the AWS profile name you configured in the AWS CLI, and set "your-aws-region"
to your preferred AWS region (e.g., "us-east-1"
).
To run the API locally, follow these steps:
-
Clone this repository to your local machine:
git clone https://github.com/guilhermebernava/AwsDynamoDb.git
-
Navigate to the project directory:
cd aws-dynamodb-product-api
-
Build and run the API using the .NET CLI:
dotnet run
The API will be accessible locally at http://localhost:5000
or https://localhost:5001
.
Explore the following API endpoints:
- GET /api/product: Retrieve a list of all products.
- POST /api/product: Create a new product.
- PUT /api/product: Update an existing product by ID.
- DELETE /api/product: Delete a product by ID.