Does Google Cloud Workflows work in europe-west2? - google-workflows

I'm trying to deploy a Google Cloud Workflow using terraform resource google_workflows_workflow.
Here is my code:
resource "google_workflows_workflow" "example" {
project = var.project_id
name = "workflow-example"
region = "europe-west2"
description = "My first workflow"
service_account = var.service_account_email
source_contents = <<-EOF
# etc...
EOF
It fails with:
Error creating Workflow: googleapi: Error 403: Location europe-west2 is not found or access is unauthorized
Why is this? Is workflows not available in europe-west2?

The closest Workflows region as of April 2021 is europe-west4.
Depending on your use case, region may not be as important for Workflows as it might be for other services. A workflow can call endpoints in any region, and in most cases latency is less important.

Related

MinIO .Net client API failing with bogus General Exception

MinIO is returning a general exception when calling the API from a .net client. In the library parsing the xml fails telling me that "Client calls PutObjectAsync General Exception 'doctype' is an unexpected token. The expected token is 'DOCTYPE'" which is no help at all.
MinIO Version
2021-09-09T21:37:07Z
Uploading objects using the webconsole works as expected.
Can you share an example of the code you are using? Please make sure you are using the S3 endpoint (running on port 9000 by default) and not the console-ui endpoint (9090 by default).
Here is a simple example of how to use the .net library to connect to the MinIO running on https://play.min.io:9000.
using Minio;
// Initialize the client with access credentials.
private static MinioClient minio = new MinioClient("play.min.io",
"Q3AM3UQ867SPQQA43P2F",
"zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"
).WithSSL();
// Create an async task for listing buckets.
var getListBucketsTask = minio.ListBucketsAsync();
// Iterate over the list of buckets.
foreach (Bucket bucket in getListBucketsTask.Result.Buckets)
{
Console.WriteLine(bucket.Name + " " + bucket.CreationDateDateTime);
}
Please read more at https://docs.min.io/docs/dotnet-client-quickstart-guide.html

How can I call list of ec2 instance based on the app code using tag method

I am trying to get all the instance(server name) ID based on the app. Let's say I have an app in the server. How do I know which apps below to which server. I want my code to find all the instance (server) that belongs to each app. Is there any way to look through the app in the ec2 console and figure out the servers are associated with the app. More of using tag method
import boto3
client = boto3.client('ec2')
my_instance = 'i-xxxxxxxx'
(Disclaimer: I work for AWS Resource Groups)
Seeing your comments that you use tags for all apps, you can use AWS Resource Groups to create a group - the example below assumes you used App:Something as tag, first creates a Resource Group, and then lists all the members of that group.
Using this group, you can for example get automatically a CloudWatch dashboard for those resources, or use this group as a target in RunCommand.
import json
import boto3
RG = boto3.client('resource-groups')
RG.create_group(
Name = 'Something-App-Instances',
Description = 'EC2 Instances for Something App',
ResourceQuery = {
'Type': 'TAG_FILTERS_1_0',
'Query': json.dumps({
'ResourceTypeFilters': ['AWS::EC2::Instance'],
'TagFilters': [{
'Key': 'App',
'Values': ['Something']
}]
})
},
Tags = {
'App': 'Something'
}
)
# List all resources in a group using a paginator
paginator = RG.get_paginator('list_group_resources')
resource_pages = paginator.paginate(GroupName = 'Something-App-Instances')
for page in resource_pages:
for resource in page['ResourceIdentifiers']:
print(resource['ResourceType'] + ': ' + resource['ResourceArn'])
Another option to just get the list without saving it as a group would be to directly use the Resource Groups Tagging API
What you install on an Amazon EC2 instance is totally up to you. You do this by running code on the instance itself. AWS is not involved in the decision of what you install on the instance, nor does it know what you installed on an instance.
Therefore, you will need to keep track of "what apps are installed on what server" yourself.
You might choose to take advantage of Tags on instances to add some metadata, such as the purpose of the server. You could also use AWS Systems Manager to run commands on instances (eg to install software) or even use AWS CodeDeploy to roll-out software to fleets of servers.
However, even with all of these deployment options, AWS cannot track what you have put on each individual server. You will need to do that yourself.
Update: You can use AWS Resource Groups to view/manage resources by tag.
Here's some sample Python code to list tags by instance:
import boto3
ec2_resource = boto3.resource('ec2', region_name='ap-southeast-2')
instances = ec2_resource.instances.all()
for instance in instances:
for tag in instance.tags:
print(instance.instance_id, tag['Key'], tag['Value'])

Allocating EIP using Alibaba python SDK doesn't work

I am using python SDK for using Alibaba ECS . I couldn't create elastic ip (EIP) using it. I've used the following code.
from aliyunsdkcore.client import AcsClient
from aliyunsdkecs.request.v20140526 import AllocateEipAddressRequest
AccessKeyId = '*****************'
AccessKeySecret = '*******************'
DefaultRegion = 'us-east-1'
client = AcsClient(AccessKeyId, AccessKeySecret, DefaultRegion)
request_eip = AllocateEipAddressRequest.AllocateEipAddressRequest()
response = client.do_action_with_exception(request_eip)
It throws the following error.
aliyunsdkcore.acs_exception.exceptions.ServerException: HTTP Status: 500 Error:InternalError The request processing has failed due to some unknown error, exception or failure. RequestID: XXXXXXXXXXXXXXXXXXXXXXXXXXX
What am I missing here?
Please, help!
Here's the response from Alibaba Official support team, which solved my issue.
Dear Customer
We are sorry to inform you that this case is related to a known issue in ECS API. Our backend team will resolve this in the next version of the ECS, VPC API.
Meanwhile please add the optional parameter "InternetChargeType": "PayByBandwidth"in your request as a work around.
#Example Code:
def main():
client = AcsClient(
"LTxxxxxxxxxxxxH",
"RxxxxxxxxxxxxxxT",
"ur region")
request_eip = AllocateEipAddressRequest.AllocateEipAddressRequest()
request_eip.set_InternetChargeType('PayByTraffic')
response = client.do_action_with_exception(request_eip)
print(response)
Thank you

Terraform Heroku provider: Does it have resource for dyno?

Using terraform, I could create Heroku applications, create and attach add-ons and put the applications in a pipeline. After the infrastructure is created, everything is good except the dynos are not started. I used heroku/nodejs buildpack. Terraform's Heroku provider does not provide any explicit resource type that corresponds to Heroku dyno. Are we supposed to manually push application for deployment on Heroku when the necessary add-ons and pipeline are created with Terraform?
I googled a lot but couldn't figure out what could be the reason for the dynos not getting started after necessary infrastructure is in place.
Please help.
so today I wanted to test heroku with terraform and got the same issue
it looks like you need to push your app to the git_url reference provided by heroku_app
made a working example at https://github.com/nroitero/terraform_heroku
I'm doing as the example below, and it works.
First, defining the heroku app:
resource "heroku_app" "this" {
name = var.HEROKU_APP_NAME
region = var.HEROKU_REGION
space = var.HEROKU_SPACE
internal_routing = var.HEROKU_INTERNAL_ROUTING
Then, indicating where the node application is:
resource "heroku_build" "this" {
app = heroku_app.this.name
#buildpacks = [var.BUILDPACK_URL]
source = {
#url = var.SOURCE_URL
#version = var.SOURCE_VERSION
#testing path instead of source
path = var.SOURCE_PATH
}
}
And to define dynos, I'm using:
resource "heroku_formation" "this" {
app = heroku_app.this.name
type = var.HEROKU_FORMATION_TYPE
quantity = var.HEROKU_FORMATION_QTY
size = var.HEROKU_FORMATION_SIZE
depends_on = [heroku_build.this]
}
For the dyno size parameter (var.HEROKU_FORMATION_SIZE), use the official dyno type "name" as listed on https://devcenter.heroku.com/articles/dyno-types.
For private spaces, names are: private-s, private-m and private-l.

How to create app with parse server?

In parse.com, when I want to create new app, I use:
curl -X POST \
-H "X-Parse-Email: <PARSE_ACCOUNT_EMAIL>" \
-H "X-Parse-Password: <PARSE_ACCOUNT_PASSWORD>" \
-H "Content-Type: application/json" \
-d '{"appName":"my new app","clientClassCreationEnabled":false}' \
https://api.parse.com/1/apps
But when I deployed Parse server to Heroku and Digital Ocean, I didn't know to create new app, because my server doesn't have PARSE_ACCOUNT_EMAIL and PARSE_ACCOUNT_PASSWORD. When I deployed parse dashboard, it didn't have "Create a new app" like Parse.com.
How can I create new app with my self-hosted Parse server?
The self hosted parse servers can only handle one app per server, at least for now.
This means that you will have to use several installations of Parse, one app per installation using multiple servers or multiple instances of parse on the same server but configure each server to use different ports.
To answer you question: No you do not need to use parse.com to create new apps.
To create a new app you set the appID and password in the parse config/start file on your digital ocean or other hosted server.
The appID and password can be anything that you make up, it does not need to be from parse.com.
Below is an example of the environment settings in a startup file:
**Example file: ~/parse-server-example/my_app.js**
var express = require('express');
var ParseServer = require('parse-server').ParseServer;
// Configure the Parse API
var api = new ParseServer({
databaseURI: 'mongodb://localhost:27017/dev',
cloud: __dirname + '/cloud/main.js',
appId: 'myOtherAppId',
masterKey: 'myMasterKey'
});
var app = express();
// Serve the Parse API on the /parse URL prefix
app.use('/myparseapp', api);
// Listen for connections on port 1337
var port = 9999;
app.listen(port, function() {
console.log('parse-server-example running on port ' + port + '.');
});
Then run the file with:
node my_app.js
You can read more here: Parse Server at Digital Ocean
There is an open issue for that: https://github.com/ParsePlatform/parse-dashboard/issues/188
For the moment, I just use parse's hosted dashboard to create new apps. They say on January 28th, calls to their API will cease to function. They don't say that the hosted dashboard will be going away. I imagine that, if they don't get it into the self-hosted version, you'll still be able to create new apps within the hosted dashboard.
In any case, for now what I am doing is creating the app as I normally would in the hosted dashboard. I then run the migration tool at app > app settings > general > Migrate to external database option. You have to add at least one class to the database in order for the migration tool to work. Basically, the migration tool will fail with some ambiguous error message if it's a completely fresh app with a clean database.
Once the migration is done and read/writes are hooked up to my self-hosted Parse Server, I then providing the app's keys, etc in the parse-dashboard-config.json file of my self-hosted Parse Dashboard. You can add multiple apps to this config file, thus manage all of your apps from a single self-hosted Parse Dashboard.
Here's an example of that config file with two apps:
{
"apps": [
{
"serverURL": "https://my-parse-server-1.herokuapp.com/parse",
"appId": "b44gL7uAB1z...lwUJneaoKdX9",
"masterKey": "HrSqFbH...hfiwuCCOLDvHF",
"appName": "parse-server-1"
},
{
"serverURL": "https://my-parse-server-2.herokuapp.com/parse",
"appId": "b44gL7uAB1z...lwUJneaoKdX9",
"masterKey": "HrSqFbH...hfiwuCCOLDvHF",
"appName": "parse-server-2"
}
],
"users": [
{
"user":"admin",
"pass":"somePasswordHere"
}
]
}
This seems to be the only way currently to create apps that you can connect to your self-hosted Parse Dashboard.
It's also important to note that, at the moment, it appears as though the self-hosted Parse Server package only supports a single app. I have no idea if there are any plans to support multiple apps as they have done with Parse Dashboard.
And finally, you can use the Parse Command Line tool to create new apps as well: https://parse.com/docs/cloudcode/guide#command-line-creating-a-parse-app
They also have some interesting integrations with Heroku which facilitate the entire process. That might be worth looking into. You could create a simple Node app yourself with a GUI for creating new Parse apps. In this case, you would create a simple form, that when submitted is validated and then executes the command line methods to create a new app with the ShellJS node package. You could even modify the Parse Dashboard package to include this feature yourself within the self-hosted Dashboard.

Resources