Skip to content

Commit

Permalink
update docs with AWS serverless repository info (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
zaro0508 authored Sep 24, 2020
1 parent 6fa0a41 commit 219744d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 12 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cache: pip
env:
global:
- REPO_NAME="${PWD##*/}"
- SAM_CLI_TELEMETRY=0
- LAMBDA_BUCKET="essentials-awss3lambdaartifactsbucket-x29ftznj6pqw"
- CFN_BUCKET="bootstrap-awss3cloudformationbucket-19qromfd235z9"
install:
Expand All @@ -12,7 +13,6 @@ install:
- wget https://github.com/Sage-Bionetworks/infra-utils/archive/master.zip -O /tmp/infra-utils.zip
- unzip -j -n /tmp/infra-utils.zip -x "infra-utils-master/.gitignore" "infra-utils-master/LICENSE" "infra-utils-master/*.md" "infra-utils-master/aws/*"
- ./setup_aws_cli.sh || travis_terminate 1
- export SAM_CLI_TELEMETRY=0
stages:
- name: validate
- name: deploy
Expand All @@ -24,7 +24,6 @@ jobs:
script:
- pre-commit run --all-files
- sam build
# - python -m pytest tests/ -v
- stage: deploy
script:
- sam build
Expand Down
49 changes: 39 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ aws ssm put-parameter \
### Create a local build

```shell script
$ sam build --use-container
$ sam build
```

### Run locally
Expand All @@ -77,16 +77,12 @@ $ python -m pytest tests/ -v

## Deployment

### Build

```shell script
sam build
```

## Deploy Lambda to S3
This requires the correct permissions to upload to bucket
### Deploy Lambda to S3
Deployments are sent to the
[Sage cloudformation repository](https://bootstrap-awss3cloudformationbucket-19qromfd235z9.s3.amazonaws.com/index.html)
which requires permissions to upload to Sage
`bootstrap-awss3cloudformationbucket-19qromfd235z9` and
`essentials-awss3lambdaartifactsbucket-x29ftznj6pqw`
`essentials-awss3lambdaartifactsbucket-x29ftznj6pqw` buckets.

```shell script
sam package --template-file .aws-sam/build/template.yaml \
Expand All @@ -96,7 +92,29 @@ sam package --template-file .aws-sam/build/template.yaml \
aws s3 cp .aws-sam/build/s3-synapse-sync.yaml s3://bootstrap-awss3cloudformationbucket-19qromfd235z9/s3-synapse-sync/master/
```

## Publish Lambda

### Private access
Publishing the lambda makes it available in your AWS account. It will be accessible in
the [serverless application repository](https://console.aws.amazon.com/serverlessrepo).

```shell script
sam publish --template .aws-sam/build/cfn-cr-synapse-tagger.yaml
```

### Public access
Making the lambda publicly accessible makes it available in the
[global AWS serverless application repository](https://serverlessrepo.aws.amazon.com/applications)

```shell script
aws serverlessrepo put-application-policy \
--application-id <lambda ARN> \
--statements Principals=*,Actions=Deploy
```

## Install Lambda into AWS

### Sceptre
Create the following [sceptre](https://github.com/Sceptre/sceptre) file

Create a sceptre s3-synapse-sync.yaml file used to deploy cloudformation
Expand Down Expand Up @@ -128,6 +146,17 @@ Install the lambda using sceptre:
sceptre --var "profile=my-profile" --var "region=us-east-1" launch prod/s3-synapse-sync.yaml
```

### AWS Console
Steps to deploy from AWS console.

1. Login to AWS
2. Access the
[serverless application repository](https://console.aws.amazon.com/serverlessrepo)
-> Available Applications
3. Select application to install
4. Enter Application settings
5. Click Deploy

---
## Create Buckets
**Note**: Buckets must be explicitly named. Bucket names must begin with the prefix specified in the lambda parameter `BucketNamePrefix` (e.g. htan-dcc-*) and must be globally unique across all AWS accounts.
Expand Down

0 comments on commit 219744d

Please sign in to comment.