Testing of Data Center app for submitting to Atlassian Marketplace
Asked by alex.kislyak:

Hi all.

I configured instances on AWS and created my own "experiment" according to this documentation ([doc1](https://confluence.atlassian.com/enterprise/atlassian-performance-testing-framework-935575100.html?_ga=2.70791632.1190939118.1545203916-844433748.1542033927) \& [doc2](https://confluence.atlassian.com/enterprise/performance-testing-framework-for-confluence-935577039.html)).

Experiment "1.json":

```
{
 "product": "Confluence",
 "duration": 300000,
 "workload": "confluence-mixed",
 "threads": [
 {
 "name": "1-node",
 "instance": {
 "stack": {
 "Name": "1node"
 }
 },
 "stages": [
 { "clients": 2000 },
 { "clients": 4000 },
 { "clients": 8000 },
 { "clients": 15000 }
 ],
 "worker": {
 "stack": {
 "Name": "1node"
 }
 }
 },
 {
 "name": "2-node",
 "instance": {
 "stack": {
 "Name": "2node"
 }
 },
 "stages": [
 { "clients": 2000 },
 { "clients": 4000 },
 { "clients": 8000 },
 { "clients": 15000 }
 ],
 "worker": {
 "stack": {
 "Name": "2node"
 }
 }
 },
 {
 "name": "4-node",
 "instance": {
 "stack": {
 "Name": "4node"
 }
 },
 "stages": [
 { "clients": 2000 },
 { "clients": 4000 },
 { "clients": 8000 },
 { "clients": 15000 }
 ],
 "worker": {
 "stack": {
 "Name": "4node"
 }
 }
 }
 ]

}
```

But I received errors when I try to start this experiment:

```
./Orchestrate.py -e 1
/bin/sh: 1: /usr/local/bin/cloudtoken: not found
2018-12-19 09:37:34,754 - MainThread - ERROR - Unable to locate '/root/.config/cloudtoken/tokens.json' unable to load AWS credentials, trying to proceed without them.
Traceback (most recent call last):
 File "./Orchestrate.py", line 77, in <module>
 command()
 File "/home/ubuntu/.ve/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
 return self.main(*args, **kwargs)
 File "/home/ubuntu/.ve/local/lib/python2.7/site-packages/click/core.py", line 696, in main
 rv = self.invoke(ctx)
 File "/home/ubuntu/.ve/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
 return ctx.invoke(self.callback, **ctx.params)
 File "/home/ubuntu/.ve/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
 return callback(*args, **kwargs)
 File "./Orchestrate.py", line 73, in command
 Orchestrate(experiment, network, retain).run()
 File "./Orchestrate.py", line 25, in __init__
 self.aws = Aws()
 File "/home/ubuntu/src/e3/provisioning/Aws.py", line 24, in __init__
 self.cloud_formation = self._session.resource("cloudformation")
 File "/home/ubuntu/.ve/local/lib/python2.7/site-packages/boto3/session.py", line 389, in resource
 aws_session_token=aws_session_token, config=config)
 File "/home/ubuntu/.ve/local/lib/python2.7/site-packages/boto3/session.py", line 263, in client
 aws_session_token=aws_session_token, config=config)
 File "/home/ubuntu/.ve/local/lib/python2.7/site-packages/botocore/session.py", line 824, in create_client
 client_config=config, api_version=api_version)
 File "/home/ubuntu/.ve/local/lib/python2.7/site-packages/botocore/client.py", line 69, in create_client
 verify, credentials, scoped_config, client_config, endpoint_bridge)
 File "/home/ubuntu/.ve/local/lib/python2.7/site-packages/botocore/client.py", line 222, in _get_client_args
 verify, credentials, scoped_config, client_config, endpoint_bridge)
 File "/home/ubuntu/.ve/local/lib/python2.7/site-packages/botocore/args.py", line 44, in get_client_args
 endpoint_url, is_secure, scoped_config)
 File "/home/ubuntu/.ve/local/lib/python2.7/site-packages/botocore/args.py", line 101, in compute_client_args
 service_name, region_name, endpoint_url, is_secure)
 File "/home/ubuntu/.ve/local/lib/python2.7/site-packages/botocore/client.py", line 295, in resolve
 service_name, region_name)
 File "/home/ubuntu/.ve/local/lib/python2.7/site-packages/botocore/regions.py", line 122, in construct_endpoint
 partition, service_name, region_name)
 File "/home/ubuntu/.ve/local/lib/python2.7/site-packages/botocore/regions.py", line 135, in _endpoint_for_partition
 raise NoRegionError()
botocore.exceptions.NoRegionError: You must specify a region.
```

I can not find how to configure AWS credentials for experiments.

I received this message when I try to execute Run.py

```
./Run.py --run 1
Usage: Run.py [OPTIONS]

Error: Invalid value for "-r" / "--run": invalid choice: 1. (choose from )?
```

Any suggestions are welcome.


Answers:
author: Julius Davies _bit-booster_com_
body: From an AWS instance try the "aws sts get-session-token" command!

You might need to run "aws configure" beforehand once to set the secret-key, and to set output to "json".

```
aws sts get-session-token

Outputs:

{
  "Credentials": {
    "AccessKeyId": "ASANAZN33LXUBJIGR4HS9",
    "SecretAccessKey": "applebig/nsfskljfdlkjwefsdf/hvKKdlwe",
    "SessionToken": "fogowogowkef//////////etcatdadfc[...this-one-is-quite-long...]fjdkaflkje=",
    "Expiration": "2019-02-28T22:35:06Z"
  }
}
```

Sadly that JSON output above is not quite right. You need to remove the outer brackets, remove the "Credentials" key, and change "SessionToken" to just "Token", like so:

```
{
  "AccessKeyId": "ASANAZN33LXUBJIGR4HS9",
  "SecretAccessKey": "applebig/nsfskljfdlkjwefsdf/hvKKdlwe",
  "Token": "fogowogowkef//////////etcatdadfc[...this-one-is-quite-long...]fjdkaflkje=",
  "Expiration": "2019-02-28T22:35:06Z"
}
```

Stuff that into "\~/.config/cloudtoken/tokens.json" and everything should start working!

(But use the values that your invocation of "aws sts get-session-token" returned - don't use my sample values.) ;-)


author: Stephen Sifers
body: Hello Alex and welcome to the Community!

Your error is related to an AWS credential issue (as you have stated). I did find a resource which mentioned reviewing the following to manage your AWS credentials. You can find more about credentials at [Working with AWS Credentials](https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html).

Please review the above reference and let us know if you're still having issues with authentication.

Regards,  
Stephen Sifers


Tags: atl-dev

confluence-server

data-center

elastic-experiment-executor

performance

server