Posts

Showing posts with the label amazon-web-services

AWS SNS HTTP subscription is not calling endpoint

AWS SNS HTTP subscription is not calling endpoint I have deployed AWS SNS using Localstack in my dev machine and now I'm trying to consume messages I'm emitting from awslocal CLI (basically it's a aws against my local Localstack infra) awslocal aws First, I have created a topic: $ awslocal sns create-topic --name my-topic Then, I've created a HTTP subcription against http://localhost:8080/sns/publish : http://localhost:8080/sns/publish $ awslocal sns subscribe --topic-arn "arn:aws:sns:us-east-1:123456789012:my-topic" --protocol http --notification-endpoint http://localhost:8080/sns/publish I have a server running at localhost in port 8080 with a POST /sns/publish endpoint. It is supposed to be called in order to confirm the subscription. But it's never called. localhost 8080 /sns/publish I have some clues. I have deployed Localstack using Docker. After checking the container logs, I have seen this error: 2018-07-02T10:20:03:INFO:werkzeug: 127.0.0.1 - ...

Express launching Angular application

Express launching Angular application I have an express server setup online which loads multiple ports and those ports are setup on subdomains for example. port 9000 loads the main domain.com port 8000 loads the main application at "app.domain.com" port 1000 loads "signup.domain.com" and the build version of the app is on port 8500 "build.domain.com". The application is an Angular application however when I go to load the Angular app it loads on port 4200 or it says 8500 is in use. So currently I am loading that in express like so: // Build Application - In Development var appbuild = express(); appbuild.get('/', function (req, res){ res.sendFile('/app/build/myapp/src/index.html', { root: '.' }) }); var port = 8500; appbuild.listen(port); console.log('Build App Listening on port', port); So my question is in Express how can I instead of writing sendfile command make it launch the angular app in...

How to set up alarm for 'n' appsCompleted Metrics in EMR per day in AWS console

Image
How to set up alarm for 'n' appsCompleted Metrics in EMR per day in AWS console When I set up alarm for appsCompleted <12 for 1 out of 1 datapoints it says that the alarm will go off in the following scenario: appsCompleted This alarm will trigger when the blue line goes below the red line for 1 datapoints within 1 day This alarm will trigger when the blue line goes below the red line for 1 datapoints within 1 day But it does not seem to change the threshold by adding up values per day. That is the next days threshold is still 12 and not 24. I suspect that the threshold (red line) is crossed on the first day itself and that is why no alarms are triggered even in case of failure. State changed to OK at [DATE]. Reason: Threshold Crossed: 1 out of the last 1 datapoints [Timestamp] was not less than the threshold (12.0) (minimum 1 datapoint for ALARM -> OK transition). State changed to OK at [DATE]. Reason: Threshold Crossed: 1 out of the last 1 datapoints [Timestamp] was not...

Error in connecting to DB: Error: Handshake inactivity timeout

Error in connecting to DB: Error: Handshake inactivity timeout I am running a node.js server which is using mysql DB. I was working fine but suddenly it has started throwing following error. Below is the stacktrace of the error: Error in connecting to DB: Error: Handshake inactivity timeout at Handshake.<anonymous> (/home/ubuntu/backend/node_modules/mysql/lib/protocol/Protocol.js:164:17) at emitNone (events.js:86:13) at Handshake.emit (events.js:185:7) at Handshake._onTimeout (/home/ubuntu/backend/node_modules/mysql/lib/protocol/sequences/Sequence.js:129:8) at ontimeout (timers.js:365:14) at tryOnTimeout (timers.js:237:5) at Timer.listOnTimeout (timers.js:207:5) -------------------- at Protocol._enqueue (/home/ubuntu/backend/node_modules/mysql/lib/protocol/Protocol.js:145:48) at Protocol.handshake (/home/ubuntu/backend/node_modules/mysql/lib/protocol/Protocol.js:52:23) at PoolConnection.connect (/home/ubuntu/backend/node_modules/mysql/lib/Connection.js:130:18) at Pool.getConnect...

Best way to copy messages within 2 SQS queues across AWS accounts

Best way to copy messages within 2 SQS queues across AWS accounts What is the best way to copy messages from one SQS queue to the other across AWS accounts? After searching, I attached the policy granting full read and write access for the IAM user(in the destination account) to the source queue. Then I attached a Permission to the source queue for Everyone to have send and receive message access on the queue. I am getting below error - Exception in thread "main" com.amazonaws.AmazonServiceException: The security token included in the request is invalid. (Service: AmazonSQS; Status Code: 403 Probably there is something wrong with the IAM user credentials, however, I have refreshed the credentials, but I'm still getting the error 1 Answer 1 Permissions are a secondary matter. The primary question is how to "copy messages from one SQS queue to the other across AWS accounts...

How do I set the instance count of a Elastic Beanstalk environment to 0?

Image
How do I set the instance count of a Elastic Beanstalk environment to 0? In other words I would like to temporarily turn off an environment (and its associated billing costs) but not delete it entirely. It seems if I set the [Configuration > Web Tier > Scaling > Minimum instance count] to 0 along with the related "Maximum instance count", AWS rejects those settings as invalid. Ditto for questionable values like 0.1. Any ideas for temporarily taking an Elastic Beanstalk environment out of service? 3 Answers 3 You can achieve this by defining time periods in your environment. from your Elastic Load blanancer dashboard navigate through: Configuration -> Capacity -> Time-based scaling -> Scheduled actions. You may choose to use multiple scheduled actions to start and stop your environment. i.e. One to start your environment and another to stop it, or scale out during high loa...

How to attach vpc link to get method in api gateway via cloudformation

How to attach vpc link to get method in api gateway via cloudformation I am trying to create a api gateway via cloudformation which use a vpc link to an internal beanstalk network load balancer: Here is my code to create vpc link: VpcLink: Type: AWS::ApiGateway::VpcLink Properties: Description: vpc link Name: channel-vpc-link TargetArns: - !ImportValue channel-dns-arn and here is my api gtw code: GetMethod: Type: AWS::ApiGateway::Method DependsOn: VpcLink Properties: AuthorizationType: NONE HttpMethod: GET #RequestParameters: # method.request.path.proxy: true Integration: Type: HTTP IntegrationHttpMethod: GET Uri: Fn::Join: - '' - - "http://" - ${stageVariables.channelUrl} - "/channels" - "/stories" IntegrationResponses: - StatusCode: 200 ResponseParameters: method.response.header.Access-Control-Allow-Origin: "'*'...

AWS DynamoDB simple query from DB

Image
AWS DynamoDB simple query from DB I have a simple table on DynamoDB with an id and email I think I created the indexes and now I just want to query for a specific item with a specific email value. I keep getting errors on that and cant find the right way. This is my "describe" of the table: now how do I query for an item with an email value of "example@example.com" any help will be highly appreciated! 1 Answer 1 You need to create another index (a Global Secondary Index) only on the email field, if you want to be able to query on only that field. You will have to specify the name of the index you want to use as part of the query. email Alternatively, you can do a scan instead of a query . scan query Thanks, can you share an example? And if I have other fields I need to do that for each one? And I thought i added a keyType range there ...

amazon EC2 - How to make wp-config.php to writable?

Image
amazon EC2 - How to make wp-config.php to writable? I'm using Amazon EC2 with Bitnami wordpress. I recently tried to use plugins, they install and activate well, but there are still errors. Those errors look like permission errors. Also, perhaps, how to make the whole wordpress directory writable? I'm only accessing through SSH. Some of the errors: "A definition of a siteurl or homeurl was detected in your wp-config.php, but the file is not writable. Set your wp-config.php to writable and reload this page." From W3 total Cache: Please add the error messages you get back. – Damien Feb 8 '17 at 12:42 one is: " A definition of a siteurl or homeurl was detected in your wp-config.php, but the file is not writable. Set your wp-config.php to writable and reload this page." ...

AWS EC2 Instance Termination Protection not working under auto-scale IN

AWS EC2 Instance Termination Protection not working under auto-scale IN I have auto scaling group with 3 instances. I configure 1 specific Instance to termination protection = true. However when I modify my autoscaling rules. To the Desired Instance: 2 and Min Instance: 2. That instance above that I recently modified with termination protection still get terminated. Any thoughts? WHY do you wish to apply termination protection on Auto Scaling instances? That mostly defeats the purpose of using an Auto Scaling group. – John Rotenstein Jul 2 at 1:42 2 Answers 2 When you configure EC2 with auto scaling you should use an AMI that would have your golden config. Termination protection will be overwritten by auto scaling. What's your purpose to have an ins...