As developer I don’t want to connect all the time to Amazon Web Services (AWS) and also to reduce AWS Cost(to reduce usage charges), we will keep aws in local development environment
Why? why is testing in the cloud is not good enough?
- It takes time, getting your code there, and spinning up an instance will forever be slower than just firing up a few commands locally.
- It’s not free! spinning up instances has a cost.
Here comes localstack — created a local, offline version of the AWS infrastructure!
- A fully functional local AWS cloud stack. Develop and test your cloud & Serverless apps offline!
- provides an easy-to-use test/mocking framework for developing Cloud applications.
PFB steps for installing local stack in the local environment
- Attached the docker-compose file to run the local stack from the docker hub through the image.PFA
- You can run Local stack directly from the command line (docker-compose up -d) through the attached docker file.
- In the services section, You can define a list of AWS services to emulate. In our case, we’re just using S3, SQS, DynamoDB but we can include additional APIs, i.e. SERVICES=s3, lambda. There’s more on this in the Localstack docs.
- To make sure it’s working, we can visit http://localhost:8055 to see Localstack’s web UI
And Now AWS is now inside our computer, to access dynamo DB locally through GUI we will use dynamodb-admin.It can be installed through the following steps
- npm install dynamodb-admin -g
- Set DYNAMO_ENDPOINT=http://localhost:4569
Now , dynamodb-admin listening on http://localhost:8001
And also to debug Go Lang Lambda using Sam CLI , we will use Go Land IDE . PFB steps to debug the go Lang lambda
- set GOARCH=amd64
go build -o ./dlv github.com/go-delve/delve/cmd/dlv
go get -u github.com/aws/aws-lambda-go/…
go build -gcflags=”-N -l” -o hello-world/main ./hello-world
sam local start-api -d 5989 — debugger-path . — debug-args=”-delveAPI=2"
#AWS #LocalStack #Cost