Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

339
Views
I can't query dynamodb table from AWS Fargate task

I'm setting up a new AWS Fargate task to query Dynamodb. The task is not public, so it doesn't have a public IP address and the subnet in which the task is placed doesn't have the access to the Internet. The Dynamodb table I'm trying to query uses the KMS encryption type.

I created:

  • a VPC endpoint gateway to allow the subnet to connect to Amazon Dynamodb
  • a VPC endpoint interface to allow the subnet to connect to AWS Secret Manager

I also updated the task's IAM role to be able to access the Dynamodb and the AWS Secret services.

The route tables associated with my VPC is: Route tables and unfortunately, I can't update the table. If I click on Edit routes and Add route, it says: "No results found".

I'm trying to execute these lines of code:

session = boto3.Session()
dynamodb_client = session.client(service_name='dynamodb', region_name='us-east-1')
dynamodb_client.get_item(
    TableName='table_name', ConsistentRead=True, Key={'key': {'S': 'key'}}))

I expect that the output is a dictionary containing the information fetched from Dynamodb. I can't fetch any type of data from Dynamodb because when I execute the query, the task is interrupted and AWS Fargate starts a new one. I tried to download something from my S3 bucket and it's working (I also create the VPC endpoint gateway to allow the subnet to connect to AWS S3 and I updated the task's IAM role). I think that it's a problem of VPC endpoints but I don't know which other endpoints I need.

What am I doing wrong?

10 months ago · Santiago Trujillo
1 answers
Answer question

0

I found the solution thanks to a StackOverflow user's comment. I don't know why when I created the VPC Endpoint Gateway to connect to Dynamodb, AWS didn't update automatically my route tables.

It's a VPC Endpoint Gateway so you have to be sure that the traffic to Dynamodb is redirected to the gateway created (with a VPC Endpoint Interface you don't have to update route tables because you set the subnets in which it's available).

Your route tables should be like this: enter image description here

10 months ago · Santiago Trujillo Report
Answer question
Find remote jobs