Coder Social home page Coder Social logo

aws-vpc-endpoints's Introduction

AWS VPC Endpoints

This sandbox implements a VPC Interface Endpoint to send messages to a SQS queue from an EC2 instance that runs in a private subnet.

In addition to provisioning the core resources, policies will be configured to use proper conditions.

The SQS queue will only accept sqs:SendMessage operations coming from the configured VPC Endpoint:

"Condition": {
  "StringNotEquals": {
    "aws:sourceVpce": "vpce-1a2b3c4d"
  }
}

Setup

Create the EC2 instance key pair material:

ssh-keygen -f modules/instance/ec2_id_rsa

To create the environment simply run:

terraform init
terraform apply -auto-approve

Connect to the EC2 instance:

aws ssm start-session --target i-00000000000000000 --region sa-east-1

Once the environment is created, connect to the EC2 instance using SSM. Confirm that the name is resolving to a private IP:

$ dig +short sqs.sa-east-1.amazonaws.com
10.0.50.54

Confirm that you're authenticated from within the EC2 instance:

aws sts get-caller-identity

Now send a message to the endpoint to the see the results:

aws sqs send-message --queue-url https://sqs.sa-east-1.amazonaws.com/000000000000/my-private-queue --message-body Hello

Clean-up

terraform destroy

aws-vpc-endpoints's People

Contributors

epomatti avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.