bpeng / tickets

0 stars 0 forks source link

AWS #5

Open bpeng opened 8 years ago

bpeng commented 8 years ago

GeoNet

https://geonet.signin.aws.amazon.com/console

Support

https://aws.amazon.com/premiumsupport/faqs/

lambda

http://docs.aws.amazon.com/lambda/latest/dg/welcome.html

http://docs.aws.amazon.com/lambda/latest/dg/with-userapp-walkthrough-custom-events-invoke.html

workshop

https://github.com/buzzynz/aws-lambda-zombie-workshop

bpeng commented 7 years ago

AWS ebcli

not sucessful on Fedora (OK on mac)

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html

 980  pip install --upgrade --user awsebcli
  981  sudo pip install --upgrade --user awsebcli
error:
Could not find any downloads that satisfy the requirement awsebcli
  No distributions at all found for awsebcli

  982  pip install --user virtualenv
error

  983  sudo pip install --user virtualenv
not work

  988  sudo dnf search virtualenv
  989  sudo dnf install python-virtualenv.noarch
  990  virtualenv ~/eb-ve
  991  virtualenv -p /usr/bin/python3.4 ~/eb-ve
  992  source ~/eb-ve/bin/activate
  993   pip install --upgrade awsebcli
error:
  Could not find any downloads that satisfy the requirement awsebcli
  No distributions at all found for awsebcli

  994   pip install --allow-unverified --upgrade awsebcli
  998  ll eb-ve/bin/python3.4
bpeng commented 7 years ago

aws EB Docker

http://victorlin-blog.logdown.com/ https://github.com/victorlin/docker-eb-demo

bpeng commented 7 years ago

SQS command aws sqs send-message --queue-url https://sqs.ap-southeast-2.amazonaws.com/582058524534/geonet_impact_report --message-body "{src:'DUND',pga:1.20,pgv:1.33}"

bpeng commented 7 years ago

GeoNet aws applications Deployment

https://github.com/GeoNet/devx/issues/13

aws shakenz

*EB deploy

https://github.com/GeoNet/DevTools/blob/master/deploy/AWS-EB.md
sudo docker run --env-file ./env.list -p 8080:8080  83660dffe023

docker tag 862640294325.dkr.ecr.ap-southeast-2.amazonaws.com/geonet-rest:latest 582058524534.dkr.ecr.ap-southeast-2.amazonaws.com/geonet-rest:latest

aws --profile adminuser ecr get-login --region ap-southeast-2 

*shakenz application deploymemnt on aws ebs

  1. build docker image for geonet-rest -- create repository in aws ECR: geonet-rest
    http://docs.aws.amazon.com/AmazonECR/latest/userguide/ECR_GetStarted.html
    https://ap-southeast-2.console.aws.amazon.com/ecs/home?region=ap-southeast-2#/repositories

    -- edit haz/build.sh, change repository to 582058524534.dkr.ecr.ap-southeast-2.amazonaws.com

-- build image:

   ./build.sh geonet-rest
   docker images

-- push image to aws

   aws --profile adminuser ecr get-login --region ap-southeast-2
   docker push 582058524534.dkr.ecr.ap-southeast-2.amazonaws.com/geonet-rest:latest

-- build applicatin geonet-rest.zip

   edit geonet-rest/deploy/Dockerrun.aws.json, change image repository name to: 582058524534.dkr.ecr.ap-southeast-2.amazonaws.com/geonet-rest:latest     
   zip geonet-rest.zip  Dockerrun.aws.json
   zip geonet-rest.zip  -r .ebextensions
  1. create application environment in AWS EBS
    https://ap-southeast-2.console.aws.amazon.com/elasticbeanstalk/home?region=ap-southeast-2#/applications  
    use: generic Docker container
    set environment variables
    deploy geonet-rest.zip

*Errors

 2017-01-12 15:51:48 UTC+1300   ERROR   Failed to deploy application.
2017-01-12 15:51:48 UTC+1300    ERROR   Service:AmazonECS, Code:ClientException, Message:Container list cannot be empty., Class:com.amazonaws.services.ecs.model.ClientException

 IamInstanceProfile: The environment does not have an IAM instance profile associated with it. To improve deployment speed please associate an IAM instance profile with the environment. 

*VPC

http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Introduction.html
bpeng commented 7 years ago

Deploy www-geonet for beta-sandbox...

cd www-geonet
cp ~/Desktop/build-dev.sh 
./build-dev.sh www-geonet
eval $(aws --profile=adminuser  ecr get-login --region ap-southeast-2)
docker push 582058524534.dkr.ecr.ap-southeast-2.amazonaws.com/www-geonet:test-prod
login aws console
select Elastic Beanstock/www-geonet/application versions/test-prod, and Deploy

http://beta-sandbox.ap-southeast-2.elasticbeanstalk.com/

bpeng commented 7 years ago

Download some SC3ML using the aws cli (the bucket should be publicly accessible for read) e.g.,

http://docs.aws.amazon.com/cli/latest/reference/s3/sync.html

aws s3 sync . s3://mybucket
aws s3 sync s3://seiscompml07 /work/seismcompml07 --exclude "*"  --include "2015p*"